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 JobsListAdapter : ListAdapter<JobListItem, JobViewHolder>() { | |
override fun getItemViewType(position: Int): Int { | |
return getItem(position).ordinal() | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): JobViewHolder { | |
return when (viewType) { | |
Header.ordinal() -> HeaderViewHolder(...) | |
JobItem.ordinal() -> JobViewHolder(...) |
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
/** | |
* ListAdapter is a superclass of RecyclerView.Adapter. | |
* Check the d.android.com for more. | |
*/ | |
class JobsAdapter : ListAdapter<JobListItem, JobViewHolder>() { | |
} | |
// items of 2 types | |
sealed class JobListItem { |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val subject = BehaviorSubject.create(Unit) | |
val connectable = subject | |
.observeOn(io()) | |
.replay().refCount() |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val connectable = just(Unit) | |
.replay().refCount() | |
connectable | |
.subscribeOn(newThread()) |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val connectable = just(Unit) | |
.replay().refCount() | |
connectable | |
.subscribeOn(computation()) |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val subject = BehaviorSubject.create(Unit) | |
Observable | |
.combineLatest( | |
subject.subscribeOn(io()), |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
Observable | |
.combineLatest( | |
just(Unit).observeOn(io()), | |
just(Unit).observeOn(computation()) | |
) { _, _ -> |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val subject = BehaviorSubject.create(Unit) | |
Observable | |
.merge( | |
just(Unit), |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
Observable | |
.merge( | |
just(Unit).subscribeOn(Schedulers.computation()), | |
just(Unit).subscribeOn(Schedulers.io()) | |
) |
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
fun printCurrentThread(tag: String) = println("$tag: ${Thread.currentThread().name.substringBefore("-")}") | |
fun main(args: Array<String>) { | |
printCurrentThread("main thread name") | |
val subject = BehaviorSubject.create(Unit) | |
subject | |
.subscribeOn(Schedulers.computation()) | |
.subscribe { |
NewerOlder