コード例 #1
0
        public string ShowKeyboardInput(string defaultText)
        {
            var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

            var kbi = new CCIMEKeyboardNotificationInfo();

            OnKeyboardWillShow();

            IsVisible = true;

            var context = Android.App.Application.Context;

            var alert = new AlertDialog.Builder(context);

            var input = new EditText(context)
            {
                Text = defaultText
            };

            if (defaultText != null)
            {
                input.SetSelection(defaultText.Length);
            }
            alert.SetView(input);

            alert.SetPositiveButton("Ok", (dialog, whichButton) =>
            {
                ContentText = input.Text;
                waitHandle.Set();
                IsVisible = false;
                OnKeyboardWillHide();
            });

            alert.SetNegativeButton("Cancel", (dialog, whichButton) =>
            {
                ContentText = null;
                waitHandle.Set();
                IsVisible = false;
                OnKeyboardWillHide();
            });
            alert.SetCancelable(false);

            alertDialog = alert.Create();
            alertDialog.Show();
            OnKeyboardDidShow();

            waitHandle.WaitOne();

            if (alertDialog != null)
            {
                alertDialog.Dismiss();
                alertDialog.Dispose();
                alertDialog = null;
            }

            OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length));
            IsVisible = false;

            return(contentText);
        }
コード例 #2
0
        void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
        {
            if (TextFieldIMEImplementation != null)
            {
                TextFieldIMEImplementation.DeleteBackward  -= TextFieldIMEImplementation_DeleteBackward;
                TextFieldIMEImplementation.InsertText      -= TextFieldIMEImplementation_InsertText;
                TextFieldIMEImplementation.ReplaceText     -= TextFieldIMEImplementation_ReplaceText;
                TextFieldIMEImplementation.KeyboardDidHide -= OnKeyboardDidHide;

                var newText = Text;

                //if (newText != null && Text != newText)
                //{

                bool canceled = false;

                ScheduleOnce(
                    time =>
                {
                    DoEndEditing(ref newText, ref canceled);

                    if (!canceled)
                    {
                        Text = newText;
                    }
                },
                    0
                    );
//                }
            }
        }
コード例 #3
0
        void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
        {
            if (TextFieldIMEImplementation != null)
            {
                TextFieldIMEImplementation.DeleteBackward -= TextFieldIMEImplementation_DeleteBackward;
                TextFieldIMEImplementation.InsertText -= TextFieldIMEImplementation_InsertText;
                TextFieldIMEImplementation.ReplaceText -= TextFieldIMEImplementation_ReplaceText;
                TextFieldIMEImplementation.KeyboardDidHide -= OnKeyboardDidHide;

                var newText = Text;

                //if (newText != null && Text != newText)
                //{

                    bool canceled = false;

                    ScheduleOnce(
                        time =>
                        {
                            DoEndEditing(ref newText, ref canceled);

                            if (!canceled)
                            {
                                Text = newText;
                            }
                        },
                        0
                    );
//                }
            }
        }
コード例 #4
0
        void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
        {
            if (action)
            {
                textField.StopAction(textFieldActionState);
                textField.Opacity = 255;
                action = false;
            }

        }
コード例 #5
0
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     if (!action)
     {
         textFieldActionState = textField.RepeatForever(textFieldAction);
         action = true;
     }
 }
コード例 #6
0
 void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did hide");
 }
コード例 #7
0
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did show");
 }
コード例 #8
0
 void OnKeyboardWillHide(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard will Hide");
 }
コード例 #9
0
 void OnKeyboardWillShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard will show");
 }
コード例 #10
0
        void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
        {
            CCLog.Log("Keyboard did hide");
            if (action)
            {
                TrackNode.StopAction(textFieldActionState);
                // Make sure we are in a visible state after the action ends.
                TrackNode.Visible = true;

                action = false;
            }

        }
コード例 #11
0
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did show");
     if (!action)
     {
         textFieldActionState = TrackNode.RepeatForever(textFieldAction);
         action = true;
     }
 }
コード例 #12
0
        public string ShowKeyboardInput(
         string defaultText)
        {
            
            var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

            var kbi = new CCIMEKeyboardNotificationInfo();

            OnKeyboardWillShow();

            IsVisible = true;

            

            CCGame.Activity.RunOnUiThread(() =>
            {
                var alert = new AlertDialog.Builder(Game.Activity);

                var input = new EditText(Game.Activity) { Text = defaultText };
                if (defaultText != null)
                {
                    input.SetSelection(defaultText.Length);
                }
                alert.SetView(input);

                alert.SetPositiveButton("Ok", (dialog, whichButton) =>
                {
                    ContentText = input.Text;
                    waitHandle.Set();
                    IsVisible = false;
                    OnKeyboardWillHide();
                });

                alert.SetNegativeButton("Cancel", (dialog, whichButton) =>
                {
                    ContentText = null;
                    waitHandle.Set();
                    IsVisible = false;
                    OnKeyboardWillHide();
                });
                alert.SetCancelable(false);

                alertDialog = alert.Create();
                alertDialog.Show();
                OnKeyboardDidShow();

            });
            waitHandle.WaitOne();
            
            if (alertDialog != null)
            {
                alertDialog.Dismiss();
                alertDialog.Dispose();
                alertDialog = null;
            }

            OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length));
            IsVisible = false;

            return contentText;
        }