use of de.danoeh.antennapod.databinding.PlaybackSpeedFeedSettingDialogBinding in project AntennaPod by AntennaPod.
the class FeedMultiSelectActionHandler method playbackSpeedPrefHandler.
private void playbackSpeedPrefHandler() {
PlaybackSpeedFeedSettingDialogBinding viewBinding = PlaybackSpeedFeedSettingDialogBinding.inflate(activity.getLayoutInflater());
viewBinding.seekBar.setProgressChangedListener(speed -> viewBinding.currentSpeedLabel.setText(String.format(Locale.getDefault(), "%.2fx", speed)));
viewBinding.useGlobalCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
viewBinding.seekBar.setEnabled(!isChecked);
viewBinding.seekBar.setAlpha(isChecked ? 0.4f : 1f);
viewBinding.currentSpeedLabel.setAlpha(isChecked ? 0.4f : 1f);
});
viewBinding.seekBar.updateSpeed(1.0f);
new AlertDialog.Builder(activity).setTitle(R.string.playback_speed).setView(viewBinding.getRoot()).setPositiveButton(android.R.string.ok, (dialog, which) -> {
float newSpeed = viewBinding.useGlobalCheckbox.isChecked() ? FeedPreferences.SPEED_USE_GLOBAL : viewBinding.seekBar.getCurrentSpeed();
saveFeedPreferences(feedPreferences -> feedPreferences.setFeedPlaybackSpeed(newSpeed));
}).setNegativeButton(R.string.cancel_label, null).show();
}
Aggregations