/// <summary> /// Shows the default Android time picker. /// </summary> /// <param name="hourOfDay">Hour of day.</param> /// <param name="minute">Minute. Not Zero-base as on Android!</param> /// <param name="onTimePicked">Time was picked callback.</param> /// <param name="onCancel">Dialog was cancelled callback.</param> /// <param name="theme">Dialog theme</param> /// <param name="is24HourFormat">If the picker is in 24 hour format</param> public static void ShowTimePicker(int hourOfDay, int minute, OnTimePicked onTimePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default, bool is24HourFormat = true) { if (AGUtils.IsNotAndroid()) { return; } AGUtils.RunOnUiThread(() => { var dialog = CreateBaseTimePicker(hourOfDay, minute, onTimePicked, onCancel, theme, is24HourFormat); AndroidDialogUtils.ShowWithImmersiveModeWorkaround(dialog); }); }
/// <summary> /// Shows the default Android date picker. /// </summary> /// <param name="year">Year.</param> /// <param name="month">Month.</param> /// <param name="day">Day.</param> /// <param name="onDatePicked">Date was picked callback.</param> /// <param name="onCancel">Dialog was cancelled callback.</param> /// <param name="theme">Dialog theme</param> public static void ShowDatePicker(int year, int month, int day, OnDatePicked onDatePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default) { if (AGUtils.IsNotAndroid()) { return; } AGUtils.RunOnUiThread(() => { var dialog = CreateDatePickerDialog(year, month, day, onDatePicked, onCancel, theme); AndroidDialogUtils.ShowWithImmersiveModeWorkaround(dialog); }); }
public static void ShowDatePickerWithLimits(int year, int month, int day, OnDatePicked onDatePicked, Action onCancel, DateTime minDate, DateTime maxDate, AGDialogTheme theme = AGDialogTheme.Default) { if (AGUtils.IsNotAndroid()) { return; } AGUtils.RunOnUiThread(() => { var dialog = CreateDatePickerDialog(year, month, day, onDatePicked, onCancel, theme); var picker = dialog.CallAJO("getDatePicker"); picker.Call("setMinDate", minDate.ToMillisSinceEpoch()); picker.Call("setMaxDate", maxDate.ToMillisSinceEpoch()); AndroidDialogUtils.ShowWithImmersiveModeWorkaround(dialog); }); }
/// <summary> /// Shows the default Android time picker. /// </summary> /// <param name="hourOfDay">Hour of day.</param> /// <param name="minute">Minute. Not Zero-base as on Android!</param> /// <param name="onTimePicked">Time was picked callback.</param> /// <param name="onCancel">Dialog was cancelled callback.</param> /// <param name="theme">Dialog theme</param> /// <param name="is24HourFormat">If the picker is in 24 hour format</param> public static void ShowTimePicker(int hourOfDay, int minute, OnTimePicked onTimePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default, bool is24HourFormat = true) { if (AGUtils.IsNotAndroidCheck()) { return; } AGUtils.RunOnUiThread(() => { var listener = new OnTimeSetListenerPoxy(onTimePicked); int themeResource = AndroidDialogUtils.GetDialogTheme(theme); var dialog = AndroidDialogUtils.IsDefault(themeResource) ? new AndroidJavaObject(TimePickerClass, AGUtils.Activity, listener, hourOfDay, minute, is24HourFormat) : new AndroidJavaObject(TimePickerClass, AGUtils.Activity, themeResource, listener, hourOfDay, minute, is24HourFormat); dialog.Call("setOnCancelListener", new DialogOnCancelListenerPoxy(onCancel)); AndroidDialogUtils.ShowWithImmersiveModeWorkaround(dialog); }); }
/// <summary> /// Shows the default Android date picker. /// </summary> /// <param name="year">Year.</param> /// <param name="month">Month.</param> /// <param name="day">Day.</param> /// <param name="onDatePicked">Date was picked callback.</param> /// <param name="onCancel">Dialog was cancelled callback.</param> /// <param name="theme">Dialog theme</param> public static void ShowDatePicker(int year, int month, int day, OnDatePicked onDatePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default) { if (AGUtils.IsNotAndroidCheck()) { return; } AGUtils.RunOnUiThread(() => { var listener = new OnDateSetListenerPoxy(onDatePicked); int themeResource = AndroidDialogUtils.GetDialogTheme(theme); // Month! (0-11 for compatibility with MONTH) var dialog = AndroidDialogUtils.IsDefault(themeResource) ? new AndroidJavaObject(DatePickerClass, AGUtils.Activity, listener, year, month - 1, day) : new AndroidJavaObject(DatePickerClass, AGUtils.Activity, themeResource, listener, year, month - 1, day); dialog.Call("setOnCancelListener", new DialogOnCancelListenerPoxy(onCancel)); AndroidDialogUtils.ShowWithImmersiveModeWorkaround(dialog); }); }
void Show() { AndroidDialogUtils.ShowWithImmersiveModeWorkaround(_dialog); }