Example #1
0
        void SetReturnType(CustomEntry entry)
        {
            if (entry != null && Control != null)
            {
                var type = entry.ReturnType;

                switch (type)
                {
                case KeyboardReturnType.Go:
                    Control.ImeOptions = ImeAction.Go;
                    Control.SetImeActionLabel("Go", ImeAction.Go);
                    break;

                case KeyboardReturnType.Next:
                    Control.ImeOptions = ImeAction.Next;
                    Control.SetImeActionLabel("Next", ImeAction.Next);
                    break;

                case KeyboardReturnType.Send:
                    Control.ImeOptions = ImeAction.Send;
                    Control.SetImeActionLabel("Send", ImeAction.Send);
                    break;

                case KeyboardReturnType.Search:
                    Control.ImeOptions = ImeAction.Search;
                    Control.SetImeActionLabel("Search", ImeAction.Search);
                    break;

                default:
                    Control.ImeOptions = ImeAction.Done;
                    Control.SetImeActionLabel("Done", ImeAction.Done);
                    break;
                }

                if (entry.ReturnType == KeyboardReturnType.Next)
                {
                    //Control.ImeOptions = ImeAction.Next;
                    Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) =>
                    {
                        entry.OnNext();
                    };
                }

                if (entry.ReturnType == KeyboardReturnType.Done)
                {
                    //Control.ImeOptions = ImeAction.Done;
                    //Control.SetImeActionLabel("Done", ImeAction.Done);

                    Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) =>
                    {
                        entry.Unfocus();
                        if (entry.ReturnKeyClickCommand != null)
                        {
                            entry.ReturnKeyClickCommand.Execute(null);
                        }
                    };
                }

                if (entry.ReturnType == KeyboardReturnType.Search)
                {
                    //Control.ImeOptions = ImeAction.Send;
                    //Control.SetImeActionLabel("Search", ImeAction.Search);

                    Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) =>
                    {
                        entry.Unfocus();
                        if (entry.ReturnKeyClickCommand != null)
                        {
                            entry.ReturnKeyClickCommand.Execute(null);
                        }
                    };
                }
            }
        }