No longer need to listen to serviceEvent. PlaybackController does that automatically

This commit is contained in:
ByteHamster 2019-05-19 19:13:57 +02:00
parent ccbcdb6861
commit 55874607df
2 changed files with 0 additions and 24 deletions

View File

@ -11,7 +11,6 @@ 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;
@ -20,9 +19,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;
public class ChaptersFragment extends ListFragment {
private static final String TAG = "ChaptersFragment";
@ -65,7 +61,6 @@ public class ChaptersFragment extends ListFragment {
controller.init();
loadMediaInfo();
EventBus.getDefault().register(this);
}
@Override
@ -101,13 +96,6 @@ public class ChaptersFragment extends ListFragment {
return chapters.size() - 1;
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ServiceEvent event) {
if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) {
controller.init();
}
}
private void loadMediaInfo() {
if (disposable != null) {
disposable.dispose();

View File

@ -28,9 +28,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
@ -141,26 +138,17 @@ public class ExternalPlayerFragment extends Fragment {
controller = setupPlaybackController();
controller.init();
loadMediaInfo();
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
if (controller != null) {
controller.release();
controller = null;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(ServiceEvent event) {
if (event.action == ServiceEvent.Action.SERVICE_STARTED && controller != null) {
controller.init();
}
}
@Override
public void onDestroy() {
super.onDestroy();