Created
August 10, 2016 13:20
-
-
Save kangsLee/c4714099e555c0a7588de9e4a4f9c51e to your computer and use it in GitHub Desktop.
This file contains 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
public class RxPicasso { | |
@NotNull | |
public static Observable<Void> load(RequestCreator requestCreator, ImageView imageView) { | |
return Observable.create(subscriber -> { | |
requestCreator.into(imageView, new Callback() { | |
@Override | |
public void onSuccess() { | |
if (!subscriber.isUnsubscribed()) { | |
subscriber.onNext(null); | |
} | |
} | |
@Override | |
public void onError() { | |
if (!subscriber.isUnsubscribed()) { | |
subscriber.onError(new Throwable("이미지 로딩 실패")); | |
} | |
} | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment