1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-10-30 14:52:59 +00:00

Addressed comment in PR

This commit is contained in:
martin
2022-02-04 16:15:55 +01:00
parent 47798febed
commit 4049abf2c0
2 changed files with 28 additions and 53 deletions

View File

@@ -82,8 +82,6 @@ public class PlaybackParameterDialog extends DialogFragment {
@Nullable
private TextView tempoStepUpText;
@Nullable
private RelativeLayout pitchControl;
@Nullable
private SeekBar pitchSlider;
@Nullable
private TextView pitchCurrentText;
@@ -92,8 +90,6 @@ public class PlaybackParameterDialog extends DialogFragment {
@Nullable
private TextView pitchStepUpText;
@Nullable
private RelativeLayout semitoneControl;
@Nullable
private SeekBar semitoneSlider;
@Nullable
private TextView semitoneCurrentText;
@@ -102,8 +98,6 @@ public class PlaybackParameterDialog extends DialogFragment {
@Nullable
private TextView semitoneStepUpText;
@Nullable
private View separatorStepSizeSelector;
@Nullable
private CheckBox unhookingCheckbox;
@Nullable
private CheckBox skipSilenceCheckbox;
@@ -213,11 +207,13 @@ public class PlaybackParameterDialog extends DialogFragment {
}
private void togglePitchSliderType(@NonNull final View rootView) {
@Nullable
final RelativeLayout pitchControl = rootView.findViewById(R.id.pitchControl);
@Nullable
final RelativeLayout semitoneControl = rootView.findViewById(R.id.semitoneControl);
pitchControl = rootView.findViewById(R.id.pitchControl);
semitoneControl = rootView.findViewById(R.id.semitoneControl);
separatorStepSizeSelector = rootView.findViewById(R.id.separatorStepSizeSelector);
@Nullable
final View separatorStepSizeSelector = rootView.findViewById(R.id.separatorStepSizeSelector);
final RelativeLayout.LayoutParams params =
(RelativeLayout.LayoutParams) separatorStepSizeSelector.getLayoutParams();
if (pitchControl != null && semitoneControl != null && unhookingCheckbox != null) {
@@ -364,10 +360,14 @@ public class PlaybackParameterDialog extends DialogFragment {
setPlaybackParameters(
getCurrentTempo(),
getCurrentPitch(),
percentToSemitones(getCurrentPitch()),
Integer.min(12,
Integer.max(-12, percentToSemitones(getCurrentPitch())
)),
getCurrentSkipSilence()
);
setSemitoneSlider(percentToSemitones(getCurrentPitch()));
setSemitoneSlider(Integer.min(12,
Integer.max(-12, percentToSemitones(getCurrentPitch()))
));
} else {
setPlaybackParameters(
getCurrentTempo(),
@@ -546,7 +546,7 @@ public class PlaybackParameterDialog extends DialogFragment {
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress,
final boolean fromUser) {
// semitone slider supplies values 0 to 25, subtraction by 12 is required
// semitone slider supplies values 0 to 24, subtraction by 12 is required
final int currentSemitones = progress - 12;
if (fromUser) { // this change is first in chain
onSemitoneSliderUpdated(currentSemitones);
@@ -569,9 +569,6 @@ public class PlaybackParameterDialog extends DialogFragment {
}
private void onTempoSliderUpdated(final double newTempo) {
if (unhookingCheckbox == null) {
return;
}
if (!unhookingCheckbox.isChecked()) {
setSliders(newTempo);
} else {
@@ -580,9 +577,6 @@ public class PlaybackParameterDialog extends DialogFragment {
}
private void onPitchSliderUpdated(final double newPitch) {
if (unhookingCheckbox == null) {
return;
}
if (!unhookingCheckbox.isChecked()) {
setSliders(newPitch);
} else {
@@ -591,9 +585,6 @@ public class PlaybackParameterDialog extends DialogFragment {
}
private void onSemitoneSliderUpdated(final int newSemitone) {
if (unhookingCheckbox == null) {
return;
}
setSemitoneSlider(newSemitone);
}

View File

@@ -48,8 +48,7 @@
android:text="--%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="-5%" />
tools:ignore="HardcodedText"/>
<RelativeLayout
android:layout_width="match_parent"
@@ -73,8 +72,7 @@
android:gravity="center"
android:text="-.--x"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="1.00x" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/tempoCurrentText"
@@ -85,8 +83,7 @@
android:text="---%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="100%" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/tempoMaximumText"
@@ -99,8 +96,7 @@
android:gravity="center"
android:text="---%"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="300%" />
tools:ignore="HardcodedText"/>
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/tempoSeekbar"
@@ -128,8 +124,7 @@
android:text="+-%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="+5%" />
tools:ignore="HardcodedText"/>
</RelativeLayout>
<View
@@ -176,8 +171,7 @@
android:text="--%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="-5%" />
tools:ignore="HardcodedText"/>
<RelativeLayout
android:id="@+id/pitchDisplay"
@@ -202,8 +196,7 @@
android:gravity="center"
android:text="---%"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="25%" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/pitchCurrentText"
@@ -214,8 +207,7 @@
android:text="---%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="100%" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/pitchMaximumText"
@@ -228,8 +220,7 @@
android:gravity="center"
android:text="---%"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="300%" />
tools:ignore="HardcodedText"/>
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/pitchSeekbar"
@@ -257,8 +248,7 @@
android:text="+-%"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="+5%" />
tools:ignore="HardcodedText"/>
</RelativeLayout>
<RelativeLayout
@@ -284,8 +274,7 @@
android:textColor="?attr/colorAccent"
android:textSize="24sp"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="♭" />
tools:ignore="HardcodedText"/>
<RelativeLayout
android:id="@+id/semitoneDisplay"
@@ -310,8 +299,7 @@
android:gravity="center"
android:text="-12"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="-12" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/semitoneCurrentText"
@@ -319,11 +307,9 @@
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="--"
android:textColor="?attr/colorAccent"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="0" />
tools:ignore="HardcodedText"/>
<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/semitoneMaximumText"
@@ -336,8 +322,7 @@
android:gravity="center"
android:text="+12"
android:textColor="?attr/colorAccent"
tools:ignore="HardcodedText"
tools:text="+12" />
tools:ignore="HardcodedText"/>
<androidx.appcompat.widget.AppCompatSeekBar
android:id="@+id/semitoneSeekbar"
@@ -367,8 +352,7 @@
android:textColor="?attr/colorAccent"
android:textSize="20sp"
android:textStyle="bold"
tools:ignore="HardcodedText"
tools:text="♯" />
tools:ignore="HardcodedText"/>
</RelativeLayout>
<View