This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: "IKEA BILRESA - Light Controller (v1.5)" | |
| description: > | |
| Light control for IKEA BILRESA (Matter). Supports dynamic scrolling, scene cycling, and multi-click actions for up to three channels. | |
| # Thank you so much for your feedback and suggestions! | |
| # The current version includes suggestions, improvements and fixes provided by: | |
| # - dhoerner-git | |
| # - red-advoto | |
| # - Mikcx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component( | |
| dependencies = [ | |
| FeatureComponent::class | |
| ] | |
| ) | |
| @Singleton | |
| interface AppComponent { | |
| @Component.Factory | |
| interface Factory { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel @Inject constructor( | |
| private val depFromDagger1: Dependency, | |
| private val depFromDagger2: Dependency2 | |
| ) : ViewModel() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel( | |
| private val dep1: Dependency, | |
| private val dep2: Dependency2 | |
| ) : ViewModel() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel @AssistedInject constructor( | |
| private val application: Application, | |
| @Assisted private val savedStateHandle: SavedStateHandle | |
| ){ | |
| // must be inside of the ViewModel class! | |
| @AssistedFactory | |
| interface Factory : AssistedSavedStateViewModelFactory<SomeViewModel> { | |
| override fun create(savedStateHandle: SavedStateHandle): SomeViewModel // may be ommited prior kotlin 1.3.60 or after PR #121 in AssistedInject lib | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel @AssistedInject constructor( | |
| private val application: Application, | |
| @Assisted private val savedStateHandle: SavedStateHandle | |
| ){ | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Base interface for all ViewModel factories | |
| */ | |
| interface AssistedSavedStateViewModelFactory<T : ViewModel> { | |
| fun create(savedStateHandle: SavedStateHandle): T | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel(/* ..ommited.. */){ | |
| val counter = savedStateHandle.getLiveData("counter", 0) | |
| fun onPlusClick() { | |
| counter.value = (counter.value ?: 0) + 1 | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel(/* ..ommited.. */){ | |
| val counter = MutableLiveData<Int>(0) | |
| init { | |
| counter.value = savedStateHandle.get("counter") ?: 0 | |
| counter.observeForever { newValue -> | |
| savedStateHandle.set("counter", newValue) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeViewModel( | |
| private val application: Application, | |
| private val savedStateHandle: SavedStateHandle | |
| ){ | |
| // ... | |
| } |
NewerOlder