Demo: Read long values from trim slider.
Before, slider values were read as `floor()`'ed `longValue()`s, so that trimming to intervals less than one second would be interpreted as a request for a zero- duration trim. Also, rename `radiusRange` references here to `trimRange`, since this is not a radius range. PiperOrigin-RevId: 480401556
This commit is contained in:
parent
b515e0bd7f
commit
fb5cd18dcd
@ -435,17 +435,17 @@ public final class ConfigurationActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
View dialogView = getLayoutInflater().inflate(R.layout.trim_options, /* root= */ null);
|
View dialogView = getLayoutInflater().inflate(R.layout.trim_options, /* root= */ null);
|
||||||
RangeSlider radiusRangeSlider =
|
RangeSlider trimRangeSlider =
|
||||||
checkNotNull(dialogView.findViewById(R.id.trim_bounds_range_slider));
|
checkNotNull(dialogView.findViewById(R.id.trim_bounds_range_slider));
|
||||||
radiusRangeSlider.setValues(0f, 60f); // seconds
|
trimRangeSlider.setValues(0f, 60f); // seconds
|
||||||
new AlertDialog.Builder(/* context= */ this)
|
new AlertDialog.Builder(/* context= */ this)
|
||||||
.setView(dialogView)
|
.setView(dialogView)
|
||||||
.setPositiveButton(
|
.setPositiveButton(
|
||||||
android.R.string.ok,
|
android.R.string.ok,
|
||||||
(DialogInterface dialogInterface, int i) -> {
|
(DialogInterface dialogInterface, int i) -> {
|
||||||
List<Float> radiusRange = radiusRangeSlider.getValues();
|
List<Float> trimRange = trimRangeSlider.getValues();
|
||||||
trimStartMs = 1000 * radiusRange.get(0).longValue();
|
trimStartMs = Math.round(1000 * trimRange.get(0));
|
||||||
trimEndMs = 1000 * radiusRange.get(1).longValue();
|
trimEndMs = Math.round(1000 * trimRange.get(1));
|
||||||
})
|
})
|
||||||
.create()
|
.create()
|
||||||
.show();
|
.show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user