Merge "Enforce min value on panel slices slider" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cef4e42dc2
@@ -164,11 +164,12 @@ public class SliceBroadcastReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
final SliderPreferenceController sliderController = (SliderPreferenceController) controller;
|
||||
final int maxSteps = sliderController.getMaxSteps();
|
||||
if (newPosition < 0 || newPosition > maxSteps) {
|
||||
final int minValue = sliderController.getMin();
|
||||
final int maxValue = sliderController.getMax();
|
||||
if (newPosition < minValue || newPosition > maxValue) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid position passed to Slider controller. Expected between 0 and "
|
||||
+ maxSteps + " but found " + newPosition);
|
||||
"Invalid position passed to Slider controller. Expected between " + minValue
|
||||
+ " and " + maxValue + " but found " + newPosition);
|
||||
}
|
||||
|
||||
sliderController.setSliderPosition(newPosition);
|
||||
|
@@ -326,7 +326,8 @@ public class SliceBuilderUtils {
|
||||
.setTitle(sliceData.getTitle())
|
||||
.setSubtitle(subtitleText)
|
||||
.setPrimaryAction(primaryAction)
|
||||
.setMax(sliderController.getMaxSteps())
|
||||
.setMax(sliderController.getMax())
|
||||
.setMin(sliderController.getMin())
|
||||
.setValue(sliderController.getSliderPosition())
|
||||
.setInputAction(actionIntent))
|
||||
.setKeywords(keywords)
|
||||
|
Reference in New Issue
Block a user