Skip to content

Instantly share code, notes, and snippets.

@kokeroulis
kokeroulis / ButterknifeConductor.kt
Created May 23, 2017 17:21 — forked from EricKuck/ButterknifeConductor.kt
Kotterknife(ish) view binding for Conductor controllers
// Largely borrowed from Jake Wharton's Kotterknife (https://github.com/JakeWharton/kotterknife)
// and paweljaneczek's PR for resetting cached views (https://github.com/JakeWharton/kotterknife/pull/37)
package com.bluelinelabs.conductor.butterknife
import android.view.View
import com.bluelinelabs.conductor.Controller
import java.util.Collections
import java.util.WeakHashMap
import kotlin.properties.ReadOnlyProperty
@kokeroulis
kokeroulis / gist:0ada054573e3e2350820
Created March 1, 2016 13:58 — forked from alexwen/gist:4b337bc669509a696b5b
OkHttp Observable Callback
public Observable<FilesWrapper> download(List<Thing> things) {
return Observable.from(things)
.flatMap(thing -> {
File file = new File(getExternalCacheDir() + File.separator + thing.getName());
if (file.exists()) {
return Observable.just(file);
}
Request request = new Request.Builder().url(thing.getUrl()).build();