diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
index 3ada3a6be..94fb412f7 100644
--- a/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
+++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlaybackParameterDialog.java
@@ -7,6 +7,8 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
+
+import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
@@ -219,13 +221,23 @@ public class PlaybackParameterDialog extends DialogFragment {
private void setupHookingControl(@NonNull View rootView) {
unhookingCheckbox = rootView.findViewById(R.id.unhookCheckbox);
if (unhookingCheckbox != null) {
- unhookingCheckbox.setChecked(pitch != tempo);
+ // restore whether pitch and tempo are unhooked or not
+ unhookingCheckbox.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext())
+ .getBoolean(getString(R.string.playback_unhook_key), true));
+
unhookingCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) -> {
- if (isChecked) return;
- // When unchecked, slide back to the minimum of current tempo or pitch
- final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
- setSliders(minimum);
- setCurrentPlaybackParameters();
+ // save whether pitch and tempo are unhooked or not
+ PreferenceManager.getDefaultSharedPreferences(getContext())
+ .edit()
+ .putBoolean(getString(R.string.playback_unhook_key), isChecked)
+ .apply();
+
+ if (!isChecked) {
+ // when unchecked, slide back to the minimum of current tempo or pitch
+ final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
+ setSliders(minimum);
+ setCurrentPlaybackParameters();
+ }
});
}
}
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index b5bf738fb..fe096c9fd 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -175,6 +175,7 @@
main_page_content
enable_playback_resume
enable_playback_state_lists
+ playback_unhook_key
app_language_key
enable_lock_screen_video_thumbnail
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 148a339a9..42b4b77c5 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -492,7 +492,7 @@
Playback Speed Controls
Tempo
Pitch
- Unlink (may cause distortion)
+ Unhook (may cause distortion)
Fast-forward during silence
Step
Reset