Beispiel #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);
        }
Beispiel #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
                    );
//                }
            }
        }
        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
                    );
//                }
            }
        }
        void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
        {
            if (action)
            {
                textField.StopAction(textFieldActionState);
                textField.Opacity = 255;
                action = false;
            }

        }
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     if (!action)
     {
         textFieldActionState = textField.RepeatForever(textFieldAction);
         action = true;
     }
 }
 void OnKeyboardDidHide(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did hide");
 }
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did show");
 }
 void OnKeyboardWillHide(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard will Hide");
 }
 void OnKeyboardWillShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard will show");
 }
        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;
            }

        }
 void OnKeyboardDidShow(object sender, CCIMEKeyboardNotificationInfo e)
 {
     CCLog.Log("Keyboard did show");
     if (!action)
     {
         textFieldActionState = TrackNode.RepeatForever(textFieldAction);
         action = true;
     }
 }
        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;
        }