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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<com.google.android.material.chip.ChipGroup | |
android:id="@+id/chipGroup" | |
android:layout_width="match_parent" |
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
// RecyclerView Adapter implemented as ListAdapter and DiffCallback | |
class Mydapter( | |
private val clickListener: (String) -> Unit | |
) : | |
ListAdapter<MyUiModel, MyViewHolder>(MyDiffCallback()) { | |
override fun onCreateViewHolder( | |
parent: ViewGroup, | |
position: Int |
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
// Deps | |
interface Database | |
interface Network | |
// Child | |
interface ChildRepository | |
class Child(dependencies: Dependencies) { |
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
// In ViewModel: | |
private val error = ConflatedBroadcastChannel<ErrorType>() | |
fun errorEffect(): Flow<ErrorType> = error.asFlow() | |
val errorType = if (connectionHelper.isConnected()) { | |
ErrorType.GENERIC | |
} else { | |
ErrorType.CONNECTION |
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 logCoroutine(message: String) = "[${Thread.currentThread().name}] $message" | |
// call with | |
Timber.d(logCoroutine("Initial coroutine launched")) |
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 logCoroutine(message: String, coroutineContext: CoroutineContext) { | |
println("coroutine is executing on thread : ${Thread.currentThread().name} : $message : $coroutineContext") | |
} |
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 logCoroutine(message: String) { | |
println("coroutineå is executing on thread : ${Thread.currentThread().name}: $message") | |
} |
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
Observable.just("long", "longer", "longest") | |
.subscribeOn(Schedulers.io()) | |
.map(String::length) | |
.observeOn(Schedulers.computation()) | |
.filter { it > 6 } | |
.subscribe { length -> println("item length $length") } | |
} |
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
Observable.just("long", "longer", "longest") | |
.map(String::length) | |
.filter { it > 6 } | |
.subscribe { length -> println("item length $length") } |
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 plugin: 'androidx.navigation.safeargs.kotlin' |
NewerOlder