summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
diff options
context:
space:
mode:
authorPhilipp Sumi <hardcodet@users.noreply.github.com>2017-01-11 12:06:18 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-01-11 12:06:18 (GMT)
commit11b982e5d556324b344888ddf446b6c044a7954b (patch)
tree4251b205a5c9b96ceee19e9282d1b1ab2852379e /Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
parentf78b328759bb673b695c6b0d1a1dac6d871d257a (diff)
downloadxamarin-forms-11b982e5d556324b344888ddf446b6c044a7954b.zip
xamarin-forms-11b982e5d556324b344888ddf446b6c044a7954b.tar.gz
xamarin-forms-11b982e5d556324b344888ddf446b6c044a7954b.tar.bz2
Enable 24-hr formatting for Android TimePicker (#654)
Enable 24-hr time formatting depending on Android system settings instead of the hard coded 12-hour setting.
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
index 2bd60a7..c2bf10d 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/TimePickerRenderer.cs
@@ -3,6 +3,7 @@ using System.ComponentModel;
using Android.App;
using Android.Content.Res;
using Android.Widget;
+using Android.Text.Format;
using ADatePicker = Android.Widget.DatePicker;
using ATimePicker = Android.Widget.TimePicker;
using Object = Java.Lang.Object;
@@ -92,7 +93,8 @@ namespace Xamarin.Forms.Platform.Android
TimePicker view = Element;
ElementController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, true);
- _dialog = new TimePickerDialog(Context, this, view.Time.Hours, view.Time.Minutes, false);
+ bool is24HourFormat = DateFormat.Is24HourFormat(Context);
+ _dialog = new TimePickerDialog(Context, this, view.Time.Hours, view.Time.Minutes, is24HourFormat);
if (Forms.IsLollipopOrNewer)
_dialog.CancelEvent += OnCancelButtonClicked;
@@ -129,4 +131,4 @@ namespace Xamarin.Forms.Platform.Android
}
}
}
-} \ No newline at end of file
+}