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
class DebounceLiveData<Source>( | |
private val source: LiveData<Source>, | |
private val debounceMs: Long | |
) : LiveData<Source>(), CoroutineScope { | |
private val job = SupervisorJob() | |
override val coroutineContext: CoroutineContext | |
get() = Dispatchers.Main + job | |
private var debounceJob: Job? = null | |
private val observer = Observer<Source> { source -> |
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
class ChatRoomsFragment : Fragment() { | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
viewModel = ViewModelProviders.of(this, factory).get(ChatRoomsViewModel::class.java) | |
subscribeUi() | |
} | |
private fun subscribeUi() { |
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
apply from: 'versionCode.gradle' | |
android { | |
defaultConfig { | |
versionName VERSION_NAME | |
versionCode Integer.parseInt(VERSION_CODE) | |
} | |
} |
OlderNewer