This file contains hidden or 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 hidden or 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
package com.example.daggerandroidmvvm.lobby; | |
import android.arch.lifecycle.ViewModelProviders; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; | |
import android.widget.ProgressBar; | |
import android.widget.TextView; | |
import android.widget.Toast; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
package com.jshvarts.notesnavigation.presentation.deletenote | |
import android.os.Bundle | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.Observer | |
import androidx.lifecycle.ViewModelProviders | |
import androidx.navigation.Navigation.findNavController |
This file contains hidden or 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
package com.jshvarts.notesnavigation.presentation.notedetail | |
import android.os.Bundle | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.Observer | |
import androidx.lifecycle.ViewModelProviders | |
import androidx.navigation.Navigation.findNavController |
NewerOlder