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,
scopeProvider: AndroidLifecycleScopeProvider
): ActivityViewModel() {
class Factory(
private val environment: NewFeatureEnvironment,
private val scopeProvider: AndroidLifecycleScopeProvider
) : ViewModelProvider.Factory {
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return NewFeatureViewModel(environment, scopeProvider) 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 :app:testReleaseUnitTest --tests ${CLASS REFERENCE} --info
Test all
./gradlew :app:testReleaseUnitTest
Lint
./gradlew :app:lintRelease
master
--> Latest code running on productiondevelop
--> Stable development code before QA
$ 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 19 --> Kitkat : 4.4.x
- Max API 28 --> Oreo : 8.1.x
- To see the Android docs --> Click here
- To see the Kotlin docs --> Click here
- Modular Architecture:
- Reactive Functional MVVM:
- Server-Driven Rendering: