public void Init(DateTimeFormatInfo format, string data) { if (String.IsNullOrWhiteSpace(data)) { picker.Init(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, this); } else if (long.TryParse(data, out long result)) { picker.DateTime = DateTime.FromFileTimeUtc(result); } else { picker.Init(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, this); } }
private void SetupViews() { if (viewsSetup || timePicker == null) { return; } viewsSetup = true; var time = InitialTime; var date = InitialTime.Date; timePicker.SetIs24HourView(new Java.Lang.Boolean( DateFormat.Is24HourFormat(ServiceContainer.Resolve <Context> ()))); timePicker.CurrentHour = new Java.Lang.Integer(time.Hour); timePicker.CurrentMinute = new Java.Lang.Integer(time.Minute); timePicker.TimeChanged += OnTimePickerTimeChanged; datePicker.Init(date.Year, date.Month - 1, date.Day, this); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { var userData = ServiceContainer.Resolve <AuthManager> ().User; datePicker.FirstDayOfWeek = ((int)userData.StartOfWeek) + 1; // FirstDayOfWeek must be between 1 - 7, Our days go from 0 - 6. } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var date = DateTime.FromBinary(Arguments.GetLong(C_ARG_DATE)); //var calendar = ju.Calendar.Instance; //calendar.Time = date.ToJavaDate(); //var year = calendar.Get(ju.CalendarField.Year); //var month = calendar.Get(ju.CalendarField.Month); //var day = calendar.Get(ju.CalendarField.DayOfMonth); var view = LayoutInflater.From(Activity).Inflate(Resource.Layout.dialog_date, null); datePicker = view.FindViewById <DatePicker>(Resource.Id.DialogDatePicker); //datePicker.Init(year, month, day, null); datePicker.Init(date.Year, date.Month - 1, date.Day, null); using (var builder = new v7.AlertDialog.Builder(Activity)) { return(builder .SetView(view) .SetTitle(Resource.String.DatePickerTitle) .SetPositiveButton(Android.Resource.String.Ok, (sender, e) => { var pickedDate = new DateTime(datePicker.Year, datePicker.Month + 1, datePicker.DayOfMonth); SendResult(Result.Ok, pickedDate); }) .Create()); } }
protected void StoreConfig() { ApplicationContext.GetSharedPreferences(PREFS_NAME, 0).Edit().Clear().Commit(); ISharedPreferences settings = GetSharedPreferences(PREFS_NAME, 0); ISharedPreferencesEditor editor = settings.Edit(); editor.PutInt("myYear", userYear); editor.PutInt("myMonth", userMonth); editor.PutInt("myDay", userDay); Log.Warn(MainActivity.TAG, "userMonth: " + userMonth); Log.Warn(MainActivity.TAG, "userDay: " + userDay); datepicker = FindViewById <DatePicker>(Resource.Id.datePicker_1); datepicker.Init(userYear, userMonth, userDay, null); bool result = CheckBeforeStore(message_lat, message_lon, message_off); if (result) { editor.PutString("myLatitude", message_lat); editor.PutString("myLongitude", message_lon); editor.PutString("myOffset", message_off); editor.Commit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.configuration); locationManager = (LocationManager)GetSystemService(LocationService); bool enabled_GPS = false; enabled_GPS = locationManager.IsProviderEnabled(LocationManager.GpsProvider); if (enabled_GPS) { provider = LocationManager.GpsProvider; } else { provider = LocationManager.NetworkProvider; } Location location = locationManager.GetLastKnownLocation(LocationManager.NetworkProvider); if (location != null) { currentLatitude = location.Latitude; currentLatitude = System.Math.Round(currentLatitude * 100000.00) / 100000.00; currentLongitude = location.Longitude; currentLongitude = System.Math.Round(currentLongitude * 100000.00) / 100000.00; } else { currentLatitude = 44.98; currentLongitude = -93.24; } Log.Warn(MainActivity.TAG, "enabled_GPS == true? " + (enabled_GPS == true).ToString()); Log.Warn(MainActivity.TAG, "location != null? " + (location != null).ToString()); Log.Warn(MainActivity.TAG, "currentLatitude: " + currentLatitude.ToString()); Log.Warn(MainActivity.TAG, "currentLongitude: " + currentLongitude.ToString()); current_cal = Calendar.Instance; TimeZone tz = current_cal.TimeZone; Date date = current_cal.Time; offsetFromUtc = (tz.GetOffset(date.Time)) / 3600000.0; datepicker = FindViewById <DatePicker>(Resource.Id.datePicker_1); datepicker.Init(current_cal.Get(CalendarField.Year), current_cal.Get(CalendarField.Month), current_cal.Get(CalendarField.DayOfMonth), null); ISharedPreferences settings = GetSharedPreferences(PREFS_NAME, 0); message_lat = settings.GetString("myLatitude", currentLatitude.ToString()); message_lon = settings.GetString("myLongitude", currentLongitude.ToString()); message_off = settings.GetString("myOffset", offsetFromUtc.ToString()); userYear = settings.GetInt("myYear", userYear); userMonth = settings.GetInt("myMonth", userMonth); userDay = settings.GetInt("myDay", userDay); Init(); }
private void InitDatePicker(DatePicker _datepicker) { Calendar calendar = Calendar.Instance; if (!string.IsNullOrEmpty(initDate)) { var date = initDate.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries); var year = Integer.ValueOf(date [0]).IntValue(); var month = Integer.ValueOf(date [1]).IntValue() - 1; var day = Integer.ValueOf(date [2]).IntValue(); _datepicker.Init(year, month, day, this); } else { _datepicker.Init(calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.DayOfMonth), this); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.Statisticslayout, container, false); mlistview = view.FindViewById <ListView>(Resource.Id.listViewBarchart); datepicker = view.FindViewById <DatePicker>(Resource.Id.datePicker1); tvtotalkw = view.FindViewById <TextView>(Resource.Id.textViewTotalKW); adapter = new MyBarChartAdapter(this.Context); mlistview.Adapter = adapter; if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop) { int daySpinnerId = Resources.GetIdentifier("day", "id", "android"); if (daySpinnerId != 0) { View daySpinner = datepicker.FindViewById(daySpinnerId); if (daySpinner != null) { daySpinner.Visibility = ViewStates.Gone; } } } else { Java.Lang.Reflect.Field[] f = datepicker.Class.GetDeclaredFields(); foreach (Java.Lang.Reflect.Field field in f) { if (field.Name.Equals("mDaySpinner") || field.Name.Equals("mDayPicker")) { field.Accessible = true; object dayPicker = null; try { dayPicker = field.Get(datepicker); } catch (Java.Lang.IllegalAccessException e) { e.PrintStackTrace(); } ((View)dayPicker).Visibility = ViewStates.Gone; } } } Calendar calendar = Calendar.GetInstance(Locale.Default); datepicker.Init(calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.DayOfMonth), this); calendar.Set(CalendarField.Date, calendar.GetActualMinimum(CalendarField.Date)); startTime = calendar.TimeInMillis; calendar.Set(CalendarField.Date, calendar.GetActualMaximum(CalendarField.Date)); endTime = calendar.TimeInMillis; //FeedFromDb(startTime,endTime); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); MobileAds.Initialize(this, "ca-app-pub-5131184764831509~8873327557"); ShowBannerAd(); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); ISharedPreferencesEditor editor = prefs.Edit(); day = DataProvider.getdayInfo(this); length = day.Length - 1; mButton = FindViewById <Button>(Resource.Id.button1); mButton.Click += (sender, e) => { editor.Clear(); editor.Apply(); Intent I = new Intent(this, typeof(MainActivity)); StartActivity(I); Finish(); }; DatePickerChangeHandler datePickerChangeHandler = new DatePickerChangeHandler(this); DP = FindViewById <DatePicker>(Resource.Id.datePicker1); DTNow = DateTime.Now; DP.Init(DTNow.Year, DTNow.Month - 1, DTNow.Day, datePickerChangeHandler); IndexofDay = DTNow.Month == 9 ? (DTNow.Day - 1) % length : DTNow.Month == 10 ? (DTNow.Day + 1) % length : DTNow.Month == 11 ? (DTNow.Day + 4) % length : DTNow.Month == 12 ? (DTNow.Day + 6) % length : length; myHeader = DataProvider.getInfo(this); myChild = new List <string>(); myChild.Add(day[IndexofDay]); mExListView = FindViewById <ExpandableListView>(Resource.Id.EListView); adapter = new EListViewAdapter(this, myHeader, myChild); mExListView.SetAdapter(adapter); mExListView.ExpandGroup(0); mExListView.ChildClick += (sender, e) => { if (prefs.Contains("QKG 3") || prefs.Contains("QKG 4")) { ChildData = DataProvider.getChildInfo(myHeader[day[IndexofDay]][e.ChildPosition], day[IndexofDay], this); } else { ChildData = DataProvider.getChildInfo(myHeader[day[IndexofDay]][e.ChildPosition], this); } RegisterForContextMenu(mExListView); OpenContextMenu(mExListView); }; }
private void Button_Click(object sender, EventArgs e) { DP.Init(DTNow.Year, DTNow.Month - 1, DTNow.Day, null); IndexofDay = DTNow.Month == 9 ? (DTNow.Day - 1) % length : DTNow.Month == 10 ? (DTNow.Day + 1) % length : DTNow.Month == 11 ? (DTNow.Day + 4) % length : DTNow.Month == 12 ? (DTNow.Day + 6) % length : length; List <string> searchedClass = new List <string>(); searchedClass.Add(day[IndexofDay]); adapter = new EListViewAdapter(this, myHeader, searchedClass); mExListView.SetAdapter(adapter); }
protected override void OnResume() { base.OnResume(); locationManager = (LocationManager)GetSystemService(Context.LocationService); bool enabled_GPS = locationManager.IsProviderEnabled(LocationManager.GpsProvider); if (enabled_GPS) { provider = LocationManager.GpsProvider; } else { provider = LocationManager.NetworkProvider; } Location location = locationManager.GetLastKnownLocation(LocationManager.NetworkProvider); if (location != null) { currentLatitude = location.Latitude; currentLatitude = System.Math.Round(currentLatitude * 100000.00) / 100000.00; currentLongitude = location.Longitude; currentLongitude = System.Math.Round(currentLongitude * 100000.00) / 100000.00; } else { currentLatitude = 44.98; currentLongitude = -93.24; } current_cal = Calendar.Instance; TimeZone tz = current_cal.TimeZone; Date date = current_cal.Time; offsetFromUtc = (tz.GetOffset(date.Time)) / 3600000.0; datepicker = FindViewById <DatePicker>(Resource.Id.datePicker_1); /* * datepicker.Init(current_cal.Get(CalendarField.Year), current_cal.Get(CalendarField.Month), * current_cal.Get(CalendarField.DayOfMonth), null); */ datepicker.Init(userYear, userMonth, userDay, null); ISharedPreferences settings = GetSharedPreferences(PREFS_NAME, 0); message_lat = settings.GetString("myLatitude", currentLatitude.ToString()); message_lon = settings.GetString("myLongitude", currentLongitude.ToString()); message_off = settings.GetString("myOffset", offsetFromUtc.ToString()); userYear = settings.GetInt("myYear", userYear); userMonth = settings.GetInt("myMonth", userMonth); userDay = settings.GetInt("myDay", userDay); }
public override Dialog OnCreateDialog(Bundle state) { var time = Toggl.Phoebe.Time.Now; if (model != null && model.StartTime != DateTime.MinValue) { time = model.StartTime.ToLocalTime(); } var date = Toggl.Phoebe.Time.Now; if (model != null && model.StartTime != DateTime.MinValue) { date = model.StartTime.ToLocalTime().Date; } var view = LayoutInflater.From(Activity) .Inflate(Resource.Layout.ChangeTimeEntryStartTimeDialogFragment, null); TabsRadioGroup = view.FindViewById <RadioGroup> (Resource.Id.TabsRadioGroup); TimeTabRadioButton = view.FindViewById <RadioButton> (Resource.Id.TimeTabRadioButton).SetFont(Font.Roboto); DateTabRadioButton = view.FindViewById <RadioButton> (Resource.Id.DateTabRadioButton).SetFont(Font.Roboto); TimePicker = view.FindViewById <TimePicker> (Resource.Id.TimePicker); DatePicker = view.FindViewById <DatePicker> (Resource.Id.DatePicker); TabsRadioGroup.CheckedChange += OnTabsRadioGroupCheckedChange; TimePicker.CurrentHour = new Java.Lang.Integer(time.Hour); TimePicker.CurrentMinute = new Java.Lang.Integer(time.Minute); TimePicker.SetIs24HourView(new Java.Lang.Boolean( DateFormat.Is24HourFormat(ServiceContainer.Resolve <Context> ()))); TimePicker.TimeChanged += OnTimePickerTimeChanged; DatePicker.Init(date.Year, date.Month - 1, date.Day, this); Rebind(); var dia = new AlertDialog.Builder(Activity) .SetTitle(Resource.String.ChangeTimeEntryStartTimeDialogTitle) .SetView(view) .SetPositiveButton(Resource.String.ChangeTimeEntryStartTimeDialogOk, OnOkButtonClicked) .Create(); return(dia); }
private void SetupViews() { if (viewsSetup || !modelLoaded || TimePicker == null) { return; } viewsSetup = true; var time = GetInitialTime(); var date = GetInitialDate(); TimePicker.SetIs24HourView(new Java.Lang.Boolean( DateFormat.Is24HourFormat(ServiceContainer.Resolve <Context> ()))); TimePicker.CurrentHour = new Java.Lang.Integer(time.Hour); TimePicker.CurrentMinute = new Java.Lang.Integer(time.Minute); TimePicker.TimeChanged += OnTimePickerTimeChanged; DatePicker.Init(date.Year, date.Month - 1, date.Day, this); }
public override Android.App.Dialog OnCreateDialog(Android.OS.Bundle savedInstanceState) { int year = Arguments.GetInt(EXTRA_YEAR); int month = Arguments.GetInt(EXTRA_MONTH); int day = Arguments.GetInt(EXTRA_DAY); View v = Activity.LayoutInflater.Inflate(Resource.Layout.dialog_date, null); DatePicker datePicker = (DatePicker)v.FindViewById(Resource.Id.dialog_date_picker); datePicker.Init(year, month - 1, day, this); // .NET uses 1 based months, Android uses 0 based months return(new AlertDialog.Builder(Activity) .SetView(v) .SetTitle(Resource.String.date_picker_title) .SetPositiveButton(Android.Resource.String.Ok, (sender, e) => { Console.WriteLine("DatePicker OK Pressed"); SendResult((int)Result.Ok); }).Create()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.datepicker3); today = DateTime.Now; EditText surround = FindViewById <EditText>(Resource.Id.tempSurround); surround.TextChanged += new EventHandler <Android.Text.TextChangedEventArgs>(alterValue); EditText body = FindViewById <EditText>(Resource.Id.tempBody); body.TextChanged += new EventHandler <Android.Text.TextChangedEventArgs>(alterValue); EditText bweight = FindViewById <EditText>(Resource.Id.weightBody); bweight.TextChanged += new EventHandler <Android.Text.TextChangedEventArgs>(alterValue); TimePicker timeFound = FindViewById <TimePicker>(Resource.Id.timeFound); timeFound.SetIs24HourView(Java.Lang.Boolean.True); timeFound.TimeChanged += new EventHandler <TimePicker.TimeChangedEventArgs>(alterTime); DatePicker dater = FindViewById <DatePicker>(Resource.Id.dateDisplay); int monthFix = today.Month - 1; dater.Init(today.Year, monthFix, today.Day, new DateChangedListener((DatePicker, year, month, day) => { DateTime c = common.date; DateTime d = new DateTime(year, month + 1, day, c.Hour, c.Minute, 0); // fix as Android goes from 0 - 11 whereas .NET goes 1 - 12 common.date = d; })); CheckBox weight = FindViewById <CheckBox>(Resource.Id.weightBodyKG); weight.CheckedChange += new EventHandler <Android.Widget.CompoundButton.CheckedChangeEventArgs>(convertUnits); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // Currently in a layout without a container, so no reason to create our view. return(null); } View view = inflater.Inflate(Resource.Layout.Profile, container, false); view.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); RelativeLayout navBar = view.FindViewById <RelativeLayout>(Resource.Id.navbar_relative_layout); navBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); // setup the name section NickNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.firstname_background); ControlStyling.StyleBGLayer(NickNameLayer); NickNameText = NickNameLayer.FindViewById <EditText>(Resource.Id.nickNameText); ControlStyling.StyleTextField(NickNameText, RegisterStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); NickNameBGColor = ControlStylingConfig.BG_Layer_Color; NickNameText.InputType |= InputTypes.TextFlagCapWords; NickNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; View borderView = NickNameLayer.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); LastNameLayer = view.FindViewById <RelativeLayout>(Resource.Id.lastname_background); ControlStyling.StyleBGLayer(LastNameLayer); LastNameText = LastNameLayer.FindViewById <EditText>(Resource.Id.lastNameText); ControlStyling.StyleTextField(LastNameText, RegisterStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); LastNameBGColor = ControlStylingConfig.BG_Layer_Color; LastNameText.InputType |= InputTypes.TextFlagCapWords; LastNameText.AfterTextChanged += (sender, e) => { Dirty = true; }; // setup the contact section EmailLayer = view.FindViewById <RelativeLayout>(Resource.Id.email_background); ControlStyling.StyleBGLayer(EmailLayer); EmailBGColor = ControlStylingConfig.BG_Layer_Color; EmailField = EmailLayer.FindViewById <EditText>(Resource.Id.emailAddressText); ControlStyling.StyleTextField(EmailField, ProfileStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); EmailField.AfterTextChanged += (sender, e) => { Dirty = true; }; View backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.cellphone_background); ControlStyling.StyleBGLayer(backgroundView); borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CellPhoneField = backgroundView.FindViewById <EditText>(Resource.Id.cellPhoneText); ControlStyling.StyleTextField(CellPhoneField, ProfileStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CellPhoneField.AfterTextChanged += (sender, e) => { Dirty = true; }; CellPhoneField.AddTextChangedListener(new PhoneNumberFormattingTextWatcher()); // setup the address section backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.address_background); ControlStyling.StyleBGLayer(backgroundView); StreetField = backgroundView.FindViewById <EditText>(Resource.Id.streetAddressText); ControlStyling.StyleTextField(StreetField, ProfileStrings.StreetPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StreetField.AfterTextChanged += (sender, e) => { Dirty = true; }; StreetField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.street_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); CityField = backgroundView.FindViewById <EditText>(Resource.Id.cityAddressText); ControlStyling.StyleTextField(CityField, ProfileStrings.CityPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CityField.AfterTextChanged += (sender, e) => { Dirty = true; }; CityField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.city_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); StateField = backgroundView.FindViewById <EditText>(Resource.Id.stateAddressText); ControlStyling.StyleTextField(StateField, ProfileStrings.StatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); StateField.AfterTextChanged += (sender, e) => { Dirty = true; }; StateField.InputType |= InputTypes.TextFlagCapWords; borderView = backgroundView.FindViewById <View>(Resource.Id.state_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); ZipField = backgroundView.FindViewById <EditText>(Resource.Id.zipAddressText); ControlStyling.StyleTextField(ZipField, ProfileStrings.ZipPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); ZipField.AfterTextChanged += (sender, e) => { Dirty = true; }; // personal backgroundView = view.FindViewById <RelativeLayout>(Resource.Id.personal_background); ControlStyling.StyleBGLayer(backgroundView); BirthdateField = backgroundView.FindViewById <EditText>(Resource.Id.birthdateText); ControlStyling.StyleTextField(BirthdateField, ProfileStrings.BirthdatePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); BirthdateField.FocusableInTouchMode = false; BirthdateField.Focusable = false; Button birthdateButton = backgroundView.FindViewById <Button>(Resource.Id.birthdateButton); birthdateButton.Click += (object sender, EventArgs e) => { // setup the initial date to use ( either now, or the date in the field ) DateTime initialDateTime = DateTime.Now; if (string.IsNullOrWhiteSpace(BirthdateField.Text) == false) { initialDateTime = DateTime.Parse(BirthdateField.Text); } // build our LayoutInflater dateInflate = LayoutInflater.From(Activity); DatePicker newPicker = (DatePicker)dateInflate.Inflate(Resource.Layout.DatePicker, null); newPicker.Init(initialDateTime.Year, initialDateTime.Month - 1, initialDateTime.Day, this); Dialog dialog = new Dialog(Activity); dialog.AddContentView(newPicker, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); dialog.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Gender GenderField = view.FindViewById <EditText>(Resource.Id.genderText); ControlStyling.StyleTextField(GenderField, ProfileStrings.GenderPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); GenderField.FocusableInTouchMode = false; GenderField.Focusable = false; Button genderButton = backgroundView.FindViewById <Button>(Resource.Id.genderButton); genderButton.Click += (object sender, EventArgs e) => { AlertDialog.Builder builder = new AlertDialog.Builder(Activity); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(RockLaunchData.Instance.Data.Genders[1]), new Java.Lang.String(RockLaunchData.Instance.Data.Genders[2]), }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { GenderField.Text = RockLaunchData.Instance.Data.Genders[clickArgs.Which + 1]; Dirty = true; }); }); builder.Show( ); }; borderView = backgroundView.FindViewById <View>(Resource.Id.campus_middle_border); borderView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); // Campus CampusField = view.FindViewById <EditText>(Resource.Id.campusText); ControlStyling.StyleTextField(CampusField, ProfileStrings.CampusPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize); CampusField.FocusableInTouchMode = false; CampusField.Focusable = false; Button campusButton = backgroundView.FindViewById <Button>(Resource.Id.campusButton); campusButton.Click += (object sender, EventArgs e) => { // build an alert dialog containing all the campus choices AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SelectCampus_SourceTitle); Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[RockLaunchData.Instance.Data.Campuses.Count]; for (int i = 0; i < RockLaunchData.Instance.Data.Campuses.Count; i++) { campusStrings[i] = new Java.Lang.String(RockLaunchData.Instance.Data.Campuses[i].Name); } // launch the dialog, and on selection, update the viewing campus text. builder.SetItems(campusStrings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { int campusIndex = clickArgs.Which; CampusField.Text = RockLaunchData.Instance.Data.Campuses[campusIndex].Name; Dirty = true; }); }); builder.Show( ); }; // Done buttons DoneButton = view.FindViewById <Button>(Resource.Id.doneButton); ControlStyling.StyleButton(DoneButton, ProfileStrings.DoneButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton = view.FindViewById <Button>(Resource.Id.logoutButton); ControlStyling.StyleButton(LogoutButton, ProfileStrings.LogoutButtonTitle, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize); LogoutButton.Background = null; DoneButton.Click += (object sender, EventArgs e) => { if (Dirty == true) { if (ValidateInput( )) { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.SubmitChangesTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No), new Java.Lang.String(GeneralStrings.Cancel) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: SubmitChanges( ); SpringboardParent.ModalFragmentDone(null); break; case 1: SpringboardParent.ModalFragmentDone(null); break; case 2: break; } }); }); builder.Show( ); } } else { SpringboardParent.ModalFragmentDone(null); } }; LogoutButton.Click += (object sender, EventArgs e) => { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder(Activity); builder.SetTitle(ProfileStrings.LogoutTitle); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String(GeneralStrings.Yes), new Java.Lang.String(GeneralStrings.No) }; builder.SetItems(strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { switch (clickArgs.Which) { case 0: RockMobileUser.Instance.LogoutAndUnbind( ); SpringboardParent.ModalFragmentDone(null); break; case 1: break; } }); }); builder.Show( ); }; // blocker and result views ScrollView = view.FindViewById <LockableScrollView>(Resource.Id.scroll_view); ScrollView.ScrollEnabled = false; // scroll to the top ScrollView.Post(new Action(delegate { ScrollView.ForceScrollTo(0, 0); })); RelativeLayout parentLayout = view.FindViewById <RelativeLayout>(Resource.Id.relative_layout); RectangleF bounds = new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels); BlockerView = new UIBlockerView(parentLayout, bounds); BlockerView.Hide( ); ResultView = new UIResultView(parentLayout, bounds, delegate { SpringboardParent.ModalFragmentDone(null); }); ResultView.Hide( ); return(view); }
private static void SelectedDateMemberAttached(DatePicker picker, MemberAttachedEventArgs memberAttachedEventArgs) { picker.Init(picker.Year, picker.Month, picker.DayOfMonth, DateChangedListener.Instance); }
//called by onCreate to initialize the datePickers private void DatePickerInit(DatePicker DatePckr) { DateChangedListener dateChangedListener = new DateChangedListener(); DatePckr.Init(2018, 4, 21, dateChangedListener); }
private void Init() { wantToday = true; inputLatitude = (EditText)FindViewById(Resource.Id.input_latitude); inputLatitude.Text = ("" + message_lat); inputLatitude.ImeOptions = ImeAction.Done; inputLongitude = (EditText)FindViewById(Resource.Id.input_longitude); inputLongitude.Text = ("" + message_lon); inputLongitude.ImeOptions = ImeAction.Done; inputOffset = (EditText)FindViewById(Resource.Id.input_offset); inputOffset.Text = ("" + message_off); inputOffset.ImeOptions = ImeAction.Done; currentLocation = (Button)FindViewById(Resource.Id.current_loc); currentLocation.Click += delegate { inputLatitude.Text = ("" + currentLatitude); inputLongitude.Text = ("" + currentLongitude); inputOffset.Text = ("" + offsetFromUtc); ColorStateList mList = currentLocation.TextColors; int color = mList.DefaultColor; if (color.Equals(Color.Red)) { currentLocation.SetTextColor(Color.Black); } }; currentDate = (Button)FindViewById(Resource.Id.current_date); currentDate.Click += delegate { datepicker.UpdateDate(current_cal.Get(CalendarField.Year), current_cal.Get(CalendarField.Month), current_cal.Get(CalendarField.DayOfMonth)); ColorStateList mList = currentDate.TextColors; int color = mList.DefaultColor; if (color.Equals(Color.Red)) { currentDate.SetTextColor(Color.Black); } }; findMyLocation = FindViewById <Button>(Resource.Id.findMyLoc); findMyLocation.Click += delegate { FragmentManager fm = FragmentManager; FindMyLocation findMyLocation = new FindMyLocation(); findMyLocation.Show(fm, "123"); }; about = FindViewById <Button>(Resource.Id.about_atime); about.Click += delegate { FragmentManager fm = FragmentManager; AboutFragment aboutFragment = new AboutFragment(); aboutFragment.Show(fm, "123"); }; submit = (Button)FindViewById(Resource.Id.submit); submit.Click += delegate { SendData(); }; datepicker = FindViewById <DatePicker>(Resource.Id.datePicker_1); datepicker.Init(userYear, userMonth, userDay, null); bool result = CheckBeforeStore(message_lat, message_lon, message_off); if (!result) { return; } double userLatitude = Double.ParseDouble(message_lat); double userLongitude = Double.ParseDouble(message_lon); double userOffset = Double.ParseDouble(message_off); if (Math.Abs(currentLatitude - userLatitude) > 0.01 || Math.Abs(currentLongitude - userLongitude) > 0.01 || Math.Abs(offsetFromUtc - userOffset) > 0.1) { currentLocation.SetTextColor(Color.Red); } if (userYear != current_cal.Get(CalendarField.Year) || userMonth != current_cal.Get(CalendarField.Month) || userDay != current_cal.Get(CalendarField.DayOfMonth)) { currentDate.SetTextColor(Color.Red); } }