[go: nahoru, domu]

Skip to content

Commit

Permalink
Demo: Read long values from trim slider.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dway123 authored and marcbaechinger committed Oct 20, 2022
1 parent 225d0dc commit 6c59f9e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,17 @@ private void selectTrimBounds(View view, boolean isChecked) {
return;
}
View dialogView = getLayoutInflater().inflate(R.layout.trim_options, /* root= */ null);
RangeSlider radiusRangeSlider =
RangeSlider trimRangeSlider =
checkNotNull(dialogView.findViewById(R.id.trim_bounds_range_slider));
radiusRangeSlider.setValues(0f, 60f); // seconds
trimRangeSlider.setValues(0f, 60f); // seconds
new AlertDialog.Builder(/* context= */ this)
.setView(dialogView)
.setPositiveButton(
android.R.string.ok,
(DialogInterface dialogInterface, int i) -> {
List<Float> radiusRange = radiusRangeSlider.getValues();
trimStartMs = 1000 * radiusRange.get(0).longValue();
trimEndMs = 1000 * radiusRange.get(1).longValue();
List<Float> trimRange = trimRangeSlider.getValues();
trimStartMs = Math.round(1000 * trimRange.get(0));
trimEndMs = Math.round(1000 * trimRange.get(1));
})
.create()
.show();
Expand Down

0 comments on commit 6c59f9e

Please sign in to comment.