diff options
author | Alan Viverette <alanv@google.com> | 2015-03-23 17:35:39 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-23 17:35:40 +0000 |
commit | 2a16460c7c914729e9c256ce39d681524d53b7dc (patch) | |
tree | 43065b781b4cae380d868e539041e58ebec073fa /core/java/android/widget/RadialTimePickerView.java | |
parent | 709a4de485a016195252e15498c105ecd25851a8 (diff) | |
parent | 4a6bd692d2de2127406e89d3aefeb8a6c950deb6 (diff) | |
download | frameworks_base-2a16460c7c914729e9c256ce39d681524d53b7dc.zip frameworks_base-2a16460c7c914729e9c256ce39d681524d53b7dc.tar.gz frameworks_base-2a16460c7c914729e9c256ce39d681524d53b7dc.tar.bz2 |
Merge "Fix radial time picker for Explore by Touch and scroll actions"
Diffstat (limited to 'core/java/android/widget/RadialTimePickerView.java')
-rw-r--r-- | core/java/android/widget/RadialTimePickerView.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/core/java/android/widget/RadialTimePickerView.java b/core/java/android/widget/RadialTimePickerView.java index 28b4db2..20aa972 100644 --- a/core/java/android/widget/RadialTimePickerView.java +++ b/core/java/android/widget/RadialTimePickerView.java @@ -641,7 +641,7 @@ public class RadialTimePickerView extends View { mCircleRadius = Math.min(mXCenter, mYCenter); mMinHypotenuseForInnerNumber = mCircleRadius - mTextInset[HOURS_INNER] - mSelectorRadius; - mMaxHypotenuseForOuterNumber = mCircleRadius - mTextInset[HOURS] - mSelectorRadius; + mMaxHypotenuseForOuterNumber = mCircleRadius - mTextInset[HOURS] + mSelectorRadius; mHalfwayHypotenusePoint = mCircleRadius - (mTextInset[HOURS] + mTextInset[HOURS_INNER]) / 2; calculatePositionsHours(); @@ -1144,30 +1144,31 @@ public class RadialTimePickerView extends View { private void adjustPicker(int step) { final int stepSize; - final int initialValue; + final int initialStep; final int maxValue; final int minValue; if (mShowHours) { - stepSize = DEGREES_FOR_ONE_HOUR; - initialValue = getCurrentHour() % 12; + stepSize = 1; + final int currentHour24 = getCurrentHour(); if (mIs24HourMode) { - maxValue = 23; + initialStep = currentHour24; minValue = 0; + maxValue = 23; } else { - maxValue = 12; + initialStep = hour24To12(currentHour24); minValue = 1; + maxValue = 12; } } else { - stepSize = DEGREES_FOR_ONE_MINUTE; - initialValue = getCurrentMinute(); - - maxValue = 55; + stepSize = 5; + initialStep = getCurrentMinute() / stepSize; minValue = 0; + maxValue = 55; } - final int steppedValue = snapOnly30s(initialValue * stepSize, step) / stepSize; - final int clampedValue = MathUtils.constrain(steppedValue, minValue, maxValue); + final int nextValue = (initialStep + step) * stepSize; + final int clampedValue = MathUtils.constrain(nextValue, minValue, maxValue); if (mShowHours) { setCurrentHour(clampedValue); } else { |