This file contains 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
/* | |
* 2021 Yuriy Timofeev <intelligence.worker@gmail.com>. | |
*/ | |
sealed class UiState<out T> where T : Any? { | |
object Loading : UiState<Nothing>() | |
data class Success<T>(val data: T) : UiState<T>() |
This file contains 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
/** | |
* Android keyboard state observer. | |
* For portrait orientation only. | |
* https://bit.ly/3flvZar | |
* 2020 intelligence.worker@gmail.com. | |
* | |
* Example of usage: | |
* viewLifecycleOwner.lifecycleScope.launch { | |
* this@MyFragment.view?.run { | |
* KeyboardObserver().observe(your_root_view_here).distinctUntilChanged().collect { ... } |