Implement OnError
This commit is contained in:
parent
5138858e58
commit
89b3df200d
|
@ -904,21 +904,25 @@ public abstract class MediaplayerActivity extends AppCompatActivity implements O
|
||||||
|
|
||||||
private void checkFavorite() {
|
private void checkFavorite() {
|
||||||
Playable playable = controller.getMedia();
|
Playable playable = controller.getMedia();
|
||||||
if (playable != null && playable instanceof FeedMedia) {
|
if (playable != null && playable instanceof FeedMedia) {
|
||||||
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
FeedItem feedItem = ((FeedMedia) playable).getItem();
|
||||||
if (feedItem != null) {
|
if (feedItem != null) {
|
||||||
Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId()))
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(item -> {
|
.subscribe(
|
||||||
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
item -> {
|
||||||
if(isFavorite != isFav) {
|
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
|
||||||
isFavorite = isFav;
|
if (isFavorite != isFav) {
|
||||||
invalidateOptionsMenu();
|
isFavorite = isFav;
|
||||||
}
|
invalidateOptionsMenu();
|
||||||
});
|
}
|
||||||
}
|
}, error -> {
|
||||||
|
Log.e(TAG, Log.getStackTraceString(error));
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue