Search in sources :

Example 91 with Subscribe

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)));
}
Also used : Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) Spannable(android.text.Spannable) DownloadRequestCreator(de.danoeh.antennapod.core.service.download.DownloadRequestCreator) FeedListUpdateEvent(de.danoeh.antennapod.event.FeedListUpdateEvent) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) StringUtils(org.apache.commons.lang3.StringUtils) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) FeedItemlistDescriptionAdapter(de.danoeh.antennapod.adapter.FeedItemlistDescriptionAdapter) FeedPreferences(de.danoeh.antennapod.model.feed.FeedPreferences) UnsupportedFeedtypeException(de.danoeh.antennapod.parser.feed.UnsupportedFeedtypeException) Map(java.util.Map) HtmlToPlainText(de.danoeh.antennapod.core.util.syndication.HtmlToPlainText) View(android.view.View) UiThread(androidx.annotation.UiThread) Schedulers(io.reactivex.schedulers.Schedulers) AdapterView(android.widget.AdapterView) ForegroundColorSpan(android.text.style.ForegroundColorSpan) DownloadStatus(de.danoeh.antennapod.core.service.download.DownloadStatus) Log(android.util.Log) OnlinefeedviewActivityBinding(de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding) CombinedSearcher(de.danoeh.antennapod.discovery.CombinedSearcher) PlaybackService(de.danoeh.antennapod.core.service.playback.PlaybackService) NavUtils(androidx.core.app.NavUtils) IntentUtils(de.danoeh.antennapod.core.util.IntentUtils) DownloadError(de.danoeh.antennapod.core.util.DownloadError) FileNameGenerator(de.danoeh.antennapod.core.util.FileNameGenerator) FeedDiscoverer(de.danoeh.antennapod.core.util.syndication.FeedDiscoverer) ThreadMode(org.greenrobot.eventbus.ThreadMode) ViewGroup(android.view.ViewGroup) FeedHandlerResult(de.danoeh.antennapod.parser.feed.FeedHandlerResult) FeedUrlNotFoundException(de.danoeh.antennapod.core.feed.FeedUrlNotFoundException) Disposable(io.reactivex.disposables.Disposable) List(java.util.List) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) DownloadEvent(de.danoeh.antennapod.core.event.DownloadEvent) Snackbar(com.google.android.material.snackbar.Snackbar) Context(android.content.Context) AlertDialog(androidx.appcompat.app.AlertDialog) AuthenticationDialog(de.danoeh.antennapod.dialog.AuthenticationDialog) Maybe(io.reactivex.Maybe) Dialog(android.app.Dialog) Intent(android.content.Intent) ApGlideSettings(de.danoeh.antennapod.core.glide.ApGlideSettings) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) HttpDownloader(de.danoeh.antennapod.core.service.download.HttpDownloader) DownloadRequest(de.danoeh.antennapod.core.service.download.DownloadRequest) FastBlurTransformation(de.danoeh.antennapod.core.glide.FastBlurTransformation) Toast(android.widget.Toast) EventBus(org.greenrobot.eventbus.EventBus) StorageUtils(de.danoeh.antennapod.core.util.StorageUtils) Observable(io.reactivex.Observable) Feed(de.danoeh.antennapod.model.feed.Feed) DialogInterface(android.content.DialogInterface) Downloader(de.danoeh.antennapod.core.service.download.Downloader) RequestOptions(com.bumptech.glide.request.RequestOptions) SpannableString(android.text.SpannableString) R(de.danoeh.antennapod.R) PodcastSearcherRegistry(de.danoeh.antennapod.discovery.PodcastSearcherRegistry) TextUtils(android.text.TextUtils) IOException(java.io.IOException) LightingColorFilter(android.graphics.LightingColorFilter) File(java.io.File) ArrayAdapter(android.widget.ArrayAdapter) PodcastSearchResult(de.danoeh.antennapod.discovery.PodcastSearchResult) Glide(com.bumptech.glide.Glide) PlaybackPreferences(de.danoeh.antennapod.core.preferences.PlaybackPreferences) Subscribe(org.greenrobot.eventbus.Subscribe) SharedPreferences(android.content.SharedPreferences) DBWriter(de.danoeh.antennapod.core.storage.DBWriter) URLChecker(de.danoeh.antennapod.core.util.URLChecker) DisposableMaybeObserver(io.reactivex.observers.DisposableMaybeObserver) DBReader(de.danoeh.antennapod.core.storage.DBReader) RemoteMedia(de.danoeh.antennapod.model.playback.RemoteMedia) PlayerStatusEvent(de.danoeh.antennapod.event.PlayerStatusEvent) DownloadService(de.danoeh.antennapod.core.service.download.DownloadService) FeedHandler(de.danoeh.antennapod.parser.feed.FeedHandler) HttpDownloader(de.danoeh.antennapod.core.service.download.HttpDownloader) DownloadRequest(de.danoeh.antennapod.core.service.download.DownloadRequest) SpannableString(android.text.SpannableString) File(java.io.File) Feed(de.danoeh.antennapod.model.feed.Feed)

Example 92 with Subscribe

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)));
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) Bundle(android.os.Bundle) SleepTimerDialog(de.danoeh.antennapod.dialog.SleepTimerDialog) WindowManager(android.view.WindowManager) FrameLayout(android.widget.FrameLayout) BufferUpdateEvent(de.danoeh.antennapod.event.playback.BufferUpdateEvent) ColorDrawable(android.graphics.drawable.ColorDrawable) FeedItemUtil(de.danoeh.antennapod.core.util.FeedItemUtil) ShareDialog(de.danoeh.antennapod.dialog.ShareDialog) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) StringUtils(org.apache.commons.lang3.StringUtils) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) TimeSpeedConverter(de.danoeh.antennapod.core.util.TimeSpeedConverter) AnimationSet(android.view.animation.AnimationSet) Handler(android.os.Handler) Looper(android.os.Looper) PlaybackPositionEvent(de.danoeh.antennapod.event.playback.PlaybackPositionEvent) View(android.view.View) Schedulers(io.reactivex.schedulers.Schedulers) Animation(android.view.animation.Animation) PlaybackServiceEvent(de.danoeh.antennapod.event.playback.PlaybackServiceEvent) SurfaceHolder(android.view.SurfaceHolder) TargetApi(android.annotation.TargetApi) Log(android.util.Log) PlaybackService(de.danoeh.antennapod.core.service.playback.PlaybackService) IntentUtils(de.danoeh.antennapod.core.util.IntentUtils) ThreadMode(org.greenrobot.eventbus.ThreadMode) PlayerStatus(de.danoeh.antennapod.playback.base.PlayerStatus) Disposable(io.reactivex.disposables.Disposable) Nullable(androidx.annotation.Nullable) AlphaAnimation(android.view.animation.AlphaAnimation) SleepTimerUpdatedEvent(de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent) MainActivityStarter(de.danoeh.antennapod.ui.appstartintent.MainActivityStarter) Converter(de.danoeh.antennapod.core.util.Converter) PlaybackController(de.danoeh.antennapod.core.util.playback.PlaybackController) PlayerErrorEvent(de.danoeh.antennapod.event.PlayerErrorEvent) KeyEvent(android.view.KeyEvent) AlertDialog(androidx.appcompat.app.AlertDialog) Pair(android.util.Pair) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) Intent(android.content.Intent) PixelFormat(android.graphics.PixelFormat) AudioManager(android.media.AudioManager) MenuItem(android.view.MenuItem) AnimationUtils(android.view.animation.AnimationUtils) SeekBar(android.widget.SeekBar) SuppressLint(android.annotation.SuppressLint) MenuInflater(android.view.MenuInflater) MotionEvent(android.view.MotionEvent) ShareUtils(de.danoeh.antennapod.core.util.ShareUtils) EventBus(org.greenrobot.eventbus.EventBus) Menu(android.view.Menu) StorageUtils(de.danoeh.antennapod.core.util.StorageUtils) SkipPreferenceDialog(de.danoeh.antennapod.dialog.SkipPreferenceDialog) Observable(io.reactivex.Observable) Build(android.os.Build) FeedMedia(de.danoeh.antennapod.model.feed.FeedMedia) PlaybackControlsDialog(de.danoeh.antennapod.dialog.PlaybackControlsDialog) LayoutInflater(android.view.LayoutInflater) R(de.danoeh.antennapod.R) FeedItem(de.danoeh.antennapod.model.feed.FeedItem) Playable(de.danoeh.antennapod.model.playback.Playable) CastEnabledActivity(de.danoeh.antennapod.playback.cast.CastEnabledActivity) PictureInPictureUtil(de.danoeh.antennapod.core.util.gui.PictureInPictureUtil) VideoplayerActivityBinding(de.danoeh.antennapod.databinding.VideoplayerActivityBinding) WindowCompat(androidx.core.view.WindowCompat) Gravity(android.view.Gravity) Glide(com.bumptech.glide.Glide) Subscribe(org.greenrobot.eventbus.Subscribe) DBWriter(de.danoeh.antennapod.core.storage.DBWriter) DBReader(de.danoeh.antennapod.core.storage.DBReader) EditText(android.widget.EditText) FeedItem(de.danoeh.antennapod.model.feed.FeedItem)

Example 93 with Subscribe

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));
        }
    }
}
Also used : SimpleReview(me.zhanghai.android.douya.network.api.info.frodo.SimpleReview) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 94 with Subscribe

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()));
        }
    }
}
Also used : Moment(com.rideread.rideread.data.result.Moment) LatLng(com.amap.api.maps.model.LatLng) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 95 with Subscribe

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);
    }
}
Also used : Album(com.culturer.yoo_home.bean.Album) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

Subscribe (org.greenrobot.eventbus.Subscribe)164 Intent (android.content.Intent)20 Bundle (android.os.Bundle)11 EventBus (org.greenrobot.eventbus.EventBus)10 ThreadMode (org.greenrobot.eventbus.ThreadMode)10 View (android.view.View)9 Poi (io.jawg.osmcontributor.model.entities.Poi)9 PoiType (io.jawg.osmcontributor.model.entities.PoiType)9 ArrayList (java.util.ArrayList)9 Context (android.content.Context)8 Handler (android.os.Handler)8 ViewGroup (android.view.ViewGroup)8 FeedItem (de.danoeh.antennapod.model.feed.FeedItem)8 SuppressLint (android.annotation.SuppressLint)6 LayoutInflater (android.view.LayoutInflater)6 MenuItem (android.view.MenuItem)6 DownloaderUpdate (de.danoeh.antennapod.core.event.DownloaderUpdate)6 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)6 Disposable (io.reactivex.disposables.Disposable)6 Schedulers (io.reactivex.schedulers.Schedulers)6