Never heard about modular architecture? click here
For each new features please create its own component
@NewFeatureScope
@Component(
dependencies = [CoreComponent::class],
modules = [NewFeatureModule::class]
)
interface NewFeatureComponent {
fun environment(): NewFeatureEnvironment
}
Its own environment
data class NewFeatureEnvironment @Inject constructor(
// Add properties needed. Ex: api, analytics, scheduler, etc.
)
And its own module
@Module
class NewFeatureModule {
@Provides
@NewFeatureScope
fun provideNewFeatureEnvironment(): NewFeatureEnvironment {
return NewFeatureEnvironment()
}
}
MVVM facilitates a separation of development of the graphical user interface from development of the business logic or back-end logic (the data model). The view model of MVVM is a value converter, meaning the view model is responsible for exposing (converting) the data objects from the model in such a way that objects are easily managed and presented. In this respect, the view model is more model than view, and handles most if not all of the view's display logic. The view model may implement a mediator pattern, organizing access to the back-end logic around the set of use cases supported by the view.
For each new ViewModel
's please follow this implementation:
class NewFeatureViewModel(
environment: NewFeatureEnvironment
): ActivityViewModel() {
class Factory(
private val _environment: NewFeatureEnvironment
) : ViewModelProvider.Factory {
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return NewFeatureViewModel(_environment) as T
}
}
}
To bind the ViewModel
to the activity:
private val viewModelFactory by lazy {
NewFeatureViewModel.Factory(component.environment(), scopeProvider)
}
private val viewModel by lazy {
ViewModelProviders.of(this, viewModelFactory).get(NewFeatureViewModel::class.java)
}
Test a unique class
./gradlew :${MODULE}:testReleaseUnitTest --tests ${CLASS REFERENCE} --info
Test all
./gradlew :${MODULE}:testReleaseUnitTest
Lint
./gradlew :${MODULE}:lintRelease
$ git branch -b [developer-initial]/[issue-tag-number]_[issue-name]
$ git commit -am "[... your message ...]"
All commit message line will be cropped at 100 characters
Please follow the template PULL_REQUEST_TEMPLATE when you create a new pull request.
Android fragmentation analytics --> Platform Versions
- Min API 21 --> Lolipop : 5.0.x
- Max API 28 --> Oreo : 8.1.x
- To see the Android docs --> Click here
- To see the Kotlin docs --> Click here
- Modular Architecture:
- https://medium.com/mindorks/writing-a-modular-project-on-android-304f3b09cb37,
- https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e
- https://medium.com/mindorks/dynamic-feature-modules-the-future-4bee124c0f1
- https://www.youtube.com/watch?v=PZBg5DIzNww
- https://github.com/android/plaid
- Reactive Functional MVVM:
- Server-Driven Rendering: