Exemplo n.º 1
0
        /// <summary>
        /// Observes the TextView's ImeAction so an action can be taken on keypress.
        /// </summary>
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            //go edit action will login
            if (actionId == ImeAction.Go)
            {
                if (!string.IsNullOrEmpty(userName.Text) && !string.IsNullOrEmpty(password.Text))
                {
                    Login();
                }
                else if (string.IsNullOrEmpty(userName.Text))
                {
                    userName.RequestFocus();
                }
                else
                {
                    password.RequestFocus();
                }

                return(true);
                //next action will set focus to password edit text.
            }
            else if (actionId == ImeAction.Next)
            {
                if (!string.IsNullOrEmpty(userName.Text))
                {
                    password.RequestFocus();
                }

                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            if (BaseElement.NextElement == null && (actionId == ImeAction.Done || actionId == ImeAction.Next))
            {
                UIHelper.CloseSoftKeyboard(Control);

                if (BaseElement.Command != null && BaseElement.Command.CanExecute(null))
                {
                    System.Windows.Input.ICommand cmd = BaseElement.Command;
                    cmd.Execute(null);
                }
                return(false);
            }

            if (actionId == ImeAction.Done || actionId == ImeAction.Next)
            {
                BaseElement.NextElement.Focus();
                UIHelper.OpenSoftKeyboard(Control);
                return(true);
            }



            return(false);
        }
Exemplo n.º 3
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     //go edit action will login
     if (actionId == ImeAction.Go)
     {
         if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text))
         {
             ThreadPool.QueueUserWorkItem(o => Login());
         }
         else if (string.IsNullOrEmpty(username.Text))
         {
             username.RequestFocus();
         }
         else
         {
             password.RequestFocus();
         }
         return(true);
     }
     else if (actionId == ImeAction.Next)
     {
         if (!string.IsNullOrEmpty(username.Text))
         {
             password.RequestFocus();
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 public override void OnEditorAction(ImeAction actionCode)
 {
     if (actionCode == ImeAction.Done || actionCode == ImeAction.Next)
     {
         this.RemoveFocus();
     }
 }
Exemplo n.º 5
0
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            // Fire Completed and dismiss keyboard for hardware / physical keyboards
            if (actionId == ImeAction.Done || actionId == _currentInputImeFlag || (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter && e.Action == KeyEventActions.Up))
            {
                global::Android.Views.View nextFocus = null;
                if (_currentInputImeFlag == ImeAction.Next)
                {
                    nextFocus = FocusSearch(v, FocusSearchDirection.Forward);
                }

                if (nextFocus != null)
                {
                    nextFocus.RequestFocus();
                    if (!nextFocus.OnCheckIsTextEditor())
                    {
                        v.HideKeyboard();
                    }
                }
                else
                {
                    EditText.ClearFocus();
                    v.HideKeyboard();
                }

                ((IEntryController)Element).SendCompleted();
            }

            return(true);
        }
Exemplo n.º 6
0
        public TTextField(Context context, IAttributeSet attrs, int defStyleAttr)
            : base(context, attrs, defStyleAttr)
        {
            // Load defaults from resources
            var defaultEditTextSize      = Resources.GetDimension(Resource.Dimension.default_edit_text_validation_edit_textsize);
            var defaultEditTextLabelSize = Resources.GetDimension(Resource.Dimension.default_edit_text_validation_label_textsize);
            var defaultErrorTextSize     = Resources.GetDimension(Resource.Dimension.default_edit_text_validation_error_textsize);

            // Retrieve styles attributes
            var controlAttrs = context.ObtainStyledAttributes(attrs, Resource.Styleable.EditTextValidate, defStyleAttr, Resource.Style.EditTextValidationStyle);

            TextHint      = controlAttrs.GetString(Resource.Styleable.EditTextValidate_android_hint);
            EditTextSize  = controlAttrs.GetDimension(Resource.Styleable.EditTextValidate_android_textSize, defaultEditTextSize);
            ErrorTextSize = controlAttrs.GetDimension(Resource.Styleable.EditTextValidate_errorTextSize, defaultErrorTextSize);
            LabelTextSize = controlAttrs.GetDimension(Resource.Styleable.EditTextValidate_labelTextSize, defaultEditTextLabelSize);
            InputType     = (InputTypes)controlAttrs.GetInt(Resource.Styleable.EditTextValidate_android_inputType, (int)InputTypes.ClassText);
            ImeOptions    = (ImeAction)controlAttrs.GetInt(Resource.Styleable.EditTextValidate_android_imeOptions, (int)InputTypes.ClassText);

            controlAttrs.Recycle();

            _padding2dp  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 2, Resources.DisplayMetrics);
            _padding3dp  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 3, Resources.DisplayMetrics);
            _padding7dp  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 7, Resources.DisplayMetrics);
            _padding10dp = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Resources.DisplayMetrics);

            Init();
        }
Exemplo n.º 7
0
 private void OnImeOptionsChanged(ImeAction imeAction)
 {
     if (_textBoxView != null)
     {
         _textBoxView.ImeOptions = imeAction;
     }
 }
Exemplo n.º 8
0
 public override void OnEditorAction(ImeAction actionCode)
 {
     ReturnKeyPressed?.Invoke(Pair ?? this, new EventHandledEventArgs());
     if (KeyboardReturnType > KeyboardReturnType.Next)
     {
         Blur(true);
     }
 }
Exemplo n.º 9
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Go)
     {
         appBar.SetExpanded(false);
     }
     return(false);
 }
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         listener?.OnQueryTextSubmit(v.Text);
     }
     return(true);
 }
Exemplo n.º 11
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.ImeNull && e.Action == KeyEventActions.Up)
     {
         host.SendMessage(v.Text);
     }
     return(true);
 }
Exemplo n.º 12
0
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            if (actionId == ImeAction.Search)
            {
                try
                {
                    SearchText = v.Text;

                    SearchView.ClearFocus();
                    v.ClearFocus();

                    MAdapter.UserList.Clear();
                    MAdapter.NotifyDataSetChanged();

                    OffsetUser = "******";

                    if (Methods.CheckConnectivity())
                    {
                        if (MAdapter.UserList.Count > 0)
                        {
                            MAdapter.UserList.Clear();
                            MAdapter.NotifyDataSetChanged();
                        }

                        ProgressBarLoader.Visibility = ViewStates.Visible;
                        EmptyStateLayout.Visibility  = ViewStates.Gone;
                        StartApiService();
                    }
                    else
                    {
                        if (Inflated == null)
                        {
                            Inflated = EmptyStateLayout.Inflate();
                        }

                        EmptyStateInflater x = new EmptyStateInflater();
                        x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection);
                        if (!x.EmptyStateButton.HasOnClickListeners)
                        {
                            x.EmptyStateButton.Click -= EmptyStateButtonOnClick;
                            x.EmptyStateButton.Click -= TryAgainButton_Click;
                        }

                        x.EmptyStateButton.Click    += TryAgainButton_Click;
                        ProgressBarLoader.Visibility = ViewStates.Gone;
                        EmptyStateLayout.Visibility  = ViewStates.Visible;
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }

                return(true);
            }

            return(false);
        }
        bool TextView.IOnEditorActionListener.OnEditorAction(TextView?v, ImeAction actionId, KeyEvent?e)
        {
            if ((e is not null) && (e.KeyCode == Keycode.Enter) && (e.Action == KeyEventActions.Up))
            {
                ((IEntryController)Element).SendCompleted();
            }

            return(true);
        }
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         ViewModel.SearchCommand.Execute(null);
         return true;
     }
     return false;
 }
Exemplo n.º 15
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if ((int)actionId == Resource.Id.login || actionId == ImeAction.ImeNull)
     {
         currentActivity.AttemptLogin();
         return(true);
     }
     return(false);
 }
Exemplo n.º 16
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent ev)
 {
     if (actionId == ImeAction.Go)
     {
         VerifyPassword();
         return(true);
     }
     return(false);
 }
Exemplo n.º 17
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         ViewModel.SearchCommand.Execute(null);
         return(true);
     }
     return(false);
 }
Exemplo n.º 18
0
 public bool OnEditorAction(AWidget.TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         Search?.Invoke(this, EventArgs.Empty);
         return(true);
     }
     return(false);
 }
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         SearchButtonClicked(this, EventArgs.Empty);
         return(true);
     }
     return(false);
 }
Exemplo n.º 20
0
 bool TextView.IOnEditorActionListener.OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Done || (actionId == ImeAction.ImeNull && e.KeyCode == Keycode.Enter))
     {
         HideKeyboard(v);
         DoneEdit();
     }
     return(true);
 }
Exemplo n.º 21
0
        public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
        {
            if (actionId == ImeAction.Go)
            {
                CheckGroupNumberAndProceed();
            }

            return(false);
        }
Exemplo n.º 22
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         DoSearch(v.Text);
         return(true);
     }
     return(false);
 }
Exemplo n.º 23
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (string.IsNullOrWhiteSpace(v.Text))
     {
         Toast.MakeText(_context, "请您输入登录账号!", ToastLength.Short).Show();
         AndroidCommon.MyMediaPlayer.GetInstance(_context).PyayerMedia();
         return(false);
     }
     return(true);
 }
Exemplo n.º 24
0
 public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Send)
     {
         inputLinesBuffer.Add(v.Text);
         v.Text = "";
         return(true);
     }
     return(false);
 }
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent event_)
 {
     if (actionId == ImeAction.Done || event_.KeyCode == Keycode.Enter)
     {
         _activity.SetUiState(UiState.CONVERSATION_COMPOSER);
         _activity.SetTitle(true);
         return(true);
     }
     return(false);
 }
Exemplo n.º 26
0
        public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
        {
            //We need to force a keypress event on editor action.
            //the key press event is not trigerred if we press the enter key depending on the ime.options
            OnKeyPress(v, new KeyEventArgs(true, Keycode.Enter, new KeyEvent(KeyEventActions.Up, Keycode.Enter)));

            // Action will be ImeNull if AcceptsReturn is true, in which case we return false to allow the new line to register.
            // Otherwise we return true to allow the focus to change correctly.
            return(actionId != ImeAction.ImeNull);
        }
Exemplo n.º 27
0
        void UpdateReturnType()
        {
            if (Element == null)
            {
                return;
            }

            _textInputEditText.ImeOptions = Entry.ReturnType.ToAndroidImeAction();
            _currentInputImeFlag          = _textInputEditText.ImeOptions;
        }
Exemplo n.º 28
0
 public Boolean OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.ImeNull && e.Action == KeyEventActions.Up)
     {
         _host.SendMessage(new MessageEventArgs {
             Message = v.Text
         });
     }
     return(true);
 }
Exemplo n.º 29
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if ((actionId == ImeAction.Done) || ((actionId == ImeAction.ImeNull) && (e.KeyCode == Keycode.Enter)))
     {
         Control.ClearFocus();
         HideKeyboard();
         ((IEntryController)Element).SendCompleted();
     }
     return(true);
 }
Exemplo n.º 30
0
        void UpdateReturnType()
        {
            if (Control == null || Element == null)
            {
                return;
            }

            EditText.ImeOptions  = Element.ReturnType.ToAndroidImeAction();
            _currentInputImeFlag = EditText.ImeOptions;
        }
Exemplo n.º 31
0
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Done) {
         if (this.FinishEditCallback != null) {
             this.FinishEditCallback(v.Text);
         }
         this.Dismiss();
         return true;
     }
     return false;
 }
Exemplo n.º 32
0
        protected virtual void UpdateImeOptions()
        {
            if (Element == null || Control == null)
            {
                return;
            }
            var imeOptions = Element.OnThisPlatform().ImeOptions();

            _currentInputImeFlag = imeOptions.ToAndroidImeOptions();
            EditText.ImeOptions  = _currentInputImeFlag;
        }
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            if (actionId == ImeAction.Done)
            {
                var inputMethodManager = (InputMethodManager)Application.Context.GetSystemService(Context.InputMethodService);

                inputMethodManager.HideSoftInputFromWindow(v.WindowToken, 0);

                return true;
            }

            return false;
        }
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     switch (v.Id)
     {
         case Resource.Id.achievementId:
             mUnlockAchievement.PerformClick();
             break;
         case Resource.Id.leaderboardId:
             mSaveLeaderboard.PerformClick();
             break;
         default:
             return false;
     }
     return false;
 }
Exemplo n.º 35
0
        /// <summary>
        /// Observes the TextView's ImeAction so an action can be taken on keypress.
        /// </summary>
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            //go edit action will login
            if (actionId == ImeAction.Go) {
                if (loginViewModel.IsValid)
                    Login ();

                return true;
                //next action will set focus to password edit text.
            } else if (actionId == ImeAction.Next) {
                password.RequestFocus ();
                return true;
            }
            return false;
        }
        /// <summary>
        /// Observes the TextView's ImeAction so an action can be taken on keypress.
        /// </summary>
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            //go edit action will login
            if (actionId == ImeAction.Go) {
                if (!string.IsNullOrEmpty (userName.Text) && !string.IsNullOrEmpty (password.Text))
                    Login ();
                else if (string.IsNullOrEmpty (userName.Text))
                    userName.RequestFocus ();
                else
                    password.RequestFocus ();

                return true;
                //next action will set focus to password edit text.
            } else if (actionId == ImeAction.Next) {
                if (!string.IsNullOrEmpty (userName.Text))
                    password.RequestFocus ();

                return true;
            }
            return false;
        }
Exemplo n.º 37
0
		public bool OnEditorAction (TextView v, ImeAction actionId, KeyEvent e)
		{
			//go edit action will login
			if (actionId == ImeAction.Go) {
				if (!string.IsNullOrEmpty (username.Text) && !string.IsNullOrEmpty (password.Text)) {
					ThreadPool.QueueUserWorkItem (o => Login ());
				} else if (string.IsNullOrEmpty (username.Text)) {
					username.RequestFocus ();
				} else {
					password.RequestFocus ();
				}
				return true;
			} else if (actionId == ImeAction.Next) {
				if (!string.IsNullOrEmpty (username.Text)) {
					password.RequestFocus ();
				}
				return true;
			}
			return false;
		}
Exemplo n.º 38
0
 //        private void SearchText_Changed(object sender, EventArgs e)
 //        {
 //            String searchTerm = searchText.Text;
 //            if (searchTerm != null)
 //            {
 //                searchTerm = searchTerm.Trim();
 //                SearchTextChanged(this, new SearchTextChangedEventArgs(searchTerm));
 //            }
 //        }
 public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         SearchButtonClicked(this, EventArgs.Empty);
         return true;
     }
     return false;
 }
Exemplo n.º 39
0
        public bool OnEditorAction(TextView v, ImeAction actionId, KeyEvent e)
        {
            //if (e.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
            if(actionId == ImeAction.Done)
            {
                //var imm = (InputMethodManager)ApplicationContext.GetSystemService(Context.InputMethodService);
                //imm.HideSoftInputFromInputMethod(v.WindowToken, 0);
                Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);
                return true;
            }

            return false;
        }
		public bool OnEditorAction (TextView v, ImeAction actionId, KeyEvent ev)
		{
			if (actionId == ImeAction.Go) {
				VerifyPassword ();
				return true;
			}
			return false;
		}