예제 #1
0
        void TimeSelectOnClick(object sender, EventArgs eventArgs)
        {
            DateTime currentTime    = DateTime.Now;
            bool     is24HourFormat = true;

            Android.App.TimePickerDialog dialog = new Android.App.TimePickerDialog
                                                      (Activity, this, currentTime.Hour, currentTime.Minute, is24HourFormat);
            dialog.Show();
        }
예제 #2
0
        public override Android.App.Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            DateTime currentTime = DateTime.Now;

            //bool is24HourFormat =
            //dateTimePicker1.CustomFormat = "HH:mm tt";
            Android.App.TimePickerDialog dialog = new Android.App.TimePickerDialog
                                                      (Activity, this, currentTime.Hour, currentTime.Minute, false);

            return(dialog);
        }
        protected override void OnDetached()
        {
            if (_dialog != null)
            {
                _dialog.Dispose();
                _dialog = null;
            }

            _view.Touch -= OnTouch;
            _view        = null;
        }
예제 #4
0
        void OnClickTime(object sender, EventArgs e)
        {
            Android.App.TimePickerDialog timePicker = new Android.App.TimePickerDialog(Context, (s, args) =>
            {
                Hour = args.HourOfDay;

                Minute = args.Minute;

                TimeBut.Text = string.Format("{0:00}", Hour) + ":" + string.Format("{0:00}", Minute);
            }, DateTime.Now.Hour, DateTime.Now.Minute, true);

            timePicker.Show();
        }
        void CreateDialog()
        {
            var time = TimePickerDialog.GetTime(Element);

            if (_dialog == null)
            {
                bool is24HourFormat = DateFormat.Is24HourFormat(_view.Context);
                _dialog = new ATimePickerDialog(_view.Context, TimeSelected, time.Hours, time.Minutes, is24HourFormat);

                _dialog.SetCanceledOnTouchOutside(true);

                _dialog.DismissEvent += (ss, ee) =>
                {
                    _dialog.Dispose();
                    _dialog = null;
                };

                _dialog.Show();
            }
        }
예제 #6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Bundle   bundle = this.Arguments;
            DateTime date   = Arguments.GetString("date").ToDateTime();

            Period = (Period)Enum.Parse(typeof(Period), Arguments.GetString("period"));
            view   = inflater.Inflate(Resource.Layout.fragment_today_card, container, false);
            vm     = new PeriodVM(date, Period, true);

            var binding = DataContext <PeriodVM> .FromView(view);

            binding.VM = vm;

            if (binding.Bindings.Count == 0)
            {
                binding.Add(Resource.Id.layout_time_calories, x => x.TimeOrTotalVisibility);
                binding.Add(Resource.Id.text_totalCalories1, x => x.TotalVisibility);
                binding.Add(Resource.Id.text_totalCalories2, x => x.TotalVisibility);
                binding.Add(Resource.Id.text_totalCalories1, x => x.TotalText);
                binding.Add(Resource.Id.text_totalCalories2, x => x.TotalValue);
                binding.Add(Resource.Id.button_pick_time, x => x.Time);
                binding.Add(Resource.Id.button_pick_time, x => x.TimeVisibility);
                binding.Add(Resource.Id.button_pick_time, (x) =>
                {
                    DateTime current;
                    if (!DateTime.TryParse(x.Time, out current))
                    {
                        current = DateTime.Now;
                    }
                    var tpd = new Android.App.TimePickerDialog(Activity,
                                                               (s, e) => { x.Time = DateTime.Now.SetTime(e.HourOfDay, e.Minute, 0).ToShortTimeString(); }
                                                               , current.Hour, current.Minute, true);
                    tpd.Show();
                });
                binding.Add(Resource.Id.editText_Notes, x => x.Note);
                binding.Add(Resource.Id.layout_notes, x => x.NoteVisibility);
                binding.Add(Resource.Id.btn_delete, x => { x.Note = null; });
            }

            recycler                 = view.FindViewById <RecyclerView>(Resource.Id.recycler);
            editText                 = view.FindViewById <EditText>(Resource.Id.editText_Notes);
            advertisement            = view.FindViewById <LinearLayout>(Resource.Id.advertisement);
            linearLayoutTimeCalories = view.FindViewById <LinearLayout>(Resource.Id.layout_time_calories);
            editNotes                = view.FindViewById <LinearLayout>(Resource.Id.inputNotes);
            ImageView cross = view.FindViewById <ImageView>(Resource.Id.btn_delete);

            textTotalCalories   = view.FindViewById <TextView>(Resource.Id.text_totalCalories);
            buttonSetTime       = view.FindViewById <Button>(Resource.Id.button_pick_time);
            textNotes           = view.FindViewById <TextView>(Resource.Id.text_today_notes);
            layoutNotesSection  = view.FindViewById <LinearLayout>(Resource.Id.layout_note_section);
            emptyScreenImage    = view.FindViewById <ImageView>(Resource.Id.empty_screen);
            getStarted          = view.FindViewById <TextView>(Resource.Id.get_started);
            getStartedText      = view.FindViewById <TextView>(Resource.Id.get_started_text);
            text_totalCalories2 = view.FindViewById <TextView>(Resource.Id.text_totalCalories2);
            UpdateEmptyVisibility();

            cross.Click += async delegate
            {
                Android.Views.InputMethods.InputMethodManager inputManager = (Android.Views.InputMethods.InputMethodManager)inflater.Context.GetSystemService(Context.InputMethodService);
                inputManager.HideSoftInputFromWindow(cross.WindowToken, 0);
            };
            setupRecycler();

            this.HasOptionsMenu = true;

#if DEBUG
            AndroidDebug.SetViewBorders(view);
#endif


            return(view);
        }