Skip to content

Commit c825e15

Browse files
committed
[TimePicker] Make the dial selector discrete
1 parent 4b26950 commit c825e15

File tree

4 files changed

+250
-144
lines changed

4 files changed

+250
-144
lines changed

lib/java/com/google/android/material/timepicker/ClockFaceView.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class ClockFaceView extends RadialViewGroup implements OnRotateListener {
9090

9191
private String[] values;
9292

93-
private float currentHandRotation;
93+
private float currentHandDegrees;
94+
private float currentHandLevel;
9495

9596
private final ColorStateList textColor;
9697

@@ -349,11 +350,14 @@ private RadialGradient getGradientForTextView(RectF selectorBox, TextView tv) {
349350
}
350351

351352
@Override
352-
public void onRotate(float rotation, boolean animating) {
353-
if (abs(currentHandRotation - rotation) > EPSILON) {
354-
currentHandRotation = rotation;
355-
findIntersectingTextView();
353+
public void onRotate(float degrees, int level, boolean animating) {
354+
if (currentHandDegrees == degrees && currentHandLevel == level) {
355+
return;
356356
}
357+
358+
currentHandDegrees = degrees;
359+
currentHandLevel = level;
360+
findIntersectingTextView();
357361
}
358362

359363
@Override

0 commit comments

Comments
 (0)