use of com.simplecity.amp_library.ui.screens.equalizer.EqualizerFragment in project Shuttle by timusus.
the class MainController method onResume.
@Override
public void onResume() {
super.onResume();
if (delayHandler != null) {
delayHandler.removeCallbacksAndMessages(null);
}
delayHandler = new Handler();
disposables.add(navigationEventRelay.getEvents().observeOn(AndroidSchedulers.mainThread()).filter(NavigationEventRelay.NavigationEvent::isActionable).subscribe(navigationEvent -> {
switch(navigationEvent.type) {
case NavigationEventRelay.NavigationEvent.Type.LIBRARY_SELECTED:
popToRootViewController();
break;
case NavigationEventRelay.NavigationEvent.Type.FOLDERS_SELECTED:
delayHandler.postDelayed(() -> pushViewController(FolderFragment.newInstance(getString(R.string.folders_title), false), "FolderFragment"), 250);
break;
case NavigationEventRelay.NavigationEvent.Type.SLEEP_TIMER_SELECTED:
UnsafeAction showToast = () -> Toast.makeText(getContext(), R.string.sleep_timer_started, Toast.LENGTH_SHORT).show();
SleepTimer.getInstance().getDialog(getContext(), () -> SleepTimer.getInstance().showMinutesDialog(getContext(), showToast), showToast).show();
break;
case NavigationEventRelay.NavigationEvent.Type.EQUALIZER_SELECTED:
delayHandler.postDelayed(() -> multiSheetEventRelay.sendEvent(new MultiSheetEventRelay.MultiSheetEvent(MultiSheetEventRelay.MultiSheetEvent.Action.HIDE, MultiSheetView.Sheet.FIRST)), 100);
delayHandler.postDelayed(() -> pushViewController(EqualizerFragment.newInstance(), "EqualizerFragment"), 250);
break;
case NavigationEventRelay.NavigationEvent.Type.SETTINGS_SELECTED:
delayHandler.postDelayed(() -> multiSheetEventRelay.sendEvent(new MultiSheetEventRelay.MultiSheetEvent(MultiSheetEventRelay.MultiSheetEvent.Action.HIDE, MultiSheetView.Sheet.FIRST)), 100);
delayHandler.postDelayed(() -> pushViewController(SettingsParentFragment.newInstance(R.xml.settings_headers, R.string.settings), "Settings Fragment"), 250);
break;
case NavigationEventRelay.NavigationEvent.Type.SUPPORT_SELECTED:
delayHandler.postDelayed(() -> multiSheetEventRelay.sendEvent(new MultiSheetEventRelay.MultiSheetEvent(MultiSheetEventRelay.MultiSheetEvent.Action.HIDE, MultiSheetView.Sheet.FIRST)), 100);
delayHandler.postDelayed(() -> pushViewController(SettingsParentFragment.newInstance(R.xml.settings_support, R.string.pref_title_support), "Support Fragment"), 250);
break;
case NavigationEventRelay.NavigationEvent.Type.PLAYLIST_SELECTED:
delayHandler.postDelayed(() -> pushViewController(PlaylistDetailFragment.Companion.newInstance((Playlist) navigationEvent.data), "PlaylistDetailFragment"), 250);
break;
case NavigationEventRelay.NavigationEvent.Type.GO_TO_ARTIST:
multiSheetView.goToSheet(MultiSheetView.Sheet.NONE);
AlbumArtist albumArtist = (AlbumArtist) navigationEvent.data;
delayHandler.postDelayed(() -> {
popToRootViewController();
pushViewController(ArtistDetailFragment.Companion.newInstance(albumArtist, null), "ArtistDetailFragment");
}, 250);
break;
case NavigationEventRelay.NavigationEvent.Type.GO_TO_ALBUM:
multiSheetView.goToSheet(MultiSheetView.Sheet.NONE);
Album album = (Album) navigationEvent.data;
delayHandler.postDelayed(() -> {
popToRootViewController();
pushViewController(AlbumDetailFragment.Companion.newInstance(album, null), "AlbumDetailFragment");
}, 250);
break;
case NavigationEventRelay.NavigationEvent.Type.GO_TO_GENRE:
multiSheetView.goToSheet(MultiSheetView.Sheet.NONE);
Genre genre = (Genre) navigationEvent.data;
delayHandler.postDelayed(() -> {
popToRootViewController();
pushViewController(GenreDetailFragment.Companion.newInstance(genre), "GenreDetailFragment");
}, 250);
break;
}
}));
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(InternalIntents.SERVICE_CONNECTED);
intentFilter.addAction(InternalIntents.QUEUE_CHANGED);
disposables.add(RxBroadcast.fromBroadcast(getContext(), intentFilter).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(intent -> {
toggleBottomSheetVisibility(true, true);
}));
DrawerLockManager.getInstance().setDrawerLockController(this);
}
Aggregations