@@ -71,7 +71,6 @@ public class PlaybackParameterDialog extends DialogFragment {
7171 private double tempo = DEFAULT_TEMPO ;
7272 private double pitch = DEFAULT_PITCH ;
7373 private int semitones = DEFAULT_SEMITONES ;
74- private double stepSize = DEFAULT_STEP ;
7574
7675 @ Nullable
7776 private SeekBar tempoSlider ;
@@ -147,7 +146,6 @@ public void onCreate(@Nullable final Bundle savedInstanceState) {
147146 tempo = savedInstanceState .getDouble (TEMPO_KEY , DEFAULT_TEMPO );
148147 pitch = savedInstanceState .getDouble (PITCH_KEY , DEFAULT_PITCH );
149148 semitones = percentToSemitones (pitch );
150- stepSize = savedInstanceState .getDouble (STEP_SIZE_KEY , DEFAULT_STEP );
151149 }
152150 }
153151
@@ -159,7 +157,6 @@ public void onSaveInstanceState(final Bundle outState) {
159157
160158 outState .putDouble (TEMPO_KEY , getCurrentTempo ());
161159 outState .putDouble (PITCH_KEY , getCurrentPitch ());
162- outState .putDouble (STEP_SIZE_KEY , getCurrentStepSize ());
163160 }
164161
165162 /*//////////////////////////////////////////////////////////////////////////
@@ -203,7 +200,7 @@ private void setupControlViews(@NonNull final View rootView) {
203200
204201 togglePitchSliderType (rootView );
205202
206- setStepSize ( stepSize );
203+ setupStepSizeSelector ( rootView );
207204 }
208205
209206 private void togglePitchSliderType (@ NonNull final View rootView ) {
@@ -380,6 +377,10 @@ private void setupAdjustBySemitonesControl(@NonNull final View rootView) {
380377 }
381378
382379 private void setupStepSizeSelector (@ NonNull final View rootView ) {
380+ setStepSize (PreferenceManager
381+ .getDefaultSharedPreferences (requireContext ())
382+ .getFloat (getString (R .string .adjustment_step_key ), (float ) DEFAULT_STEP ));
383+
383384 final TextView stepSizeOnePercentText = rootView .findViewById (R .id .stepSizeOnePercent );
384385 final TextView stepSizeFivePercentText = rootView .findViewById (R .id .stepSizeFivePercent );
385386 final TextView stepSizeTenPercentText = rootView .findViewById (R .id .stepSizeTenPercent );
@@ -438,7 +439,10 @@ private void setupCombinedStepSizeSelector(@NonNull final View rootView) {
438439 }
439440
440441 private void setStepSize (final double stepSize ) {
441- this .stepSize = stepSize ;
442+ PreferenceManager .getDefaultSharedPreferences (requireContext ())
443+ .edit ()
444+ .putFloat (getString (R .string .adjustment_step_key ), (float ) stepSize )
445+ .apply ();
442446
443447 if (tempoStepUpText != null ) {
444448 tempoStepUpText .setText (getStepUpPercentString (stepSize ));
@@ -665,10 +669,6 @@ private int getCurrentSemitones() {
665669 return semitoneSlider == null ? semitones : semitoneSlider .getProgress () - 12 ;
666670 }
667671
668- private double getCurrentStepSize () {
669- return stepSize ;
670- }
671-
672672 private boolean getCurrentSkipSilence () {
673673 return skipSilenceCheckbox != null && skipSilenceCheckbox .isChecked ();
674674 }
0 commit comments