Exemplo n.º 1
0
        private void ActivateEditTextImpl()
        {
            if (activeEditText != null)
            {
                throw new Exception("Internal error: Can not activate edit text, another edit text is already active");
            }

            EnsureStaticEditText();

            activeEditText = this;
            editText       = staticEditText;

            // set up the initial state of the android EditText
            UpdateInputTypeImpl();

            editText.SetMaxLines(MaxLines);
            editText.SetMinLines(MinLines);

            UpdateTextToEditImpl();
            UpdateSelectionToEditImpl();

            // add callbacks
            editText.EditorAction     += AndroidEditTextOnEditorAction;
            editText.AfterTextChanged += AndroidEditTextOnAfterTextChanged;

            // add the edit to the overlay layout and show the layout
            GetGameContext().EditTextLayout.Visibility = ViewStates.Visible;

            // set the focus to the edit box
            editText.RequestFocus();

            // activate the ime (show the keyboard)
            inputMethodManager = (InputMethodManager)PlatformAndroid.Context.GetSystemService(Context.InputMethodService);
            inputMethodManager.ShowSoftInput(staticEditText, ShowFlags.Forced);
        }
Exemplo n.º 2
0
        private void OnMaxLinesChangedImpl()
        {
            if (editText == null)
            {
                return;
            }

            editText.SetMaxLines(MaxLines);
        }
Exemplo n.º 3
0
        private void ActivateEditTextImpl()
        {
            if(activeEditText != null)
                throw new Exception("Internal error: Can not activate edit text, another edit text is already active");

            EnsureStaticEditText();

            activeEditText = this;
            editText = staticEditText;
            
            // set up the initial state of the android EditText
            UpdateInputTypeImpl();

            editText.SetMaxLines(MaxLines);
            editText.SetMinLines(MinLines);

            UpdateTextToEditImpl();
            UpdateSelectionToEditImpl();

            // add callbacks
            editText.EditorAction += AndroidEditTextOnEditorAction;
            editText.AfterTextChanged += AndroidEditTextOnAfterTextChanged;

            // add the edit to the overlay layout and show the layout
            GetGameContext().EditTextLayout.Visibility = ViewStates.Visible;

            // set the focus to the edit box
            editText.RequestFocus();

            // activate the ime (show the keyboard)
            inputMethodManager = (InputMethodManager)PlatformAndroid.Context.GetSystemService(Context.InputMethodService);
            inputMethodManager.ShowSoftInput(staticEditText, ShowFlags.Forced);
        }