partial void OnClockIdentifierChangedPartialNative(string oldClockIdentifier, string newClockIdentifier)
 {
     if (_nativePicker != null)
     {
         _nativePicker.SetIs24HourView(Java.Lang.Boolean.ValueOf(newClockIdentifier != ClockIdentifiers.TwelveHour));
     }
 }
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
        {
            int theme = Arguments.GetInt ("theme");
            int initialHour = Arguments.GetInt ("hour");
            int initialMinute = Arguments.GetInt ("minute");
            bool isClientSpecified24HourTime = Arguments.GetBoolean ("isClientSpecified24HourTime");
            bool is24HourTime = Arguments.GetBoolean ("is24HourTime");

            Context contextThemeWrapper = new ContextThemeWrapper (
                                              Activity,
                                              theme == SlideDateTimePicker.HOLO_DARK ? Android.Resource.Style.ThemeHolo : Android.Resource.Style.ThemeHoloLight);

            LayoutInflater localInflater = inflater.CloneInContext (contextThemeWrapper);

            View v = localInflater.Inflate (Resource.Layout.Fragment_Time, container, false);

            mTimePicker = v.FindViewById<TimePicker> (Resource.Id.timePicker);
            mTimePicker.DescendantFocusability = DescendantFocusability.BlockDescendants;
            mTimePicker.SetOnTimeChangedListener (this);

            if (isClientSpecified24HourTime) {
                mTimePicker.SetIs24HourView(new Java.Lang.Boolean(is24HourTime));
            } else {
                mTimePicker.SetIs24HourView (new Java.Lang.Boolean (DateFormat.Is24HourFormat (TargetFragment.Activity)));
            }

            mTimePicker.CurrentHour = new Java.Lang.Integer(initialHour);
            mTimePicker.CurrentMinute = new Java.Lang.Integer(initialMinute);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.IceCreamSandwich
               && Build.VERSION.SdkInt <= BuildVersionCodes.IceCreamSandwichMr1) {
                FixTimePickerBug18982 ();
            }

            return v;
        }
		protected override void OnCreate (Bundle savedInstanceState)
		{
			RequestWindowFeature (WindowFeatures.NoTitle);
			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.alarm_controller);
			btnSet =  FindViewById<Button>(Resource.Id.btnSet);
			btnRandom =  FindViewById<Button>(Resource.Id.btnRandom);
			timePicker =  FindViewById<TimePicker>(Resource.Id.timePicker);
			btnTheme=  FindViewById<Button>(Resource.Id.btnTheme);
			timePicker.SetIs24HourView ((Java.Lang.Boolean)true);
			btnSet.Click += btnSet_Click;
			btnRandom.Click += btnRandom_Click;
			btnTheme.Click += btnTheme_Click;

		}
Пример #4
0
        public static Dialog Build(Activity activity, TimePromptConfig config)
        {
            var picker = new TimePicker(activity);
            var builder = new AlertDialog
                .Builder(activity)
                .SetCancelable(false)
                .SetTitle(config.Title)
                .SetView(picker);

            if (config.SelectedTime != null)
            {
                picker.CurrentHour = new Integer(config.SelectedTime.Value.Hours);
                picker.CurrentMinute = new Integer(config.SelectedTime.Value.Minutes);
            }

            var is24Hour = config.Use24HourClock ?? DateFormat.Is24HourFormat (activity);
            picker.SetIs24HourView(new Java.Lang.Boolean(is24Hour));

            if (config.IsCancellable)
            {
                builder.SetNegativeButton(
                    config.CancelText,
                    (sender, args) =>
                    {
                        var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0);
                        config.OnAction?.Invoke(new TimePromptResult(false, ts));
                    }
                );
            }
            builder.SetPositiveButton(
                config.OkText,
                (sender, args) =>
                {
                    var ts = new TimeSpan(0, picker.CurrentHour.IntValue(), picker.CurrentMinute.IntValue(), 0);
                    config.OnAction?.Invoke(new TimePromptResult(true, ts));
                }
            );

            return builder.Show();
        }
Пример #5
0
		public void TimePickDialogShow(EditText edit_inputTime)
		{
			var timepickerlayout = (LinearLayout) activity.LayoutInflater.Inflate (Resource.Layout.commontimepickerlayout, null);
			timePicker = (TimePicker) timepickerlayout.FindViewById<TimePicker>(Resource.Id.timepicker); 
			InitTimePicker (timePicker);
			timePicker.SetIs24HourView(Java.Lang.Boolean.ValueOf(true)); 
			timePicker.SetOnTimeChangedListener(this);  
			var builder = new AlertDialog.Builder (activity).SetView(timepickerlayout);
			builder.SetPositiveButton ("设置", (sender, e) => {
				dialog.Dismiss();	
				edit_inputTime.Text = dateTime;

			});
			builder.SetNegativeButton ("取消", (sender, e) => {
				dialog.Dismiss();	

			});
			dialog= builder.Create ();

			dialog.Show();
			OnTimeChanged (null,0,0);
		}
Пример #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.podajGodzine);

            Zmienne.czasPicia = 0;
            Zmienne.czas1 = 0;

            // Create your application here

            //godzina pobierana z telefonu
            g1 = DateTime.Now.Hour;
            m1 = DateTime.Now.Minute;

            //suma godzin i minut pobranych z telefonu
            Zmienne.czas1 = g1 + (m1 / 60);

            //jak wywo³uje siê zegar w nowej metodzie to dziala liczenie, ale zegar jest am/pm
            zegar = FindViewById<TimePicker>(Resource.Id.timePicker1);
            zegar.SetIs24HourView(Java.Lang.Boolean.True);
            Button buttonPodajGodzine = FindViewById<Button>(Resource.Id.buttonPodajGodzine);
            buttonPodajGodzine.Click += ButtonPodajGodzine_Click;
        }
		/**
     * Create and return the user interface view for this fragment.
     */
		public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState)
		{
			int theme = Arguments.GetInt("theme");
			int initialHour = Arguments.GetInt("hour");
			int initialMinute = Arguments.GetInt("minute");
			bool isClientSpecified24HourTime = Arguments.GetBoolean("isClientSpecified24HourTime");
			bool is24HourTime = Arguments.GetBoolean("is24HourTime");

			// Unless we inflate using a cloned inflater with a Holo theme,
			// on Lollipop devices the TimePicker will be the new-style
			// radial TimePicker, which is not what we want. So we will
			// clone the inflater that we're given but with our specified
			// theme, then inflate the layout with this new inflater.

			Context contextThemeWrapper = new ContextThemeWrapper(
				Activity,theme == SlideDateTimePicker._holoDark ?Android.Resource.Style.ThemeHolo : Android.Resource.Style.ThemeHoloLight);

			LayoutInflater localInflater = inflater.CloneInContext(contextThemeWrapper);

			View view = localInflater.Inflate(Resource.Layout.FragmentTimeLayout, container, false);

			_timePicker = (TimePicker) view.FindViewById(Resource.Id.timePicker);
			// block keyboard popping up on touch
			_timePicker.DescendantFocusability=DescendantFocusability.BlockDescendants;
			_timePicker.SetOnTimeChangedListener (this);

			// If the client specifies a 24-hour time format, set it on
			// the TimePicker.
			if (isClientSpecified24HourTime)
			{
				_timePicker.SetIs24HourView((Boolean)is24HourTime);
			}
			else
			{
				// If the client does not specify a 24-hour time format, use the
				// device default.
				_timePicker.SetIs24HourView((Boolean)DateFormat.Is24HourFormat(TargetFragment.Activity));
			}

			_timePicker.CurrentHour=(Integer)initialHour;
			_timePicker.CurrentMinute=(Integer)initialMinute;

			// Fix for the bug where a TimePicker's onTimeChanged() is not called when
			// the user toggles the AM/PM button. Only applies to 4.0.0 and 4.0.3.
			if ((int)Build.VERSION.SdkInt >= 14 && (int)Build.VERSION.SdkInt <= 15)
			{
				FixTimePickerBug18982();
			}

			return view;
		}
		protected override void OnCreate(Bundle icicle) {
			base.OnCreate(icicle);

			Window w = Window;
			w.RequestFeature (WindowFeatures.LeftIcon);
			SetContentView(Resource.Layout.push_preferences_dialog);

			pushEnabled = (CheckBox) FindViewById(Resource.Id.push_enabled);
			soundEnabled = (CheckBox) FindViewById(Resource.Id.sound_enabled);
			vibrateEnabled = (CheckBox) FindViewById(Resource.Id.vibrate_enabled);
			quietTimeEnabled = (CheckBox) FindViewById(Resource.Id.quiet_time_enabled);
			locationEnabled = (CheckBox) FindViewById(Resource.Id.location_enabled);
			backgroundLocationEnabled = (CheckBox) FindViewById(Resource.Id.background_location_enabled);
			foregroundLocationEnabled = (CheckBox) FindViewById(Resource.Id.foreground_location_enabled);
			locationEnabledLabel = (TextView) FindViewById(Resource.Id.location_enabled_label);
			backgroundLocationEnabledLabel = (TextView) FindViewById(Resource.Id.background_location_enabled_label);
			foregroundLocationEnabledLabel = (TextView) FindViewById(Resource.Id.foreground_location_enabled_label);

			startTime = (TimePicker) FindViewById(Resource.Id.start_time);
			endTime = (TimePicker) FindViewById(Resource.Id.end_time);

			startTime.SetIs24HourView (new Java.Lang.Boolean (DateFormat.Is24HourFormat(this)));
			endTime.SetIs24HourView (new Java.Lang.Boolean (DateFormat.Is24HourFormat(this)));

			pushEnabled.Click += (v, e) => {
				PushSettingsActive(((CheckBox) v).Checked);
			};
			quietTimeEnabled.Click += (v, e) => {
				QuietTimeSettingsActive(((CheckBox)v).Checked);
			};

			locationEnabled.Click += (v, e) => {
				BackgroundLocationActive(((CheckBox)v).Checked);
				ForegroundLocationActive(((CheckBox)v).Checked);
			};

		}