diff options
author | ByteHamster <info@bytehamster.com> | 2019-04-12 11:39:38 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2019-04-12 11:39:38 +0200 |
commit | 09f4ebf08ad17435249d0daddfe290ae1d0484f4 (patch) | |
tree | d0e30545a4842e66c406eb1b14bb9c80f39c57bd /app | |
parent | 7d20baf4f920cbec901d2f7408b836cf91d8bc60 (diff) | |
download | AntennaPod-09f4ebf08ad17435249d0daddfe290ae1d0484f4.zip |
Let PlaybackController handle listening for service start
Diffstat (limited to 'app')
5 files changed, 0 insertions, 69 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index c31e6b11a..023a566d6 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -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; @@ -68,9 +67,6 @@ 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; /** @@ -288,7 +284,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements controller.init(); loadMediaInfo(); onPositionObserverUpdate(); - EventBus.getDefault().register(this); } @Override @@ -301,7 +296,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements if (disposable != null) { disposable.dispose(); } - EventBus.getDefault().unregister(this); super.onStop(); } @@ -669,16 +663,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements StorageUtils.checkStorageAvailability(this); } - @Subscribe(threadMode = ThreadMode.MAIN) - 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. diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java index b30540567..e91821e7d 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java @@ -7,13 +7,9 @@ import android.widget.ListView; 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 org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; public class ChaptersFragment extends ListFragment { @@ -58,24 +54,15 @@ public class ChaptersFragment extends ListFragment { }; controller.init(); onMediaChanged(controller.getMedia()); - EventBus.getDefault().register(this); } @Override public void onStop() { super.onStop(); - EventBus.getDefault().unregister(this); controller.release(); controller = null; } - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(ServiceEvent event) { - if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) { - controller.init(); - } - } - private void onMediaChanged(Playable media) { if (adapter != null) { adapter.setMedia(media); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index fb92b1e68..f409c15fb 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -13,13 +13,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 org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; /** * Displays the cover and the title of a FeedItem. @@ -85,20 +81,11 @@ public class CoverFragment extends Fragment { }; controller.init(); loadMediaInfo(); - EventBus.getDefault().register(this); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - 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; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 45c2232cd..eca54f90b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -18,7 +18,6 @@ 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.feed.MediaType; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.service.playback.PlaybackService; @@ -28,9 +27,6 @@ import io.reactivex.Maybe; 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; /** * Fragment which is supposed to be displayed outside of the MediaplayerActivity @@ -94,14 +90,6 @@ public class ExternalPlayerFragment extends Fragment { loadMediaInfo(); } - @Subscribe(threadMode = ThreadMode.MAIN) - 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) { @@ -147,7 +135,6 @@ public class ExternalPlayerFragment extends Fragment { public void onStart() { super.onStart(); controller.init(); - EventBus.getDefault().register(this); } @Override @@ -156,7 +143,6 @@ public class ExternalPlayerFragment extends Fragment { if (controller != null) { controller.release(); } - EventBus.getDefault().unregister(this); } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 85ee6fb64..daabb75e4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -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; @@ -40,9 +39,6 @@ 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 the description of a Playable object in a Webview. @@ -312,20 +308,11 @@ public class ItemDescriptionFragment extends Fragment { }; controller.init(); load(); - EventBus.getDefault().register(this); - } - - @Subscribe(threadMode = ThreadMode.MAIN) - 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; } |