README

Apache 2.0 License Release Join the chat at https://gitter.im/nekocode/kotgo

Create Template Project

You can createOrGet a new Kotgo template project fast by using the following command. Just paste and execute it at a terminal prompt. Have fun!

python -c "$(curl -fsSL https://raw.githubusercontent.com/nekocode/kotgo/master/project_creator.py)"

Of course, you can also download the python script to your local disk to run it. It depends on the requests lib.

Description

Kotgo is an android development framework using MVP architecture, it is built entirely with Kotlin. There are some related articles talk about it.

Package structure

cn.nekocode.kotgo.sample
├─ data
│  ├─ DO
│  ├─ repo
│  └─ service
│ 
├─ ui
│  └─ screen_one
│     ├─ Contract.kt
│     ├─ Presenter.kt
│     └─ Activity.kt
│
└─ App.kt

Dependencies

  • kotlin: 1.0.4
  • anko: 0.9
  • rxkotlin: 0.60.0
  • retrofit: 2.1.0
  • picasso: 2.5.2
  • hawk: 2.0.0-Alpha
  • paperparcel: 1.0.0

Sample

Thanks to gank.io. The sample app fetchs photos from it.

Another more perfect Sample: Murmur

Component Library

You can only use the kotgo’s component library. It provides many useful tools to help you to build a MVP project fast and simply. Just add the JitPack repository to your root build.gradle:

repositories {
    maven { url "https://jitpack.io" }
}

And then add the dependency to your sub build.gradle:

dependencies {
    compile 'com.github.nekocode:kotgo:<lastest-version>'
}

RxLifecycle & RxBus

You can bind the RxJava subscriptions into the lifecycle of the class that implements RxLifecycle.Impl (such as base activity, fragment and presenter). It can help you unsubscribe the Observable when the activity or fragment is destoried.

MeiziRepo.getMeizis(50, 1).bindLifecycle(presenter).onUI {
    view.refreshMeizis(it)
}

And you can use RxBus to send events everywhere. And then subscribe them in the class that implements RxLifecycle.Impl

RxBus.send("Success")
RxBus.subscribe(String::class.java) { showToast(it) }

Fragment Presenter

This library uses fragment to implement presenter.

class MeiziPresenter(): BasePresenter<Contract.View>(), Contract.Presenter {
    override fun onViewCreated(view: Contract.View?, savedInstanceState: Bundle?) {
        view?.showToast("View created.")
    }
}

Single Activity Multiple Fragments

You can build applications with only one single FragmentActivity. Then use fragment instead of activity to make pages. The FragmentActivity provides following functions to help you manage the fragment page in the stack.

push()
pushForResult()
popAll()
popUntil()
popTop()
startActivityForResult()

Related Repositories

kotgo

kotgo

...


Top Contributors

nekocode gitter-badger wsxyeah nyakokishi

Releases

-   1.3 zip tar
-   1.2.3 zip tar
-   1.2.2 zip tar
-   1.2.1 zip tar
-   1.2 zip tar
-   1.1.1 zip tar
-   1.1.0 zip tar
-   1.0.9 zip tar
-   1.0.8 zip tar
-   1.0.7 zip tar
-   1.0.6 zip tar
-   1.0.5 zip tar
-   1.0.4 zip tar
-   1.0.3 zip tar
-   1.0.2 zip tar
-   1.0.1 zip tar
-   1.0.0 zip tar
-   0.9.6 zip tar
-   0.9.4 zip tar
-   0.9.2 zip tar
-   0.9.1 zip tar
-   0.9.0 zip tar
-   0.8.4 zip tar
-   0.8.3 zip tar
-   0.8.2 zip tar
-   0.8.1 zip tar
-   0.8.0 zip tar
-   0.7.0 zip tar
-   0.6.2 zip tar
-   0.6.1 zip tar