Skip to content

🍢 Android Architecture Component for MVVM Pattern Pack Library for Kotlin

Notifications You must be signed in to change notification settings

rakaadinugroho/Omnibus

Repository files navigation

Omnibus

Omnibus is Starter Pack Library to Build Solid Architecture Apps with MVVM Design Pattern for your Android Application.

How to Use

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
dependencies {
	implementation 'com.github.rakaadinugroho:Omnibus:$OMNIBUS_VERSION'
}

Features

  • Compact Base Component
  • Easy Network Usage
  • Android Architecture Component Support

You can also:

  • Use Utils Component
  • Simple Permission Utils

Sample

Base Component

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)
    }
}

MVVM

ViewModel

class AuthViewModel: BaseViewModel<AuthView>() {
	// your action
}

View

interface AuthView : BaseView {
	fun loadUserData()
}

Integration with KOIN

Create Koin Module Component first

val myModule : Module = applicationContext {
    viewModel { AuthViewModel(get()) }
    provide { AuthView() as Repository }
}

Starting KOIN Component

class MyApplication : Application(){
    override fun onCreate() {
        super.onCreate()
        startKoin(this, listOf(myModule))
    }
}

With JoyMVVM Omnibus

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!