Ejemplo n.º 1
0
        /**
         * Creates a new instance of {@link EditText} that is configured to specify the given content
         * MIME types to EditorInfo#contentMimeTypes so that developers can locally test how the current
         * input method behaves for such content MIME types.
         *
         * @param contentMimeTypes A {@link String} array that indicates the supported content MIME
         *                         types
         * @return a new instance of {@link EditText}, which specifies EditorInfo#contentMimeTypes with
         * the given content MIME types
         */
        EditText CreateEditTextWithContentMimeTypes(string[] contentMimeTypes)
        {
            string hintText;

            string[] mimeTypes;              // our own copy of contentMimeTypes.
            if (contentMimeTypes == null || contentMimeTypes.Length == 0)
            {
                hintText  = "MIME: []";
                mimeTypes = new string[0];
            }
            else
            {
                hintText  = "MIME: " + string.Join(".", contentMimeTypes);
                mimeTypes = new string[contentMimeTypes.Length];
                contentMimeTypes.CopyTo(mimeTypes, 0);
            }

            var editText = new CustomEditText(this)
            {
                Owner = this, MimeTypes = mimeTypes, Hint = hintText
            };

            editText.SetTextColor(Color.White);
            editText.SetHintTextColor(Color.White);
            return(editText);
        }
Ejemplo n.º 2
0
        void Init()
        {
            etEmailInvite = this.FindViewById <CustomEditText>(Resource.Id.etEmailInvite);
            etEmailInvite.EditorAction += (sender, args) =>
            {
                if (args.ActionId == ImeAction.Done)
                {
                    ViewModel.SendInviteCommand.Execute();
                }
            };
            etEmailInvite.FocusChange += (sender, args) =>
            {
                if (!args.HasFocus)
                {
                    InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromInputMethod(etEmailInvite.WindowToken, 0);

                    Window.SetSoftInputMode(SoftInput.StateHidden);

                    ViewModel.SendInviteCommand.Execute();
                }
            };
        }