commit
0b6930517a
|
@ -144,7 +144,7 @@ dependencies {
|
|||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
||||
implementation "com.squareup.okio:okio:$okioVersion"
|
||||
implementation "de.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "org.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import de.danoeh.antennapod.core.feed.FeedItem;
|
|||
import de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager;
|
||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -27,9 +27,9 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
|
|||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.fragment.ExternalPlayerFragment;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import de.test.antennapod.util.service.download.HTTPBin;
|
||||
import de.test.antennapod.util.syndication.feedgenerator.RSS2Generator;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* Utility methods for UI tests.
|
||||
|
|
|
@ -43,7 +43,6 @@ import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
|||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import de.danoeh.antennapod.core.event.ProgressEvent;
|
||||
import de.danoeh.antennapod.core.event.QueueEvent;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
|
||||
|
@ -68,11 +67,13 @@ import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
|||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
import de.danoeh.antennapod.fragment.SubscriptionFragment;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* The activity that is shown when the user launches the app.
|
||||
|
@ -765,6 +766,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(QueueEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
// we are only interested in the number of queue items, not download status or position
|
||||
|
@ -776,6 +778,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
loadData();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(ProgressEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
switch(event.action) {
|
||||
|
@ -794,6 +797,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(MessageEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
View parentLayout = findViewById(R.id.drawer_layout);
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.joanzapata.iconify.fonts.FontAwesomeIcons;
|
|||
import java.util.Locale;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
|
@ -661,15 +660,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
StorageUtils.checkStorageAvailability(this);
|
||||
}
|
||||
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED) {
|
||||
if (controller != null) {
|
||||
controller.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by 'handleStatus()' when the PlaybackService is waiting for
|
||||
* a video surface.
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.content.SharedPreferences;
|
|||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.AppBarLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -34,7 +33,6 @@ import com.viewpagerindicator.CirclePageIndicator;
|
|||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.ChaptersListAdapter;
|
||||
import de.danoeh.antennapod.adapter.NavListAdapter;
|
||||
import de.danoeh.antennapod.core.asynctask.FeedRemover;
|
||||
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||
|
@ -62,11 +60,13 @@ import de.danoeh.antennapod.fragment.PlaybackHistoryFragment;
|
|||
import de.danoeh.antennapod.fragment.QueueFragment;
|
||||
import de.danoeh.antennapod.fragment.SubscriptionFragment;
|
||||
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Activity for playing files that do not require a video surface.
|
||||
|
@ -107,12 +107,6 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
|
||||
private Disposable disposable;
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -127,6 +121,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
disposable.dispose();
|
||||
}
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
saveCurrentFragment();
|
||||
}
|
||||
|
||||
|
@ -176,10 +171,9 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
AutoUpdateManager.checkShouldRefreshFeeds(getApplicationContext());
|
||||
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().register(this);
|
||||
loadData();
|
||||
|
@ -443,6 +437,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
|
|||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(MessageEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
View parentLayout = findViewById(R.id.drawer_layout);
|
||||
|
|
|
@ -31,6 +31,9 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
|
@ -68,7 +71,6 @@ import de.danoeh.antennapod.core.util.URLChecker;
|
|||
import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
|
||||
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
|
||||
import de.danoeh.antennapod.dialog.AuthenticationDialog;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -123,6 +125,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
}
|
||||
};
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(DownloadEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
setSubscribeButtonState(feed);
|
||||
|
@ -193,24 +196,19 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
isPaused = false;
|
||||
EventDistributor.getInstance().register(listener);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
isPaused = true;
|
||||
EventDistributor.getInstance().unregister(listener);
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (downloader != null && !downloader.isFinished()) {
|
||||
downloader.cancel();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||
import de.danoeh.antennapod.core.preferences.SleepTimerPreferences;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
public abstract class SleepTimerDialog {
|
||||
|
||||
|
|
|
@ -51,12 +51,15 @@ import de.danoeh.antennapod.core.util.FeedItemUtil;
|
|||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Shows unread or recently published episodes
|
||||
|
@ -107,12 +110,12 @@ public class AllEpisodesFragment extends Fragment {
|
|||
if (viewsCreated && itemsLoaded) {
|
||||
onFragmentLoaded();
|
||||
}
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
loadItems();
|
||||
registerForContextMenu(recyclerView);
|
||||
}
|
||||
|
@ -120,7 +123,6 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().unregister(this);
|
||||
saveScrollPosition();
|
||||
unregisterForContextMenu(recyclerView);
|
||||
}
|
||||
|
@ -128,6 +130,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
|
@ -430,6 +433,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
|
||||
};
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(FeedItemEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
if (episodes == null) {
|
||||
|
@ -456,6 +460,7 @@ public class AllEpisodesFragment extends Fragment {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(DownloadEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
|
|
@ -11,11 +11,10 @@ import java.util.ListIterator;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.ChaptersListAdapter;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.feed.Chapter;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -60,8 +59,8 @@ public class ChaptersFragment extends ListFragment {
|
|||
}
|
||||
};
|
||||
controller.init();
|
||||
|
||||
loadMediaInfo();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +75,6 @@ public class ChaptersFragment extends ListFragment {
|
|||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
controller.release();
|
||||
controller = null;
|
||||
}
|
||||
|
@ -98,12 +96,6 @@ public class ChaptersFragment extends ListFragment {
|
|||
return chapters.size() - 1;
|
||||
}
|
||||
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) {
|
||||
controller.init();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadMediaInfo() {
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
|
|
|
@ -14,11 +14,9 @@ import com.bumptech.glide.Glide;
|
|||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -99,19 +97,11 @@ public class CoverFragment extends Fragment {
|
|||
};
|
||||
controller.init();
|
||||
loadMediaInfo();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) {
|
||||
controller.init();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
controller.release();
|
||||
controller = null;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
|||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Maybe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -92,13 +91,6 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
loadMediaInfo();
|
||||
}
|
||||
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
Log.d(TAG, "onEvent(" + event + ")");
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED) {
|
||||
controller.init();
|
||||
}
|
||||
}
|
||||
|
||||
private PlaybackController setupPlaybackController() {
|
||||
return new PlaybackController(getActivity(), true) {
|
||||
|
||||
|
@ -146,7 +138,6 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
controller = setupPlaybackController();
|
||||
controller.init();
|
||||
loadMediaInfo();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +147,6 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
controller.release();
|
||||
controller = null;
|
||||
}
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,8 @@ import de.danoeh.antennapod.core.event.FavoritesEvent;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,6 +39,7 @@ public class FavoriteEpisodesFragment extends AllEpisodesFragment {
|
|||
@Override
|
||||
protected String getPrefName() { return PREF_NAME; }
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(FavoritesEvent event) {
|
||||
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
||||
loadItems();
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.widget.Toast;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MediaplayerInfoActivity;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
|
@ -36,7 +35,6 @@ import de.danoeh.antennapod.core.util.NetworkUtils;
|
|||
import de.danoeh.antennapod.core.util.ShareUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.core.util.playback.Timeline;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
@ -310,19 +308,11 @@ public class ItemDescriptionFragment extends Fragment {
|
|||
};
|
||||
controller.init();
|
||||
load();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) {
|
||||
controller.init();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
controller.release();
|
||||
controller = null;
|
||||
}
|
||||
|
|
|
@ -68,11 +68,13 @@ import de.danoeh.antennapod.core.util.playback.Timeline;
|
|||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.view.OnSwipeGesture;
|
||||
import de.danoeh.antennapod.view.SwipeGestureDetector;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Displays information about a FeedItem and actions.
|
||||
|
@ -265,11 +267,16 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
if(itemsLoaded) {
|
||||
progbarLoading.setVisibility(View.GONE);
|
||||
updateAppearance();
|
||||
|
@ -277,8 +284,8 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
@ -537,6 +544,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
((MainActivity)getActivity()).loadChildFragment(fragment);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(FeedItemEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
for(FeedItem item : event.items) {
|
||||
|
@ -547,6 +555,7 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(DownloadEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
|
|
@ -68,11 +68,13 @@ import de.danoeh.antennapod.dialog.RenameFeedDialog;
|
|||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.FeedMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Displays a list of FeedItems.
|
||||
|
@ -143,6 +145,8 @@ public class ItemlistFragment extends ListFragment {
|
|||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().register(this);
|
||||
if (viewsCreated && itemsLoaded) {
|
||||
onFragmentLoaded();
|
||||
}
|
||||
|
@ -151,16 +155,14 @@ public class ItemlistFragment extends ListFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
((MainActivity)getActivity()).getSupportActionBar().setTitle("");
|
||||
updateProgressBarVisibility();
|
||||
loadItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
EventBus.getDefault().unregister(this);
|
||||
if(disposable != null) {
|
||||
|
@ -359,6 +361,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
activity.getSupportActionBar().setTitle(feed.getTitle());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(FeedEvent event) {
|
||||
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
||||
if(event.feedId == feedID) {
|
||||
|
@ -366,6 +369,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(FeedItemEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
if(feed == null || feed.getItems() == null || adapter == null) {
|
||||
|
@ -380,6 +384,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(DownloadEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
|
|
@ -31,11 +31,13 @@ import de.danoeh.antennapod.core.storage.DBWriter;
|
|||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class PlaybackHistoryFragment extends ListFragment {
|
||||
|
||||
|
@ -91,29 +93,18 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
loadItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().unregister(this);
|
||||
EventBus.getDefault().register(this);
|
||||
loadItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
EventDistributor.getInstance().unregister(contentUpdate);
|
||||
if(disposable != null) {
|
||||
disposable.dispose();
|
||||
|
@ -135,6 +126,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
viewsCreated = false;
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true)
|
||||
public void onEvent(DownloadEvent event) {
|
||||
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
@ -193,6 +185,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(FeedItemEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
if(playbackHistory == null) {
|
||||
|
|
|
@ -52,12 +52,15 @@ import de.danoeh.antennapod.core.util.LongList;
|
|||
import de.danoeh.antennapod.core.util.QueueSorter;
|
||||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
import de.danoeh.antennapod.menuhandler.MenuItemUtils;
|
||||
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Shows all items in the queue
|
||||
|
@ -105,7 +108,7 @@ public class QueueFragment extends Fragment {
|
|||
}
|
||||
loadItems(true);
|
||||
EventDistributor.getInstance().register(contentUpdate);
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,6 +127,7 @@ public class QueueFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(QueueEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
if (queue == null) {
|
||||
|
@ -162,6 +166,7 @@ public class QueueFragment extends Fragment {
|
|||
onFragmentLoaded(false);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(FeedItemEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
if (queue == null) {
|
||||
|
@ -182,6 +187,7 @@ public class QueueFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(DownloadEvent event) {
|
||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
|
|
@ -21,7 +21,8 @@ import de.danoeh.antennapod.core.storage.DBReader;
|
|||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
/**
|
||||
* Displays all running downloads and provides actions to cancel them
|
||||
|
@ -54,14 +55,14 @@ public class RunningDownloadsFragment extends ListFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
@ -72,6 +73,7 @@ public class RunningDownloadsFragment extends ListFragment {
|
|||
adapter = null;
|
||||
}
|
||||
|
||||
@Subscribe(sticky = true)
|
||||
public void onEvent(DownloadEvent event) {
|
||||
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
||||
DownloaderUpdate update = event.update;
|
||||
|
|
|
@ -49,7 +49,7 @@ project.ext {
|
|||
commonsioVersion = "2.5"
|
||||
commonslangVersion = "3.6"
|
||||
commonstextVersion = "1.3"
|
||||
eventbusVersion = "2.4.0"
|
||||
eventbusVersion = "3.1.1"
|
||||
flattr4jVersion = "2.14"
|
||||
glideVersion = "4.8.0"
|
||||
glideOkhttpIntegrationVersion = "4.8.0"
|
||||
|
|
|
@ -58,7 +58,7 @@ dependencies {
|
|||
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
|
||||
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
|
||||
implementation "com.squareup.okio:okio:$okioVersion"
|
||||
implementation "de.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "org.greenrobot:eventbus:$eventbusVersion"
|
||||
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
|
||||
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
|
||||
implementation "org.awaitility:awaitility:$awaitilityVersion"
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.util.Pair;
|
|||
import android.webkit.URLUtil;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -71,7 +72,6 @@ import de.danoeh.antennapod.core.util.ChapterUtils;
|
|||
import de.danoeh.antennapod.core.util.DownloadError;
|
||||
import de.danoeh.antennapod.core.util.InvalidFeedException;
|
||||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* Manages the download of feedfiles in the app. Downloads can be enqueued via the startService intent.
|
||||
|
|
|
@ -71,7 +71,7 @@ import de.danoeh.antennapod.core.util.QueueAccess;
|
|||
import de.danoeh.antennapod.core.util.gui.NotificationUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.ExternalMedia;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* Controls the MediaPlayer that plays a FeedMedia-file
|
||||
|
|
|
@ -19,7 +19,8 @@ import de.danoeh.antennapod.core.feed.FeedItem;
|
|||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
@ -78,6 +79,7 @@ public class PlaybackServiceTaskManager {
|
|||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(QueueEvent event) {
|
||||
Log.d(TAG, "onEvent(QueueEvent " + event +")");
|
||||
cancelQueueLoader();
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.shredzone.flattr4j.model.Flattr;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -48,7 +49,6 @@ import de.danoeh.antennapod.core.util.Permutor;
|
|||
import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
|
||||
import de.danoeh.antennapod.core.util.flattr.FlattrThing;
|
||||
import de.danoeh.antennapod.core.util.flattr.SimpleFlattrThing;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* Provides methods for writing data to AntennaPod's database.
|
||||
|
|
|
@ -39,7 +39,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences;
|
|||
import de.danoeh.antennapod.core.service.download.DownloadStatus;
|
||||
import de.danoeh.antennapod.core.util.LongIntMap;
|
||||
import de.danoeh.antennapod.core.util.flattr.FlattrStatus;
|
||||
import de.greenrobot.event.EventBus;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
// TODO Remove media column from feeditem table
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.event.ServiceEvent;
|
||||
import de.danoeh.antennapod.core.feed.Chapter;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
|
@ -44,6 +45,9 @@ import io.reactivex.Observable;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
/**
|
||||
* Communicates with the playback service. GUI classes should use this class to
|
||||
|
@ -70,6 +74,7 @@ public abstract class PlaybackController {
|
|||
private boolean mediaInfoLoaded = false;
|
||||
private boolean released = false;
|
||||
private boolean initialized = false;
|
||||
private boolean eventsRegistered = false;
|
||||
|
||||
private Disposable serviceBinder;
|
||||
private Disposable mediaLoader;
|
||||
|
@ -96,7 +101,11 @@ public abstract class PlaybackController {
|
|||
/**
|
||||
* Creates a new connection to the playbackService.
|
||||
*/
|
||||
public void init() {
|
||||
public synchronized void init() {
|
||||
if (!eventsRegistered) {
|
||||
EventBus.getDefault().register(this);
|
||||
eventsRegistered = true;
|
||||
}
|
||||
if (PlaybackService.isRunning) {
|
||||
initServiceRunning();
|
||||
} else {
|
||||
|
@ -104,6 +113,13 @@ public abstract class PlaybackController {
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(ServiceEvent event) {
|
||||
if (event.action == ServiceEvent.Action.SERVICE_STARTED) {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void initServiceRunning() {
|
||||
if (initialized) {
|
||||
return;
|
||||
|
@ -165,6 +181,10 @@ public abstract class PlaybackController {
|
|||
media = null;
|
||||
released = true;
|
||||
|
||||
if (eventsRegistered) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
eventsRegistered = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue