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.os.Bundle; | |
import com.squareup.moshi.JsonAdapter; | |
import com.squareup.moshi.Moshi; | |
import java.io.IOException; | |
/** | |
* Removes some of the boilerplate associated with Properties in android fragments by handling | |
* the serialization and deserialization of wrapped objects into and out of argument | |
* {@link Bundle}s. | |
* |
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
class PicassoImageObservable( | |
private val picasso: Picasso | |
) : Func1<String, Observable<Bitmap>> { | |
override fun call(url: String): Observable<Bitmap> { | |
return Observable.fromAsync({ emitter -> | |
val target = object : Target { | |
override fun onPrepareLoad(placeHolderDrawable: Drawable?) { | |
//do nothing | |
} |
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
extension SequenceType where Self.Generator.Element : Equatable { | |
typealias Diff = (added: [Self.Generator.Element], removed: [Self.Generator.Element]) | |
func diff(changed:[Self.Generator.Element]) -> Diff { | |
let added:[Self.Generator.Element] = changed.reduce([]) { | |
!self.contains($1) ? $0 + [$1] : $0 | |
} | |
let removed:[Self.Generator.Element] = self.reduce([]) { |
NewerOlder