public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); SetupToolbar(view, Resource.String.rename); _issuerLayout = view.FindViewById <TextInputLayout>(Resource.Id.editIssuerLayout); _issuerText = view.FindViewById <TextInputEditText>(Resource.Id.editIssuer); _usernameLayout = view.FindViewById <TextInputLayout>(Resource.Id.editUsernameLayout); _usernameText = view.FindViewById <TextInputEditText>(Resource.Id.editUsername); _issuerText.Append(_issuer); if (_username != null) { _usernameText.Append(_username); } _issuerLayout.CounterMaxLength = Authenticator.IssuerMaxLength; _issuerText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(Authenticator.IssuerMaxLength) }); _usernameLayout.CounterMaxLength = Authenticator.UsernameMaxLength; _usernameText.SetFilters( new IInputFilter[] { new InputFilterLengthFilter(Authenticator.UsernameMaxLength) }); TextInputUtil.EnableAutoErrorClear(_issuerLayout); var cancelButton = view.FindViewById <MaterialButton>(Resource.Id.buttonCancel); cancelButton.Click += delegate { Dismiss(); }; var renameButton = view.FindViewById <MaterialButton>(Resource.Id.buttonRename); renameButton.Click += delegate { var issuer = _issuerText.Text.Trim(); if (issuer == "") { _issuerLayout.Error = GetString(Resource.String.noIssuer); return; } var args = new RenameEventArgs(_position, issuer, _usernameText.Text); RenameClicked?.Invoke(this, args); Dismiss(); }; _usernameText.EditorAction += (_, args) => { if (args.ActionId == ImeAction.Done) { renameButton.PerformClick(); } }; return(view); }