summaryrefslogtreecommitdiff
path: root/core/java/android/widget/NumberPicker.java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-01-26 22:50:51 -0800
committerSvetoslav Ganov <svetoslavganov@google.com>2011-01-26 22:50:55 -0800
commit58f51255eb20f9c4d16c11554f372ff92d45fcc7 (patch)
treed6efaae70285478feed7092bb491c70292cb4957 /core/java/android/widget/NumberPicker.java
parent7765c65dbe1ba8f2229f2fec5a83ba2d1da79733 (diff)
The calendar view widget was jumping incorrectly to the next week
while selectiong the last day of the week. The NumberPicker widget was getting into an inconsitent state when reaching the end of the range (non wrapping selector wheel) and the user touches the location of the hidden increment/decrement button. Change-Id: Id54103295dd2574030e2c29996061faa659a5bb7
Diffstat (limited to 'core/java/android/widget/NumberPicker.java')
-rw-r--r--core/java/android/widget/NumberPicker.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index c5161bcb6c1f..c5b1caae79d4 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -623,7 +623,11 @@ public class NumberPicker extends LinearLayout {
hideInputControls();
return true;
}
- if (isEventInInputText(event)) {
+ if (isEventInViewHitRect(event, mInputText)
+ || (!mIncrementButton.isShown()
+ && isEventInViewHitRect(event, mIncrementButton))
+ || (!mDecrementButton.isShown()
+ && isEventInViewHitRect(event, mDecrementButton))) {
mAdjustScrollerOnUpEvent = false;
setDrawSelectorWheel(true);
hideInputControls();
@@ -708,7 +712,7 @@ public class NumberPicker extends LinearLayout {
public boolean dispatchTouchEvent(MotionEvent event) {
int action = event.getActionMasked();
if ((action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP)
- && !isEventInInputText(event)) {
+ && !isEventInViewHitRect(event, mInputText)) {
removeAllCallbacks();
}
return super.dispatchTouchEvent(event);
@@ -1177,10 +1181,10 @@ public class NumberPicker extends LinearLayout {
}
/**
- * @return If the <code>event</code> is in the input text.
+ * @return If the <code>event</code> is in the <code>view</code>.
*/
- private boolean isEventInInputText(MotionEvent event) {
- mInputText.getHitRect(mTempRect);
+ private boolean isEventInViewHitRect(MotionEvent event, View view) {
+ view.getHitRect(mTempRect);
return mTempRect.contains((int) event.getX(), (int) event.getY());
}