Use a 1 Mbps key increment for bitrate

This commit is contained in:
Cameron Gutman 2020-09-04 15:14:30 -07:00
parent 32171bb70c
commit 6391f2c43d
2 changed files with 9 additions and 0 deletions

View File

@ -32,6 +32,7 @@ public class SeekBarPreference extends DialogPreference
private final int maxValue;
private final int minValue;
private final int stepSize;
private final int keyStepSize;
private final int divisor;
private int currentValue;
@ -63,6 +64,7 @@ public class SeekBarPreference extends DialogPreference
minValue = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "min", 1);
stepSize = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "step", 1);
divisor = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "divisor", 1);
keyStepSize = attrs.getAttributeIntValue(SEEKBAR_SCHEMA_URL, "keyStep", 0);
}
@Override
@ -130,6 +132,9 @@ public class SeekBarPreference extends DialogPreference
}
seekBar.setMax(maxValue);
if (keyStepSize != 0) {
seekBar.setKeyProgressIncrement(keyStepSize);
}
seekBar.setProgress(currentValue);
return layout;
@ -139,6 +144,9 @@ public class SeekBarPreference extends DialogPreference
protected void onBindDialogView(View v) {
super.onBindDialogView(v);
seekBar.setMax(maxValue);
if (keyStepSize != 0) {
seekBar.setKeyProgressIncrement(keyStepSize);
}
seekBar.setProgress(currentValue);
}

View File

@ -24,6 +24,7 @@
seekbar:min="500"
seekbar:step="500"
android:max="100000"
seekbar:keyStep="1000"
seekbar:divisor="1000"
android:summary="@string/summary_seekbar_bitrate"
android:text="@string/suffix_seekbar_bitrate_mbps"