Esempio n. 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));
        }
        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);
        }
        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);
        }
Esempio n. 4
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");
            });
        }
Esempio n. 5
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);
            });
        }
Esempio n. 6
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");
            });
        }
Esempio n. 7
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));
        }