use of de.danoeh.antennapod.event.UnreadItemsUpdateEvent in project AntennaPod by AntennaPod.
the class PlaybackPreferencesFragment method setupPlaybackScreen.
private void setupPlaybackScreen() {
final Activity activity = getActivity();
findPreference(PREF_PLAYBACK_SPEED_LAUNCHER).setOnPreferenceClickListener(preference -> {
new VariableSpeedDialog().show(getChildFragmentManager(), null);
return true;
});
findPreference(PREF_PLAYBACK_REWIND_DELTA_LAUNCHER).setOnPreferenceClickListener(preference -> {
SkipPreferenceDialog.showSkipPreference(activity, SkipPreferenceDialog.SkipDirection.SKIP_REWIND, null);
return true;
});
findPreference(PREF_PLAYBACK_FAST_FORWARD_DELTA_LAUNCHER).setOnPreferenceClickListener(preference -> {
SkipPreferenceDialog.showSkipPreference(activity, SkipPreferenceDialog.SkipDirection.SKIP_FORWARD, null);
return true;
});
if (!PictureInPictureUtil.supportsPictureInPicture(activity)) {
ListPreference behaviour = findPreference(UserPreferences.PREF_VIDEO_BEHAVIOR);
behaviour.setEntries(R.array.video_background_behavior_options_without_pip);
behaviour.setEntryValues(R.array.video_background_behavior_values_without_pip);
}
findPreference(PREF_PLAYBACK_PREFER_STREAMING).setOnPreferenceChangeListener((preference, newValue) -> {
// Update all visible lists to reflect new streaming action button
EventBus.getDefault().post(new UnreadItemsUpdateEvent());
UsageStatistics.askAgainLater(UsageStatistics.ACTION_STREAM);
return true;
});
buildEnqueueLocationPreference();
}
use of de.danoeh.antennapod.event.UnreadItemsUpdateEvent in project AntennaPod by AntennaPod.
the class UserInterfacePreferencesFragment method setupInterfaceScreen.
private void setupInterfaceScreen() {
findPreference(UserPreferences.PREF_THEME).setOnPreferenceChangeListener((preference, newValue) -> {
ActivityCompat.recreate(getActivity());
return true;
});
findPreference(UserPreferences.PREF_SHOW_TIME_LEFT).setOnPreferenceChangeListener((preference, newValue) -> {
UserPreferences.setShowRemainTimeSetting((Boolean) newValue);
EventBus.getDefault().post(new UnreadItemsUpdateEvent());
EventBus.getDefault().post(new PlayerStatusEvent());
return true;
});
findPreference(UserPreferences.PREF_HIDDEN_DRAWER_ITEMS).setOnPreferenceClickListener(preference -> {
showDrawerPreferencesDialog();
return true;
});
findPreference(UserPreferences.PREF_COMPACT_NOTIFICATION_BUTTONS).setOnPreferenceClickListener(preference -> {
showNotificationButtonsDialog();
return true;
});
findPreference(UserPreferences.PREF_BACK_BUTTON_BEHAVIOR).setOnPreferenceChangeListener((preference, newValue) -> {
if (!newValue.equals("page")) {
return true;
}
final Context context = getActivity();
final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages);
final String[] navTags = context.getResources().getStringArray(R.array.back_button_go_to_pages_tags);
final String[] choice = { UserPreferences.getBackButtonGoToPage() };
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.back_button_go_to_page_title);
builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags, UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> {
if (i >= 0) {
choice[0] = navTags[i];
}
});
builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> UserPreferences.setBackButtonGoToPage(choice[0]));
builder.setNegativeButton(R.string.cancel_label, null);
builder.create().show();
return true;
});
findPreference(UserPreferences.PREF_FILTER_FEED).setOnPreferenceClickListener((preference -> {
SubscriptionsFilterDialog.showDialog(requireContext());
return true;
}));
findPreference(UserPreferences.PREF_DRAWER_FEED_ORDER).setOnPreferenceClickListener((preference -> {
FeedSortDialog.showDialog(requireContext());
return true;
}));
findPreference(PREF_SWIPE).setOnPreferenceClickListener(preference -> {
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_swipe);
return true;
});
if (Build.VERSION.SDK_INT >= 26) {
findPreference(UserPreferences.PREF_EXPANDED_NOTIFICATION).setVisible(false);
}
}
Aggregations