diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-11-07 14:53:34 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2011-11-07 15:02:10 -0800 |
| commit | b52d9729bfb2ef7ad50d9a5125ebf3a8322429a9 (patch) | |
| tree | a3063549371a02c87c20d85af5a00ab849d45ec0 /core/java/android/widget/NumberPicker.java | |
| parent | 6918bca7f8db32435bb8a14ba6eaa198c8a4190b (diff) | |
NumberPicker does not hide IME when flinged.
Now the IME is hiddedn once the user starts flinging since he is
using another method of updating the current value. This is now
consistent with the case of shown IME and poking the up/down
button.
bug:5174339
Change-Id: Id25934f394314a285b753f0bec7f422034ada90a
Diffstat (limited to 'core/java/android/widget/NumberPicker.java')
| -rw-r--r-- | core/java/android/widget/NumberPicker.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 5ab99dcfa184..b44b3391295f 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -574,10 +574,7 @@ public class NumberPicker extends LinearLayout { OnClickListener onClickListener = new OnClickListener() { public void onClick(View v) { - InputMethodManager inputMethodManager = InputMethodManager.peekInstance(); - if (inputMethodManager != null && inputMethodManager.isActive(mInputText)) { - inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); - } + hideSoftInput(); mInputText.clearFocus(); if (v.getId() == R.id.increment) { changeCurrentByOne(true); @@ -589,6 +586,7 @@ public class NumberPicker extends LinearLayout { OnLongClickListener onLongClickListener = new OnLongClickListener() { public boolean onLongClick(View v) { + hideSoftInput(); mInputText.clearFocus(); if (v.getId() == R.id.increment) { postChangeCurrentByOneFromLongPress(true); @@ -769,6 +767,7 @@ public class NumberPicker extends LinearLayout { } mBeginEditOnUpEvent = scrollersFinished; mAdjustScrollerOnUpEvent = true; + hideSoftInput(); hideInputControls(); return true; } @@ -778,6 +777,7 @@ public class NumberPicker extends LinearLayout { } mAdjustScrollerOnUpEvent = false; setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE); + hideSoftInput(); hideInputControls(); return true; case MotionEvent.ACTION_MOVE: @@ -787,6 +787,7 @@ public class NumberPicker extends LinearLayout { mBeginEditOnUpEvent = false; onScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL); setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE); + hideSoftInput(); hideInputControls(); return true; } @@ -1045,6 +1046,16 @@ public class NumberPicker extends LinearLayout { } /** + * Hides the soft input of it is active for the input text. + */ + private void hideSoftInput() { + InputMethodManager inputMethodManager = InputMethodManager.peekInstance(); + if (inputMethodManager != null && inputMethodManager.isActive(mInputText)) { + inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); + } + } + + /** * Computes the max width if no such specified as an attribute. */ private void tryComputeMaxWidth() { |
