Bug 1143280 - DateTimePicker: Replace deprecated DateFormat constants with local constants. r=rnewman, a=sylvestre
authorSebastian Kaspari <s.kaspari@gmail.com>
Sun, 15 Mar 2015 10:51:15 +0100
changeset 258215 14eb337e419a
parent 258214 27f61020a9e4
child 258216 f546eff14959
push id4621
push userrnewman@mozilla.com
push date2015-04-02 18:44 +0000
treeherdermozilla-beta@f546eff14959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, sylvestre
bugs1143280
milestone38.0
Bug 1143280 - DateTimePicker: Replace deprecated DateFormat constants with local constants. r=rnewman, a=sylvestre
mobile/android/base/widget/DateTimePicker.java
--- a/mobile/android/base/widget/DateTimePicker.java
+++ b/mobile/android/base/widget/DateTimePicker.java
@@ -42,16 +42,19 @@ import android.widget.NumberPicker;
 
 public class DateTimePicker extends FrameLayout {
     private static final boolean DEBUG = true;
     private static final String LOGTAG = "GeckoDateTimePicker";
     private static final int DEFAULT_START_YEAR = 1;
     private static final int DEFAULT_END_YEAR = 9999;
     // Minimal screen width (in inches) for which we can show the calendar;
     private static final int SCREEN_SIZE_THRESHOLD = 5;
+    private static final char DATE_FORMAT_DAY = 'd';
+    private static final char DATE_FORMAT_MONTH = 'M';
+    private static final char DATE_FORMAT_YEAR = 'y';
 
     boolean mYearEnabled = true;
     boolean mMonthEnabled = true;
     boolean mWeekEnabled;
     boolean mDayEnabled = true;
     boolean mHourEnabled = true;
     boolean mMinuteEnabled = true;
     boolean mIs12HourMode;
@@ -387,31 +390,33 @@ public class DateTimePicker extends Fram
     public long getTimeInMillis(){
         return mCurrentDate.getTimeInMillis();
     }
 
     private void reorderDateSpinners() {
         mDateSpinners.removeAllViews();
         char[] order = DateFormat.getDateFormatOrder(getContext());
         final int spinnerCount = order.length;
+
         for (int i = 0; i < spinnerCount; i++) {
             switch (order[i]) {
-                case DateFormat.DATE:
+                case DATE_FORMAT_DAY:
                     mDateSpinners.addView(mDaySpinner);
                     break;
-                case DateFormat.MONTH:
+                case DATE_FORMAT_MONTH:
                     mDateSpinners.addView(mMonthSpinner);
                     break;
-                case DateFormat.YEAR:
+                case DATE_FORMAT_YEAR:
                     mDateSpinners.addView(mYearSpinner);
                     break;
                 default:
                     throw new IllegalArgumentException();
             }
         }
+
         mDateSpinners.addView(mWeekSpinner);
     }
 
     void setDate(Calendar calendar){
         mCurrentDate = mTempDate;
         if (mCurrentDate.before(mMinDate)) {
             mCurrentDate.setTimeInMillis(mMinDate.getTimeInMillis());
         } else if (mCurrentDate.after(mMaxDate)) {