Omnibus is Starter Pack Library to Build Solid Architecture Apps with MVVM Design Pattern for your Android Application.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.rakaadinugroho:Omnibus:$OMNIBUS_VERSION'
}
- Compact Base Component
- Easy Network Usage
- Android Architecture Component Support
You can also:
- Use Utils Component
- Simple Permission Utils
You can extends your activities with BaseActivity<YourDataBinding, YourViewModel>
or if you use Fragment BaseFragment<YourDataBinding, YourViewModel>
class AuthActivity : BaseActivity<ActivityAuthBinding, AuthViewModel>() {
override val layoutId: Int
get() = R.layout.activity_auth
override val initViewModel: KClass<AuthViewModel>
get() = AuthViewModel::class
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
}
class AuthViewModel: BaseViewModel<AuthView>() {
// your action
}
interface AuthView : BaseView {
fun loadUserData()
}
Create Koin Module Component first
val myModule : Module = applicationContext {
viewModel { AuthViewModel(get()) }
provide { AuthView() as Repository }
}
class MyApplication : Application(){
override fun onCreate() {
super.onCreate()
startKoin(this, listOf(myModule))
}
}
With Omnibus you have to Enjoyable Design Patter, You have'nt to Declare Component Like
val model = getViewModel<MyViewModel>()
or
val model by viewModel<MyViewModel>()
Enjoy with MVVM!