Merge "Fix auto-advance regression in radial time picker" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7781647aa9
@@ -1246,37 +1246,40 @@ public class RadialTimePickerView extends View implements View.OnTouchListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int[] selectionDegrees = mSelectionDegrees;
|
final int[] selectionDegrees = mSelectionDegrees;
|
||||||
int type = -1;
|
final int type;
|
||||||
int newValue = -1;
|
final int newValue;
|
||||||
|
final boolean valueChanged;
|
||||||
|
|
||||||
if (mShowHours) {
|
if (mShowHours) {
|
||||||
final int snapDegrees = snapOnly30s(degrees, 0) % 360;
|
final int snapDegrees = snapOnly30s(degrees, 0) % 360;
|
||||||
if (forceSelection
|
valueChanged = selectionDegrees[HOURS] != snapDegrees
|
||||||
|| selectionDegrees[HOURS] != snapDegrees
|
|
||||||
|| selectionDegrees[HOURS_INNER] != snapDegrees
|
|| selectionDegrees[HOURS_INNER] != snapDegrees
|
||||||
|| wasOnInnerCircle != mIsOnInnerCircle) {
|
|| wasOnInnerCircle != mIsOnInnerCircle;
|
||||||
|
|
||||||
selectionDegrees[HOURS] = snapDegrees;
|
selectionDegrees[HOURS] = snapDegrees;
|
||||||
selectionDegrees[HOURS_INNER] = snapDegrees;
|
selectionDegrees[HOURS_INNER] = snapDegrees;
|
||||||
|
|
||||||
type = HOURS;
|
type = HOURS;
|
||||||
newValue = getCurrentHour();
|
newValue = getCurrentHour();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
final int snapDegrees = snapPrefer30s(degrees) % 360;
|
final int snapDegrees = snapPrefer30s(degrees) % 360;
|
||||||
if (forceSelection || selectionDegrees[MINUTES] != snapDegrees) {
|
valueChanged = selectionDegrees[MINUTES] != snapDegrees;
|
||||||
selectionDegrees[MINUTES] = snapDegrees;
|
|
||||||
|
|
||||||
|
selectionDegrees[MINUTES] = snapDegrees;
|
||||||
type = MINUTES;
|
type = MINUTES;
|
||||||
newValue = getCurrentMinute();
|
newValue = getCurrentMinute();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (newValue != -1) {
|
if (valueChanged || forceSelection || autoAdvance) {
|
||||||
|
// Fire the listener even if we just need to auto-advance.
|
||||||
if (mListener != null) {
|
if (mListener != null) {
|
||||||
mListener.onValueSelected(type, newValue, autoAdvance);
|
mListener.onValueSelected(type, newValue, autoAdvance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only provide feedback if the value actually changed.
|
||||||
|
if (valueChanged || forceSelection) {
|
||||||
performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
|
performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);
|
||||||
invalidate();
|
invalidate();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user