コード例 #1
0
        private static AndroidJavaObject CreateDialogBuilder(AGDialogTheme theme)
        {
            int themeResource = AndroidDialogUtils.GetDialogTheme(theme);

            return(AndroidDialogUtils.IsDefault(themeResource) ?
                   new AndroidJavaObject(AlertDialogBuilderClass, AGUtils.Activity) :
                   new AndroidJavaObject(AlertDialogBuilderClass, AGUtils.Activity, themeResource));
        }
コード例 #2
0
        static AndroidJavaObject CreateBaseTimePicker(int hourOfDay, int minute, OnTimePicked onTimePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default, bool is24HourFormat = true)
        {
            var listener      = new OnTimeSetListenerPoxy(onTimePicked);
            var 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));
            return(dialog);
        }
コード例 #3
0
        /// <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);
            });
        }
コード例 #4
0
        public static AndroidJavaObject CreateDatePickerDialog(int year, int month, int day,
                                                               OnDatePicked onDatePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default)
        {
            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));
            return(dialog);
        }
コード例 #5
0
        /// <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);
            });
        }
コード例 #6
0
        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);
            });
        }
コード例 #7
0
        /// <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>
        public static void ShowTimePicker(int hourOfDay, int minute, OnTimePicked onTimePicked, Action onCancel, AGDialogTheme theme = AGDialogTheme.Default)
        {
            if (AGUtils.IsNotAndroidCheck())
            {
                return;
            }

            AGUtils.RunOnUiThread(() =>
            {
                var listener      = new AGDateTimePicker.OnTimeSetListenerPoxy(onTimePicked);
                int themeResource = AndroidDialogUtils.GetDialogTheme(theme);

                var dialog = AndroidDialogUtils.IsDefault(themeResource) ?
                             new AndroidJavaObject(TimePickerClass, AGUtils.Activity, listener, hourOfDay, minute, true) :
                             new AndroidJavaObject(TimePickerClass, AGUtils.Activity, themeResource, listener, hourOfDay, minute, true);
                dialog.Call("setOnCancelListener", new DialogOnCancelListenerPoxy(onCancel));
                dialog.Call("show");
            });
        }
コード例 #8
0
        /// <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);
            });
        }
コード例 #9
0
        /// <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 AGDateTimePicker.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));
                dialog.Call("show");
            });
        }
コード例 #10
0
        static AndroidJavaObject CreateDialog(AGDialogTheme theme)
        {
            int themeResource = AndroidDialogUtils.GetDialogTheme(theme);

            return(AndroidDialogUtils.IsDefault(themeResource) ? new AndroidJavaObject(ProgressDialogClass, AGUtils.Activity) : new AndroidJavaObject(ProgressDialogClass, AGUtils.Activity, themeResource));
        }
コード例 #11
0
 void Show()
 {
     AndroidDialogUtils.ShowWithImmersiveModeWorkaround(_dialog);
 }