Skip to content

Instantly share code, notes, and snippets.

@fluxtah
Created January 20, 2020 15:24
Show Gist options
  • Save fluxtah/839903da939eecb621ece4c10405f857 to your computer and use it in GitHub Desktop.
Save fluxtah/839903da939eecb621ece4c10405f857 to your computer and use it in GitHub Desktop.
companion object {
fun getNumbersEnglish(): LiveData<List<String>> {
return object : LiveData<List<String>>() {
override fun onActive() {
GlobalScope.launch(Dispatchers.IO) {
delay(500)
postValue(listOf("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"))
}
}
}
}
fun getNumbersJapanese(): LiveData<List<String>> {
return object : LiveData<List<String>>() {
override fun onActive() {
GlobalScope.launch(Dispatchers.IO) {
delay(500)
postValue(listOf("ひとつ", "ふたつ", "みっつ", "よっつ", "いつつ", "むっつ", "ななつ", "やっつ"))
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment