Move EventBus register/unregister to appropriate class

This commit is contained in:
Martin Fietz 2016-11-01 22:07:30 +01:00
parent 365afedaad
commit 6accc116e4
2 changed files with 8 additions and 3 deletions

View File

@ -47,7 +47,6 @@ import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.dialog.SleepTimerDialog;
import de.danoeh.antennapod.dialog.VariableSpeedDialog;
import de.greenrobot.event.EventBus;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
@ -218,7 +217,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
controller.pause();
}
super.onPause();
EventBus.getDefault().unregister(this);
}
/**
@ -582,7 +580,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
if(controller != null) {
controller.init();
}
EventBus.getDefault().register(this);
}
/**

View File

@ -61,6 +61,7 @@ import de.danoeh.antennapod.fragment.QueueFragment;
import de.danoeh.antennapod.fragment.SubscriptionFragment;
import de.danoeh.antennapod.menuhandler.NavDrawerActivity;
import de.danoeh.antennapod.preferences.PreferenceController;
import de.greenrobot.event.EventBus;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
@ -105,6 +106,12 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
private Subscription subscription;
@Override
protected void onPause() {
super.onPause();
EventBus.getDefault().unregister(this);
}
@Override
protected void onStop() {
super.onStop();
@ -175,6 +182,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
DBTasks.checkShouldRefreshFeeds(getApplicationContext());
EventDistributor.getInstance().register(contentUpdate);
EventBus.getDefault().register(this);
loadData();
}