diff options
author | Adam Powell <adamp@google.com> | 2010-10-02 12:16:51 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-10-02 12:52:28 -0700 |
commit | 8bcbebd4178b2e9aca9ee3bd9e1e12c42e74c8db (patch) | |
tree | 065ca5a0834e34cf5e8c642c773a102094ab4c92 | |
parent | e951ef07dd8cb36ec0e127e80f5d558b8a2d6125 (diff) | |
download | frameworks_base-8bcbebd4178b2e9aca9ee3bd9e1e12c42e74c8db.zip frameworks_base-8bcbebd4178b2e9aca9ee3bd9e1e12c42e74c8db.tar.gz frameworks_base-8bcbebd4178b2e9aca9ee3bd9e1e12c42e74c8db.tar.bz2 |
Fix bug 3024080 - Date picker month field uses numeric text field
NumberPicker now uses text entry when displayed value strings are
provided.
Change-Id: I555a7d6b64ad6a5af131b3e1d8c638dcdb00d02c
-rw-r--r-- | core/java/android/widget/DatePicker.java | 4 | ||||
-rw-r--r-- | core/java/android/widget/NumberPicker.java | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java index 8aed454..a371290 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -114,9 +114,11 @@ public class DatePicker extends FrameLayout { for (int i = 0; i < months.length; i++) { months[i] = String.valueOf(i + 1); } + mMonthPicker.setRange(1, 12); + } else { + mMonthPicker.setRange(1, 12, months); } - mMonthPicker.setRange(1, 12, months); mMonthPicker.setSpeed(200); mMonthPicker.setOnChangeListener(new OnChangedListener() { public void onChanged(NumberPicker picker, int oldVal, int newVal) { diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 582d9e4..4482b5b 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -16,6 +16,8 @@ package android.widget; +import com.android.internal.R; + import android.annotation.Widget; import android.content.Context; import android.os.Handler; @@ -26,14 +28,6 @@ import android.text.method.NumberKeyListener; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; -import android.view.View.OnFocusChangeListener; -import android.view.View.OnLongClickListener; -import android.widget.TextView; -import android.widget.LinearLayout; -import android.widget.EditText; - -import com.android.internal.R; /** * A view for selecting a number @@ -274,6 +268,12 @@ public class NumberPicker extends LinearLayout { mEnd = end; mCurrent = start; updateView(); + + if (displayedValues != null) { + // Allow text entry rather than strictly numeric entry. + mText.setRawInputType(InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); + } } /** |