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
| // Enable inline classes | |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { | |
| kotlinOptions.freeCompilerArgs += ["-XXLanguage:+InlineClasses"] | |
| } |
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
| import android.arch.lifecycle.LiveData | |
| import android.arch.lifecycle.MutableLiveData | |
| import android.arch.paging.PageKeyedDataSource | |
| import android.arch.paging.PagedList | |
| import kotlinx.coroutines.experimental.Dispatchers | |
| import kotlinx.coroutines.experimental.GlobalScope | |
| import kotlinx.coroutines.experimental.android.Main | |
| import kotlinx.coroutines.experimental.launch | |
| import us.kostenko.architecturecomponentstmdb.details.model.Movie | |
| import us.kostenko.architecturecomponentstmdb.details.repository.persistance.MovieDao |
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
| inline fun <VM : ViewModel> viewModelFactory(crossinline f: () -> VM) = | |
| object : ViewModelProvider.Factory { | |
| @Suppress("UNCHECKED_CAST") | |
| override fun <T : ViewModel> create(aClass: Class<T>):T = f() as T | |
| } | |
| // Usage | |
| private val viewModel by lazy { | |
| val factory = viewModelFactory { component.myViewModel() } | |
| ViewModelProviders.of(this, factory) |
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 us.kostenko.architecturecomponentstmdb.details.viewmodel.netres | |
| import retrofit2.Response | |
| import timber.log.Timber | |
| import java.util.regex.Pattern | |
| /** | |
| * Common class used by API responses. | |
| * @param <T> the type of the response object | |
| </T> */ |
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.android.example.github.util | |
| import android.arch.lifecycle.LiveData | |
| import com.android.example.github.api.ApiResponse | |
| import retrofit2.Call | |
| import retrofit2.CallAdapter | |
| import retrofit2.Callback | |
| import retrofit2.Response | |
| import java.lang.reflect.Type | |
| import java.util.concurrent.atomic.AtomicBoolean |
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
| /** | |
| * Lives in debug build variant | |
| */ | |
| object MyTimberImplementation: TimberLog { | |
| override fun init() { | |
| Timber.plant(object: Timber.DebugTree() { | |
| override fun createStackElementTag(element: StackTraceElement): String? { | |
| return String.format("(%s:%s)", | |
| super.createStackElementTag(element), |
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
| @Dao | |
| public abstract class ProductDao { | |
| @Insert | |
| public abstract void insert(Product product); | |
| @Delete | |
| public abstract void delete(Product product); | |
| @Transaction | |
| public void insertAndDeleteInTransaction(Product newProduct, Product oldProduct) { |
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
| Unit Testing of Cloud Functions | |
| https://firebase.google.com/docs/functions/unit-testing | |
| Using Firebase Test Lab to Improve the Quality of your Mobile Apps | |
| https://codelabs.developers.google.com/codelabs/firebase-test-lab/index.html?index=..%2F..%2Findex#0 | |
| Recognize text in images with ML Kit for Firebase | |
| https://codelabs.developers.google.com/codelabs/mlkit-android/index.html?index=..%2F..%2Findex#0 |
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
| import android.location.Location | |
| import kotlinx.coroutines.experimental.CoroutineScope | |
| import kotlinx.coroutines.experimental.Dispatchers | |
| import kotlinx.coroutines.experimental.Job | |
| import kotlinx.coroutines.experimental.android.Main | |
| import kotlinx.coroutines.experimental.channels.Channel | |
| import kotlinx.coroutines.experimental.channels.ReceiveChannel | |
| import kotlinx.coroutines.experimental.channels.SendChannel | |
| import kotlinx.coroutines.experimental.coroutineScope | |
| import kotlinx.coroutines.experimental.launch |
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 ru.kometa.app.ticket.choose.view | |
| import android.content.Context | |
| import android.os.Bundle | |
| import android.support.v4.view.ViewCompat | |
| import android.support.v7.widget.LinearLayoutManager | |
| import android.view.LayoutInflater | |
| import android.view.View | |
| import android.view.ViewGroup | |
| import io.reactivex.disposables.CompositeDisposable |