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 io.reactivex.BackpressureStrategy | |
import io.reactivex.schedulers.Schedulers | |
import io.reactivex.subjects.PublishSubject | |
import io.reactivex.subjects.Subject | |
import java.util.concurrent.TimeUnit | |
fun main(args: Array<String>) { | |
val subject = PublishSubject.create<Int>().toSerialized() | |
val producer = Producer(subject) | |
val consumer = Consumer(subject) |
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
@Singleton | |
public class ViewModelFactory implements ViewModelProvider.Factory { | |
private final Map<Class<? extends ViewModel>, Provider<ViewModel>> creators; | |
@Inject | |
public ViewModelFactory(Map<Class<? extends ViewModel>, Provider<ViewModel>> creators) { | |
this.creators = creators; | |
} |
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 com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.module.SimpleModule; | |
import org.threeten.bp.LocalDateTime; | |
import javax.inject.Singleton; | |
import dagger.Module; | |
import dagger.Provides; | |
import okhttp3.OkHttpClient; |
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 java.io.* | |
class FileDownloader( | |
val onProgressUpdate: ((fileSize: Long, downloadedSize: Long) -> Unit)?, | |
val onDownloadComplete: () -> Unit) { | |
var bufferSize = 1024 * 8 | |
var singleReadSize = 1024 * 4 | |
var progressNotificationDelay = 1000 |
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.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.ColorFilter; | |
import android.graphics.Paint; | |
import android.graphics.PixelFormat; | |
import android.graphics.Rect; | |
import android.graphics.drawable.Drawable; | |
import android.support.annotation.ColorInt; | |
import android.support.annotation.IntRange; | |
import android.support.annotation.NonNull; |