Bug 808405 - Use system preference for TimePicker 12/24 hour format; r=wesj
authorJim Chen <nchen@mozilla.com>
Mon, 05 Nov 2012 14:33:43 -0500
changeset 112338 c69822a9bd0fe015d1696be81c9e92a9203a477a
parent 112337 f8cd6fa12a8bee4f601bea35b7f8be6e94969bce
child 112339 bc191fe62b436ff9b265110ba16d09af7bb9c863
push id17524
push usernchen@mozilla.com
push dateMon, 05 Nov 2012 19:34:17 +0000
treeherdermozilla-inbound@c69822a9bd0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs808405
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 808405 - Use system preference for TimePicker 12/24 hour format; r=wesj
mobile/android/base/PromptService.java
--- a/mobile/android/base/PromptService.java
+++ b/mobile/android/base/PromptService.java
@@ -17,16 +17,17 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.DialogInterface.OnCancelListener;
 import android.content.DialogInterface.OnClickListener;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.text.InputType;
+import android.text.format.DateFormat;
 import android.util.Log;
 import android.view.inputmethod.InputMethodManager;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
@@ -153,16 +154,17 @@ public class PromptService implements On
                     view = (View)input;
                 }
             } else if (type.equals("week")) {
                 DateTimePicker input = new DateTimePicker(GeckoApp.mAppContext, "yyyy-'W'ww", value,
                                                           DateTimePicker.pickersState.WEEK);
                 view = (View)input;
             } else if (type.equals("time")) {
                 TimePicker input = new TimePicker(GeckoApp.mAppContext);
+                input.setIs24HourView(DateFormat.is24HourFormat(GeckoApp.mAppContext));
                 if (!value.equals("")) {
                     try {
                         GregorianCalendar calendar = new GregorianCalendar();
                         calendar.setTime(new SimpleDateFormat("kk:mm").parse(value));
                         input.setCurrentHour(calendar.get(GregorianCalendar.HOUR_OF_DAY));
                         input.setCurrentMinute(calendar.get(GregorianCalendar.MINUTE));
                     } catch (Exception e) { }
                 }