public AlertDialog.Builder SetNegativeButton(Java.Lang.ICharSequence text, EventHandler <Android.Content.DialogClickEventArgs> handler) { return(SetNegativeButton(text, new IDialogInterfaceOnClickListenerImplementor() { Handler = handler })); }
public void SetButton(int whichButton, Java.Lang.ICharSequence text, EventHandler <Android.Content.DialogClickEventArgs> handler) { SetButton(whichButton, text, new IDialogInterfaceOnClickListenerImplementor() { Handler = handler }); }
/// <summary> /// Builds a new layout with the specified parameters. /// </summary> public LayoutBuilder( Java.Lang.ICharSequence textFormatted, TextPaint paint, TextUtils.TruncateAt ellipsize, Android.Text.Layout.Alignment layoutAlignment, TextWrapping textWrapping, int maxLines, Size availableSize, bool exactWidth, float lineHeight, LineStackingStrategy lineStackingStrategy, LayoutBuilder existingBuilder ) { _textFormatted = textFormatted; _paint = paint; _ellipsize = ellipsize; _layoutAlignment = layoutAlignment; _textWrapping = textWrapping; _maxLines = maxLines; AvailableSize = availableSize; _exactWidth = exactWidth; _lineHeight = lineHeight; _lineStackingStrategy = lineStackingStrategy; Layout = existingBuilder?.Layout; _metrics = existingBuilder?._metrics; }
public unsafe SpannableString(Java.Lang.ICharSequence source) : base(IntPtr.Zero, JniHandleOwnership.DoNotTransfer) { if (Handle != IntPtr.Zero) { return; } IntPtr native_source = CharSequence.ToLocalJniHandle(source); try { JValue *__args = stackalloc JValue [1]; __args [0] = new JValue(native_source); if (GetType() != typeof(SpannableString)) { SetHandle( global::Android.Runtime.JNIEnv.StartCreateInstance(GetType(), "(Ljava/lang/CharSequence;)V", __args), JniHandleOwnership.TransferLocalRef); global::Android.Runtime.JNIEnv.FinishCreateInstance(Handle, "(Ljava/lang/CharSequence;)V", __args); return; } if (id_ctor_Ljava_lang_CharSequence_ == IntPtr.Zero) { id_ctor_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID(class_ref, "<init>", "(Ljava/lang/CharSequence;)V"); } SetHandle( global::Android.Runtime.JNIEnv.StartCreateInstance(class_ref, id_ctor_Ljava_lang_CharSequence_, __args), JniHandleOwnership.TransferLocalRef); JNIEnv.FinishCreateInstance(Handle, class_ref, id_ctor_Ljava_lang_CharSequence_, __args); } finally { JNIEnv.DeleteLocalRef(native_source); } }
async Task <List <PlaceInfo> > getAutocomplete(Java.Lang.ICharSequence constraint) { if (Adapter.googleApiClient.IsConnected) { // Submit the query to the autocomplete API and await the results when the query completes. var autocompletePredictions = await PlacesClass.GeoDataApi.GetAutocompletePredictionsAsync( Adapter.googleApiClient, constraint.ToString(), Adapter.bounds, Adapter.autoCompleteFilter); // Confirm that the query completed successfully, otherwise return null if (!autocompletePredictions.Status.IsSuccess) { autocompletePredictions.Release(); return(null); } // Copy the results into our own list, because we can't hold onto the buffer var list = autocompletePredictions.Select(p => new PlaceInfo { PlaceId = p.PlaceId, Description = p.Description }) .ToList(); // Release the buffer now that all data has been copied. autocompletePredictions.Release(); return(list); } return(null); }
public void AddAttachmentTitle(Java.Lang.ICharSequence text) { var label = MessageCellSubviews.GetAttachmentTitleLabel(this); label.SetText(text, TextView.BufferType.Spannable); AddView(label); }
protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int lengthBefore, int lengthAfter) { if (!_isRunningTextChanged && _isInitialized) { // The Text property cannot be overriden, so we can't prevent this method from being called even if // the content really has not changed... try { _isRunningTextChanged = true; base.OnTextChanged(text, start, lengthBefore, lengthAfter); if (IsStoreInitialized) { // OnTextChanged is called before the ctor has been executed... NotifyTextChanged(); } } finally { _isRunningTextChanged = false; } } }
static void n_SetTitle_Ljava_lang_CharSequence_(IntPtr jnienv, IntPtr native__this, IntPtr native_p0) { ActionMode __this = Java.Lang.Object.GetObject <ActionMode> (native__this, JniHandleOwnership.DoNotTransfer); Java.Lang.ICharSequence p0 = Java.Lang.Object.GetObject <Java.Lang.ICharSequence> (native_p0, JniHandleOwnership.DoNotTransfer); __this.TitleFormatted = p0; }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { if (_originalItems == null) { _originalItems = GetItemsToFilter(); } var filterResults = new FilterResults(); if (constraint == null) { return(filterResults); } var results = new List <T>(); if (_originalItems != null && _originalItems.Count > 0) { var constraintString = constraint.ToString(); if (constraintString != null) { results.AddRange(PerformSearch(constraintString)); } } filterResults.Values = FromArray(results.Select(r => r.ToJavaObject()).ToArray()); filterResults.Count = results.Count; constraint.Dispose(); return(filterResults); }
public override Java.Lang.ICharSequence FilterFormatted(Java.Lang.ICharSequence source, int start, int end, ISpanned dest, int dstart, int dend) { for (var x = start; x < end; x++) { if (char.IsUpper(source.ElementAt(x))) { var v = new char[end - start]; TextUtils.GetChars(source.ToString(), start, end, v, 0); var s = new string(v).ToLower(CultureInfo.InvariantCulture); if (source is ISpanned sourceSpanned) { var sp = new SpannableString(s); TextUtils.CopySpansFrom(sourceSpanned, start, end, null, sp, 0); return(sp); } else { return(new Java.Lang.String(s)); } } } return(null); }
protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int before, int after) { base.OnTextChanged(text, start, before, after); if (IsFocused) { ClearIconVisible = Text != string.Empty; } }
public Java.Lang.ICharSequence FilterFormatted(Java.Lang.ICharSequence source, int start, int end, ISpanned dest, int dstart, int dend) { if (System.Text.RegularExpressions.Regex.IsMatch(dest.ToString(), regex)) { return(new Java.Lang.String(string.Empty)); } return(null); }
public new CustomAlertDialog SetMessage(Java.Lang.ICharSequence message) { TextView textView = _layout.FindViewById <TextView>(Resource.Id.customDialogMessageTextView); textView.MovementMethod = LinkMovementMethod.Instance; textView.TextFormatted = message.Trim(); return(this); }
/// <summary> /// Determines if substring of <paramref name="s"/> should be turned into a link. /// </summary> /// <param name="s">A string.</param> /// <param name="start">A start index.</param> /// <param name="end">An end index.</param> /// <returns> /// <b>true</b> - if substring between start and end indexes should be turned into a link; otherwise - <b>false</b>. /// </returns> public bool AcceptMatch(Java.Lang.ICharSequence s, int start, int end) { if (Patterns.IpAddress.Matcher(s.SubSequenceFormatted(start, end)).Matches()) { return(false); } return(true); }
protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int lengthBefore, int lengthAfter) { base.OnTextChanged(text, start, lengthBefore, lengthAfter); if (IsFocused) { SetClearIconVisible(!string.IsNullOrEmpty(Text)); } }
partial void OnTextChangedPartial() { _textFormatted = null; if (AutomationConfiguration.IsAccessibilityEnabled) { ContentDescription = UIAutomationText; } }
public override void SetText(Java.Lang.ICharSequence text, TextView.BufferType type) { base.SetText(text, type); if (text != null && text.Length() > 0) { SetSelection(text.Length()); } }
protected override void PublishResults(Java.Lang.ICharSequence constraint, Filter.FilterResults results) { using (var values = results.Values) _adapter.Mitems = values.ToArray <Object>() .Select(r => r.ToNetObject <TaskOutboxModel>()).ToList(); _adapter.NotifyDataSetChanged(); }
protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int lengthBefore, int lengthAfter) { base.OnTextChanged(text, start, lengthBefore, lengthAfter); if (lengthBefore == 0 || lengthAfter == 0) { UpdatePadding(); } }
void ITextWatcher.BeforeTextChanged(Java.Lang.ICharSequence s, int start, int before, int after) { var h = BeforeTextChanged; if (h != null) { h(inst, new TextChangedEventArgs(s, start, before, after)); } }
void ITextWatcher.OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count) { var h = TextChanged; if (h != null) { h(inst, new TextChangedEventArgs(s, start, before, count)); } }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { var returnObj = new FilterResults(); ICursor newCursor = dbb.ReadableDatabase.RawQuery("select * from Vendors where vname like :constrStr ", new string[] { "%" + constraint.ToString() + "%" }); returnObj.Values = (Java.Lang.Object)newCursor; returnObj.Count = newCursor.Count; return(returnObj); }
private void UpdateTextFormatted() { if (_textFormatted != null) { return; } _textFormatted = GetTextFormatted(); }
static IntPtr n_AddSubMenu_Ljava_lang_CharSequence_(IntPtr jnienv, IntPtr native__this, IntPtr native_p0) { IMenu __this = Java.Lang.Object.GetObject <IMenu> (native__this, JniHandleOwnership.DoNotTransfer); Java.Lang.ICharSequence p0 = Java.Lang.Object.GetObject <Java.Lang.ICharSequence> (native_p0, JniHandleOwnership.DoNotTransfer); IntPtr __ret = JNIEnv.ToLocalJniHandle(__this.AddSubMenu(p0)); return(__ret); }
protected override void PublishResults(Java.Lang.ICharSequence constraint, FilterResults results) { adapter.cursor = (ICursor)results.Values; adapter.ChangeCursor((ICursor)results.Values); //adapter.NotifyDataSetChanged (); constraint.Dispose(); results.Dispose(); }
static IntPtr n_Add_IIILjava_lang_CharSequence_(IntPtr jnienv, IntPtr native__this, int p0, int p1, int p2, IntPtr native_p3) { IMenu __this = Java.Lang.Object.GetObject <IMenu> (native__this, JniHandleOwnership.DoNotTransfer); Java.Lang.ICharSequence p3 = Java.Lang.Object.GetObject <Java.Lang.ICharSequence> (native_p3, JniHandleOwnership.DoNotTransfer); IntPtr __ret = JNIEnv.ToLocalJniHandle(__this.Add(p0, p1, p2, p3)); return(__ret); }
public override void OnAuthenticationError(int errMsgId, Java.Lang.ICharSequence errString) { if (!mSelfCancelled) { ShowError(errString.ToString()); mIcon.PostDelayed(() => { mCallback.OnError(); }, ERROR_TIMEOUT_MILLIS); } }
protected override void OnTextChanged(Java.Lang.ICharSequence text, int start, int before, int after) { if (this.Text != text.ToString()) { } else { base.OnTextChanged(text, start, before, after); } }
public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count) { if (string.IsNullOrEmpty(base.Element.Text) && s.Length() == 0) { return; } Validate(s.ToString()); (base.Element as IElementController).SetValueFromRenderer(FloatingTextEntry.TextProperty, s.ToString()); }
protected override FilterResults PerformFiltering(Java.Lang.ICharSequence constraint) { var results = new FilterResults(); var count = adapter.PerformFiltering(constraint?.ToString()); results.Count = count; return(results); }
public static Java.Lang.ICharSequence[] ArrayFromStringArray(string[] val) { if (val == null) return null; Java.Lang.ICharSequence[] ret = new Java.Lang.ICharSequence [val.Length]; for (int i = 0; i < val.Length; i++) ret [i] = new Java.Lang.String (val [i]); return ret; }
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.Register, container, false); view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); view.SetOnTouchListener( this ); RelativeLayout layoutView = view.FindViewById<RelativeLayout>( Resource.Id.scroll_linear_background ); ProgressBarBlocker = view.FindViewById<RelativeLayout>( Resource.Id.progressBarBlocker ); ProgressBarBlocker.Visibility = ViewStates.Gone; ProgressBarBlocker.LayoutParameters = new RelativeLayout.LayoutParams( 0, 0 ); ProgressBarBlocker.LayoutParameters.Width = NavbarFragment.GetFullDisplayWidth( ); ProgressBarBlocker.LayoutParameters.Height = this.Resources.DisplayMetrics.HeightPixels; ResultView = new UIResultView( layoutView, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), OnResultViewDone ); RelativeLayout navBar = view.FindViewById<RelativeLayout>( Resource.Id.navbar_relative_layout ); navBar.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); // setup the username UserNameLayer = view.FindViewById<RelativeLayout>( Resource.Id.username_background ); ControlStyling.StyleBGLayer( UserNameLayer ); UserNameText = UserNameLayer.FindViewById<EditText>( Resource.Id.userNameText ); ControlStyling.StyleTextField( UserNameText, RegisterStrings.UsernamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); UserNameBGColor = ControlStylingConfig.BG_Layer_Color; UserNameText.InputType |= InputTypes.TextFlagCapWords; View borderView = UserNameLayer.FindViewById<View>( Resource.Id.username_border ); borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); // password PasswordLayer = view.FindViewById<RelativeLayout>( Resource.Id.password_background ); ControlStyling.StyleBGLayer( PasswordLayer ); PasswordText = PasswordLayer.FindViewById<EditText>( Resource.Id.passwordText ); PasswordText.InputType |= InputTypes.TextVariationPassword; ControlStyling.StyleTextField( PasswordText, RegisterStrings.PasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); PasswordBGColor = ControlStylingConfig.BG_Layer_Color; borderView = PasswordLayer.FindViewById<View>( Resource.Id.password_border ); borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); ConfirmPasswordLayer = view.FindViewById<RelativeLayout>( Resource.Id.confirmPassword_background ); ControlStyling.StyleBGLayer( ConfirmPasswordLayer ); ConfirmPasswordText = ConfirmPasswordLayer.FindViewById<EditText>( Resource.Id.confirmPasswordText ); ConfirmPasswordText.InputType |= InputTypes.TextVariationPassword; ControlStyling.StyleTextField( ConfirmPasswordText, RegisterStrings.ConfirmPasswordPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); ConfirmPasswordBGColor = ControlStylingConfig.BG_Layer_Color; // 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; 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; // setup the cell phone section CellPhoneLayer = view.FindViewById<RelativeLayout>( Resource.Id.cellphone_background ); ControlStyling.StyleBGLayer( CellPhoneLayer ); CellPhoneText = CellPhoneLayer.FindViewById<EditText>( Resource.Id.cellPhoneText ); ControlStyling.StyleTextField( CellPhoneText, RegisterStrings.CellPhonePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); CellPhoneText.AddTextChangedListener(new PhoneNumberFormattingTextWatcher()); // email layer EmailLayer = view.FindViewById<RelativeLayout>( Resource.Id.email_background ); ControlStyling.StyleBGLayer( EmailLayer ); borderView = EmailLayer.FindViewById<View>( Resource.Id.middle_border ); borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); EmailText = EmailLayer.FindViewById<EditText>( Resource.Id.emailAddressText ); ControlStyling.StyleTextField( EmailText, RegisterStrings.EmailPlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); EmailBGColor = ControlStylingConfig.BG_Layer_Color; // Register button RegisterButton = view.FindViewById<Button>( Resource.Id.registerButton ); ControlStyling.StyleButton( RegisterButton, RegisterStrings.RegisterButton, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize ); CancelButton = view.FindViewById<Button>( Resource.Id.cancelButton ); ControlStyling.StyleButton( CancelButton, GeneralStrings.Cancel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize ); CancelButton.Background = null; RegisterButton.Click += (object sender, EventArgs e) => { RegisterUser( ); }; CancelButton.Click += (object sender, EventArgs e) => { // Since they made changes, confirm they want to save them. AlertDialog.Builder builder = new AlertDialog.Builder( Activity ); builder.SetTitle( RegisterStrings.ConfirmCancelReg ); 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: SpringboardParent.ModalFragmentDone( null ); break; case 1: break; } }); }); builder.Show( ); }; return view; }
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 RelativeLayout backgroundView = view.FindViewById<RelativeLayout>( Resource.Id.name_background ); ControlStyling.StyleBGLayer( backgroundView ); NickNameField = backgroundView.FindViewById<EditText>( Resource.Id.nickNameText ); ControlStyling.StyleTextField( NickNameField, ProfileStrings.NickNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); NickNameField.AfterTextChanged += (sender, e) => { Dirty = true; }; NickNameField.InputType |= InputTypes.TextFlagCapWords; View borderView = backgroundView.FindViewById<View>( Resource.Id.middle_border ); borderView.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); LastNameField = backgroundView.FindViewById<EditText>( Resource.Id.lastNameText ); ControlStyling.StyleTextField( LastNameField, ProfileStrings.LastNamePlaceholder, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize ); LastNameField.AfterTextChanged += (sender, e) => { Dirty = true; }; LastNameField.InputType |= InputTypes.TextFlagCapWords; // 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; }; 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; }; 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; }; 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; }; 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.IsNullOrEmpty( 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( RockGeneralData.Instance.Data.Genders[ 1 ] ), new Java.Lang.String( RockGeneralData.Instance.Data.Genders[ 2 ] ), }; builder.SetItems( strings, delegate(object s, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { GenderField.Text = RockGeneralData.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[ RockGeneralData.Instance.Data.Campuses.Count ]; for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ ) { campusStrings[ i ] = new Java.Lang.String( RockGeneralData.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 = RockGeneralData.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( ); }; return view; }
void ManageProfilePic( ) { // only allow picture taking if they're logged in if( RockMobileUser.Instance.LoggedIn && NavbarFragment.ShouldSpringboardAllowInput( ) ) { // setup the chooser dialog so they can pick the photo source AlertDialog.Builder builder = new AlertDialog.Builder( Activity ); builder.SetTitle( SpringboardStrings.ProfilePicture_SourceTitle ); Java.Lang.ICharSequence [] strings = new Java.Lang.ICharSequence[] { new Java.Lang.String( SpringboardStrings.ProfilePicture_SourcePhotoLibrary ), new Java.Lang.String( SpringboardStrings.ProfilePicture_SourceCamera ), new Java.Lang.String( GeneralStrings.Cancel ) }; builder.SetItems( strings, delegate(object sender, DialogClickEventArgs clickArgs) { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { switch( clickArgs.Which ) { // Photo Library case 0: { Rock.Mobile.Media.PlatformImagePicker.Instance.PickImage( Rock.Mobile.PlatformSpecific.Android.Core.Context, delegate(object s, Rock.Mobile.Media.PlatformImagePicker.ImagePickEventArgs args) { // android returns a path TO the image if( args.Image != null ) { ImageCropperPendingFilePath = (string) args.Image; } }); break; } // Camera case 1: { if( Rock.Mobile.Media.PlatformCamera.Instance.IsAvailable( ) ) { // start up the camera and get our picture. // JHM 4-24-15 - The camera requires an SD Card, so use that path for our temp file. // JHM 8-31-15 - We can't use Environment.GetFolderPath because Android cameras won't save to it. Java.IO.File externalDir = Rock.Mobile.PlatformSpecific.Android.Core.Context.GetExternalFilesDir( null ); if( externalDir != null ) { string jpgFilename = externalDir.ToString( ) + "cameratemp.jpg"; Rock.Mobile.Media.PlatformCamera.Instance.CaptureImage( new Java.IO.File( jpgFilename ), null, delegate(object s, Rock.Mobile.Media.PlatformCamera.CaptureImageEventArgs args) { // flag that we want the cropper to start up on resume. // we cannot launch it now because we need to wait for the camera // activity to end and the navBar fragment to resume if( args.Result == true ) { // if the image path is valid, we have a picture. // Otherwise, they pressed cancel, so don't do anything. if( args.ImagePath != null ) { ImageCropperPendingFilePath = args.ImagePath; } } else { // couldn't get the picture DisplayError( SpringboardStrings.ProfilePicture_Error_Title, SpringboardStrings.ProfilePicture_Error_Message ); } }); } else { // error accessing their storage. no dice. DisplayError( SpringboardStrings.ExternalDir_Error_Title, SpringboardStrings.ExternalDir_Error_Message ); } } else { // nope DisplayError( SpringboardStrings.Camera_Error_Title, SpringboardStrings.Camera_Error_Message ); } break; } // Cancel case 2: { break; } } }); }); builder.Show( ); } }
public void SelectCampus(object sender, EventArgs e ) { // build an alert dialog containing all the campus choices AlertDialog.Builder builder = new AlertDialog.Builder( Activity ); Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[ RockGeneralData.Instance.Data.Campuses.Count ]; for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ ) { campusStrings[ i ] = new Java.Lang.String( App.Shared.Network.RockGeneralData.Instance.Data.Campuses[ i ].Name ); } builder.SetTitle( new Java.Lang.String( SpringboardStrings.SelectCampus_SourceTitle ) ); // 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 { // get the ID for the campus they selected string campusTitle = campusStrings[ clickArgs.Which ].ToString( ); RockMobileUser.Instance.ViewingCampus = RockGeneralData.Instance.Data.CampusNameToId( campusTitle ); // build a label showing what they picked RefreshCampusSelection( ); }); }); builder.Show( ); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // grab our resource file View view = inflater.Inflate(Resource.Layout.Springboard, container, false); // let the springboard elements setup their buttons foreach( SpringboardElement element in Elements ) { element.OnCreateView( view ); element.Button.SetOnTouchListener( this ); } view.SetOnTouchListener( this ); view.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_BackgroundColor ) ); // set the task we wish to have active ActivateElement( Elements[ ActiveElementIndex ] ); // setup our profile pic button, which displays either their profile picture or an icon if they're not logged in / don't have a pic ProfileImageButton = view.FindViewById<Button>( Resource.Id.springboard_profile_image ); ProfileImageButton.Click += (object sender, EventArgs e) => { // if we're logged in, manage their profile pic if( RockMobileUser.Instance.LoggedIn == true ) { ManageProfilePic( ); } else { // otherwise, use it to let them log in StartModalFragment( LoginFragment ); } }; Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary ); ProfileImageButton.SetTypeface( fontFace, TypefaceStyle.Normal ); ProfileImageButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.ProfileSymbolFontSize ); ProfileImageButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); ProfileImageButton.LayoutParameters.Width = (int)Rock.Mobile.Graphics.Util.UnitToPx( 140 ); ProfileImageButton.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx( 140 ); ProfileImageButton.SetBackgroundColor( Color.Transparent ); // create and add a simple circle to border the image RelativeLayout layout = view.FindViewById<RelativeLayout>( Resource.Id.springboard_profile_image_layout ); layout.SetBackgroundColor( Color.Transparent ); CircleView circle = new Rock.Mobile.PlatformSpecific.Android.Graphics.CircleView( Activity.BaseContext ); //note: these are converted from dp to pixels, so don't do it here. circle.StrokeWidth = 4; circle.Color = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ); circle.SetBackgroundColor( Color.Transparent ); circle.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (RelativeLayout.LayoutParams)circle.LayoutParameters ).AddRule( LayoutRules.CenterInParent ); circle.LayoutParameters.Width = (int)Rock.Mobile.Graphics.Util.UnitToPx( 150 ); circle.LayoutParameters.Height = (int)Rock.Mobile.Graphics.Util.UnitToPx( 150 ); layout.AddView( circle ); // setup our login button LoginProfileButton = view.FindViewById<Button>( Resource.Id.springboard_login_button ); LoginProfileButton.Click += (object sender, EventArgs e) => { // if we're logged in, it'll be the profile one if( RockMobileUser.Instance.LoggedIn == true ) { StartModalFragment( ProfileFragment ); } else { // else it'll be the login one StartModalFragment( LoginFragment ); } }; // setup the textView for rendering either "Tap to Personalize" or "View Profile" ViewProfileLabel = view.FindViewById<TextView>( Resource.Id.view_profile ); ViewProfileLabel.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); ViewProfileLabel.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal ); ViewProfileLabel.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); // get the size of the display. We will use this rather than Resources.DeviceManager because this // is absolute and won't change based on orientation Point displaySize = new Point( ); Activity.WindowManager.DefaultDisplay.GetSize( displaySize ); float displayWidth = displaySize.X; float revealPercent = MainActivity.IsLandscapeWide( ) ? PrivatePrimaryNavBarConfig.Landscape_RevealPercentage_Android : PrivatePrimaryNavBarConfig.Portrait_RevealPercentage_Android; // setup the width of the springboard area and campus selector ProfileContainer = view.FindViewById<LinearLayout>( Resource.Id.springboard_profile_image_container ); ProfileContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent ); // setup the textView for rendering the user's name when they're logged in "Welcome: Jered" ProfilePrefix = view.FindViewById<TextView>( Resource.Id.profile_prefix ); ProfilePrefix.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Light ), TypefaceStyle.Normal ); ProfilePrefix.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize ); ProfilePrefix.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); ProfilePrefix.Text = SpringboardStrings.LoggedIn_Prefix; ProfilePrefix.Measure( 0, 0 ); ProfileName = view.FindViewById<TextView>( Resource.Id.profile_name ); ProfileName.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); ProfileName.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); ProfileName.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize ); ProfileName.SetMaxLines( 1 ); ProfileName.Ellipsize = Android.Text.TextUtils.TruncateAt.End; CampusContainer = view.FindViewById<View>( Resource.Id.campus_container ); CampusContainer.LayoutParameters.Width = (int) ( displayWidth * revealPercent ); CampusContainer.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_BackgroundColor ) ); View seperator = view.FindViewById<View>( Resource.Id.end_seperator ); seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); // setup the bottom campus / settings selector CampusText = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_text ); CampusText.Ellipsize = Android.Text.TextUtils.TruncateAt.End; CampusText.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); CampusText.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); CampusText.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); CampusText.SetSingleLine( ); TextView settingsIcon = CampusContainer.FindViewById<TextView>( Resource.Id.campus_selection_icon ); settingsIcon.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary ), TypefaceStyle.Normal ); settingsIcon.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Springboard_InActiveElementTextColor ) ); settingsIcon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.CampusSelectSymbolSize ); settingsIcon.Text = PrivateSpringboardConfig.CampusSelectSymbol; // set the campus text to whatever their profile has set for viewing. CampusText.Text = string.Format( SpringboardStrings.Viewing_Campus, RockGeneralData.Instance.Data.CampusIdToName( RockMobileUser.Instance.ViewingCampus ) ).ToUpper( ); // setup the campus selection button. Button campusSelectionButton = CampusContainer.FindViewById<Button>( Resource.Id.campus_selection_button ); campusSelectionButton.Click += (object sender, EventArgs e ) => { // build an alert dialog containing all the campus choices AlertDialog.Builder builder = new AlertDialog.Builder( Activity ); Java.Lang.ICharSequence [] campusStrings = new Java.Lang.ICharSequence[ RockGeneralData.Instance.Data.Campuses.Count ]; for( int i = 0; i < RockGeneralData.Instance.Data.Campuses.Count; i++ ) { campusStrings[ i ] = new Java.Lang.String( App.Shared.Network.RockGeneralData.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 { // get the ID for the campus they selected string campusTitle = campusStrings[ clickArgs.Which ].ToString( ); RockMobileUser.Instance.ViewingCampus = RockGeneralData.Instance.Data.CampusNameToId( campusTitle ); // build a label showing what they picked RefreshCampusSelection( ); }); }); builder.Show( ); }; Billboard = new NotificationBillboard( displayWidth, Rock.Mobile.PlatformSpecific.Android.Core.Context ); Billboard.SetLabel( SpringboardStrings.TakeNotesNotificationIcon, PrivateControlStylingConfig.Icon_Font_Primary, ControlStylingConfig.Small_FontSize, SpringboardStrings.TakeNotesNotificationLabel, ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize, ControlStylingConfig.TextField_ActiveTextColor, ControlStylingConfig.Springboard_Element_SelectedColor, delegate { // find the Notes task, activate it, and tell it to jump to the read page. foreach( SpringboardElement element in Elements ) { if ( element.Task as Droid.Tasks.Notes.NotesTask != null ) { ActivateElement( element ); PerformTaskAction( PrivateGeneralConfig.TaskAction_NotesRead ); } } } ); Billboard.Hide( ); return view; }