use of de.danoeh.antennapod.dialog.VariableSpeedDialog in project AntennaPod by AntennaPod.
the class AudioPlayerFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View root = inflater.inflate(R.layout.audioplayer_fragment, container, false);
// Avoid clicks going through player to fragments below
root.setOnTouchListener((v, event) -> true);
toolbar = root.findViewById(R.id.toolbar);
toolbar.setTitle("");
toolbar.setNavigationOnClickListener(v -> ((MainActivity) getActivity()).getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED));
toolbar.setOnMenuItemClickListener(this);
ExternalPlayerFragment externalPlayerFragment = new ExternalPlayerFragment();
getChildFragmentManager().beginTransaction().replace(R.id.playerFragment, externalPlayerFragment, ExternalPlayerFragment.TAG).commit();
butPlaybackSpeed = root.findViewById(R.id.butPlaybackSpeed);
txtvPlaybackSpeed = root.findViewById(R.id.txtvPlaybackSpeed);
sbPosition = root.findViewById(R.id.sbPosition);
txtvPosition = root.findViewById(R.id.txtvPosition);
txtvLength = root.findViewById(R.id.txtvLength);
butRev = root.findViewById(R.id.butRev);
txtvRev = root.findViewById(R.id.txtvRev);
butPlay = root.findViewById(R.id.butPlay);
butFF = root.findViewById(R.id.butFF);
txtvFF = root.findViewById(R.id.txtvFF);
butSkip = root.findViewById(R.id.butSkip);
progressIndicator = root.findViewById(R.id.progLoading);
cardViewSeek = root.findViewById(R.id.cardViewSeek);
txtvSeek = root.findViewById(R.id.txtvSeek);
setupLengthTextView();
setupControlButtons();
butPlaybackSpeed.setOnClickListener(v -> new VariableSpeedDialog().show(getChildFragmentManager(), null));
sbPosition.setOnSeekBarChangeListener(this);
pager = root.findViewById(R.id.pager);
pager.setAdapter(new AudioPlayerPagerAdapter(this));
// Required for getChildAt(int) in ViewPagerBottomSheetBehavior to return the correct page
pager.setOffscreenPageLimit((int) NUM_CONTENT_FRAGMENTS);
pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
pager.post(() -> {
if (getActivity() != null) {
// By the time this is posted, the activity might be closed again.
((MainActivity) getActivity()).getBottomSheet().updateScrollingChild();
}
});
}
});
return root;
}
use of de.danoeh.antennapod.dialog.VariableSpeedDialog 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();
}
Aggregations