use of org.greenrobot.eventbus.Subscribe in project AntennaPod by AntennaPod.
the class OnlineFeedViewActivity method startFeedDownload.
private void startFeedDownload(String url) {
Log.d(TAG, "Starting feed download");
url = URLChecker.prepareURL(url);
feed = new Feed(url, null);
String fileUrl = new File(getExternalCacheDir(), FileNameGenerator.generateFileName(feed.getDownload_url())).toString();
feed.setFile_url(fileUrl);
final DownloadRequest request = new DownloadRequest(feed.getFile_url(), feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password, true, null, true);
download = Observable.fromCallable(() -> {
feeds = DBReader.getFeedList();
downloader = new HttpDownloader(request);
downloader.call();
return downloader.getResult();
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::checkDownloadResult, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
use of org.greenrobot.eventbus.Subscribe in project AntennaPod by AntennaPod.
the class VideoplayerActivity method checkFavorite.
private void checkFavorite() {
FeedItem feedItem = getFeedItem(controller.getMedia());
if (feedItem == null) {
return;
}
if (disposable != null) {
disposable.dispose();
}
disposable = Observable.fromCallable(() -> DBReader.getFeedItem(feedItem.getId())).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(item -> {
boolean isFav = item.isTagged(FeedItem.TAG_FAVORITE);
if (isFavorite != isFav) {
isFavorite = isFav;
invalidateOptionsMenu();
}
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
use of org.greenrobot.eventbus.Subscribe in project Douya by DreaminginCodeZH.
the class BaseReviewListResource method onReviewUpdated.
@Subscribe(threadMode = ThreadMode.POSTING)
public void onReviewUpdated(ReviewUpdatedEvent event) {
if (event.isFromMyself(this) || isEmpty()) {
return;
}
List<SimpleReview> reviewList = get();
for (int i = 0, size = reviewList.size(); i < size; ++i) {
SimpleReview review = reviewList.get(i);
if (review.id == event.review.id) {
reviewList.set(i, event.review);
getListener().onReviewChanged(getRequestCode(), i, reviewList.get(i));
}
}
}
use of org.greenrobot.eventbus.Subscribe in project ride-read-android by Ride-Read.
the class ProfileFragment method onRefreshMyMap.
@Subscribe(threadMode = MAIN, sticky = true)
public void onRefreshMyMap(RefreshMyMapEvent event) {
EventBus.getDefault().removeStickyEvent(RefreshMyMapEvent.class);
List<Moment> moments = event.mMoments;
if (!ListUtils.isEmpty(moments)) {
mAMap.clear();
for (Moment momentItem : moments) {
addSignInMarker(new LatLng(momentItem.getLatitude(), momentItem.getLongitude()));
}
}
}
use of org.greenrobot.eventbus.Subscribe in project yoo_home_Android by culturer.
the class HomeAlbumFragment method updateAlbum.
@Subscribe
public void updateAlbum(Album_Event event) {
Album album = event.getAlbum();
int album_type = event.getAlbum_type();
if (album_type == this.fragment_type) {
if (album_type == ALBUM_TYPE_USER) {
CacheData.userAlbums.add(album);
this.homeAlbumItems = CacheData.userAlbums;
} else if (album_type == ALBUM_TYPE_HOME) {
CacheData.familyAlbums.add(album);
this.homeAlbumItems = CacheData.familyAlbums;
}
adapter.setDataAndUpdate(homeAlbumItems);
}
}
Aggregations