Last active
May 11, 2018 03:28
-
-
Save jungilhan/bd31288ad708f2819cd4252fbb58a541 to your computer and use it in GitHub Desktop.
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 MainActivity : AppCompatActivity() { | |
private val numbersObservable: BehaviorSubject<List<Int>> | |
= BehaviorSubject.createDefault(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
swipeRefreshLayout.setOnRefreshListener { | |
numbersObservable.onNext(listOf(1, 2, 4, 5, 6, 7, 8, 9)) // pass a new list without 0, 3 | |
} | |
numbersObservable.subscribe { | |
adapter.submitList(it) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment