summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/NumberPicker.java
diff options
context:
space:
mode:
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 c5161bc..c5b1caa 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());
}