public override void TextDidChange(IUITextInput textInput) { // The app has just changed the document's contents, the document context has been updated. UIColor textColor = null; try { if (TextDocumentProxy.KeyboardAppearance == UIKeyboardAppearance.Dark) { textColor = UIColor.White; } else { textColor = UIColor.Black; } _nextKeyboardButton.SetTitleColor(textColor, UIControlState.Normal); _tokenButton.SetTitleColor(textColor, UIControlState.Normal); _debugButton.SetTitleColor(textColor, UIControlState.Normal); _returnButton.SetTitle(TextDocumentProxy.ReturnKeyType.ToString(), UIControlState.Normal); _returnButton.SizeToFit(); _returnButton.TranslatesAutoresizingMaskIntoConstraints = false; } catch (Exception e) { Debug(e); } }
public static void ApplyKeyboard(this IUITextInput textInput, Keyboard keyboard) { if (textInput is IUITextInputTraits traits) { ApplyKeyboard(traits, keyboard); } }
internal static int GetCursorPosition(this IUITextInput platformView, int cursorOffset = 0) { var zeroPosition = platformView.GetPosition(platformView.BeginningOfDocument, 0); var currentCursorPosition = platformView.SelectedTextRange?.Start ?? zeroPosition; var newCursorPosition = cursorOffset + (int)platformView.GetOffsetFromPosition(platformView.BeginningOfDocument, currentCursorPosition); return(Math.Max(0, newCursorPosition)); }
public override void TextDidChange(IUITextInput textInput) { // The app has just changed the document's contents, the document context has been updated. var isDark = TextDocumentProxy.KeyboardAppearance == UIKeyboardAppearance.Dark; UIColor textColor = isDark ? UIColor.White : UIColor.Black; nextKeyboardButton.SetTitleColor(textColor, UIControlState.Normal); }
public override void TextDidChange (IUITextInput textInput) { // The app has just changed the document's contents, the document context has been updated. var isDark = TextDocumentProxy.KeyboardAppearance == UIKeyboardAppearance.Dark; UIColor textColor = isDark ? UIColor.White : UIColor.Black; nextKeyboardButton.SetTitleColor (textColor, UIControlState.Normal); }
public void TextDidChange(IUITextInput textField) { var field = textField as UITextField; if (field != null) { listener.EditingEnded(field); } }
public void SelectionDidChange(IUITextInput uiTextInput) { var field = uiTextInput as UITextField; if (field != null) { listener.ShouldEndEditing(field); } }
public void SelectionWillChange(IUITextInput uiTextInput) { var field = uiTextInput as UITextField; if (field != null) { field.ShouldBeginEditing(field); } }
internal static int GetSelectedTextLength(this IUITextInput platformView) { var selectedTextRange = platformView.SelectedTextRange; if (selectedTextRange == null) { return(0); } return((int)platformView.GetOffsetFromPosition(selectedTextRange.Start, selectedTextRange.End)); }
public static void ApplyKeyboard(this IUITextInput textInput, Keyboard keyboard) { textInput.AutocapitalizationType = UITextAutocapitalizationType.None; textInput.AutocorrectionType = UITextAutocorrectionType.No; textInput.SpellCheckingType = UITextSpellCheckingType.No; if (keyboard == Keyboard.Default) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Default; textInput.SpellCheckingType = UITextSpellCheckingType.Default; textInput.KeyboardType = UIKeyboardType.Default; } else if (keyboard == Keyboard.Chat) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Yes; } else if (keyboard == Keyboard.Email) { textInput.KeyboardType = UIKeyboardType.EmailAddress; } else if (keyboard == Keyboard.Numeric) { textInput.KeyboardType = UIKeyboardType.DecimalPad; } else if (keyboard == Keyboard.Telephone) { textInput.KeyboardType = UIKeyboardType.PhonePad; } else if (keyboard == Keyboard.Text) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Yes; textInput.SpellCheckingType = UITextSpellCheckingType.Yes; } else if (keyboard == Keyboard.Url) { textInput.KeyboardType = UIKeyboardType.Url; } else if (keyboard is CustomKeyboard) { var custom = (CustomKeyboard)keyboard; var capitalizedSentenceEnabled = (custom.Flags & KeyboardFlags.CapitalizeSentence) == KeyboardFlags.CapitalizeSentence; var spellcheckEnabled = (custom.Flags & KeyboardFlags.Spellcheck) == KeyboardFlags.Spellcheck; var suggestionsEnabled = (custom.Flags & KeyboardFlags.Suggestions) == KeyboardFlags.Suggestions; textInput.AutocapitalizationType = capitalizedSentenceEnabled ? UITextAutocapitalizationType.Sentences : UITextAutocapitalizationType.None; textInput.AutocorrectionType = suggestionsEnabled ? UITextAutocorrectionType.Yes : UITextAutocorrectionType.No; textInput.SpellCheckingType = spellcheckEnabled ? UITextSpellCheckingType.Yes : UITextSpellCheckingType.No; } }
public void TextWillChange(IUITextInput textField) { var field = textField as UITextField; if (field != null) { if (AutoCompleteOnFocus && string.IsNullOrEmpty(textField.ToString())) { ShouldChangeCharacters(field, new NSRange(0, 0), string.Empty); } listener.EditingStarted(field); } }
public static UITextRange GetTextRange(this IUITextInput textInput, int start, int end) { if (textInput?.BeginningOfDocument == null) { return(null); } var from = textInput.GetPosition(textInput.BeginningOfDocument, start); var to = textInput.GetPosition(textInput.BeginningOfDocument, end); if (from == null || to == null) { return(null); } return(textInput.GetTextRange(from, to)); }
public override void TextDidChange(IUITextInput textInput) { // The app has just changed the document's contents, the document context has been updated. UIColor textColor = null; if (TextDocumentProxy.KeyboardAppearance == UIKeyboardAppearance.Dark) { textColor = UIColor.White; } else { textColor = UIColor.Black; } cameraButton.SetTitleColor(textColor, UIControlState.Normal); galleryButton.SetTitleColor(textColor, UIControlState.Normal); }
internal static void SetTextRange(this IUITextInput platformView, int start, int selectedTextLength) { int end = start + selectedTextLength; // Let's be sure we have positive positions start = Math.Max(start, 0); end = Math.Max(end, 0); // Switch start and end positions if necessary start = Math.Min(start, end); end = Math.Max(start, end); var startPosition = platformView.GetPosition(platformView.BeginningOfDocument, start); var endPosition = platformView.GetPosition(platformView.BeginningOfDocument, end); platformView.SelectedTextRange = platformView.GetTextRange(startPosition, endPosition); }
public DetailImageCell(IntPtr handle) : base(handle) { _text = new VirtualTextInput(this); }
public static void ApplyKeyboard(this IUITextInput textInput, Keyboard keyboard) { textInput.AutocapitalizationType = UITextAutocapitalizationType.None; textInput.AutocorrectionType = UITextAutocorrectionType.No; textInput.SpellCheckingType = UITextSpellCheckingType.No; textInput.KeyboardType = UIKeyboardType.Default; if (keyboard == Keyboard.Default) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Default; textInput.SpellCheckingType = UITextSpellCheckingType.Default; } else if (keyboard == Keyboard.Chat) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Yes; } else if (keyboard == Keyboard.Email) { textInput.KeyboardType = UIKeyboardType.EmailAddress; } else if (keyboard == Keyboard.Numeric) { textInput.KeyboardType = UIKeyboardType.DecimalPad; } else if (keyboard == Keyboard.Telephone) { textInput.KeyboardType = UIKeyboardType.PhonePad; } else if (keyboard == Keyboard.Text) { textInput.AutocapitalizationType = UITextAutocapitalizationType.Sentences; textInput.AutocorrectionType = UITextAutocorrectionType.Yes; textInput.SpellCheckingType = UITextSpellCheckingType.Yes; } else if (keyboard == Keyboard.Url) { textInput.KeyboardType = UIKeyboardType.Url; } else if (keyboard is CustomKeyboard) { var custom = (CustomKeyboard)keyboard; var capitalizedSentenceEnabled = (custom.Flags & KeyboardFlags.CapitalizeSentence) == KeyboardFlags.CapitalizeSentence; var capitalizedWordsEnabled = (custom.Flags & KeyboardFlags.CapitalizeWord) == KeyboardFlags.CapitalizeWord; var capitalizedCharacterEnabled = (custom.Flags & KeyboardFlags.CapitalizeCharacter) == KeyboardFlags.CapitalizeCharacter; var capitalizedNone = (custom.Flags & KeyboardFlags.None) == KeyboardFlags.None; var spellcheckEnabled = (custom.Flags & KeyboardFlags.Spellcheck) == KeyboardFlags.Spellcheck; var suggestionsEnabled = (custom.Flags & KeyboardFlags.Suggestions) == KeyboardFlags.Suggestions; UITextAutocapitalizationType capSettings = UITextAutocapitalizationType.None; // Sentence being first ensures that the behavior of ALL is backwards compatible if (capitalizedSentenceEnabled) { capSettings = UITextAutocapitalizationType.Sentences; } else if (capitalizedWordsEnabled) { capSettings = UITextAutocapitalizationType.Words; } else if (capitalizedCharacterEnabled) { capSettings = UITextAutocapitalizationType.AllCharacters; } else if (capitalizedNone) { capSettings = UITextAutocapitalizationType.None; } textInput.AutocapitalizationType = capSettings; textInput.AutocorrectionType = suggestionsEnabled ? UITextAutocorrectionType.Yes : UITextAutocorrectionType.No; textInput.SpellCheckingType = spellcheckEnabled ? UITextSpellCheckingType.Yes : UITextSpellCheckingType.No; } }
public override void TextWillChange(IUITextInput textInput) { // The app is about to change the document's contents. Perform any preparation here. }
public void TextField(IUITextInput textField, bool complete, string value) { Debug.WriteLine(value); }
public void SelectionDidChange(IUITextInput uiTextInput) { }
public void TextWillChange(IUITextInput textInput) { }
public void TextDidChange(IUITextInput textInput) { }
public void SelectionWillChange(IUITextInput uiTextInput) { }
public override void TextWillChange (IUITextInput textInput) { // The app is about to change the document's contents. Perform any preparation here. }
///////////////////// // POPUP DELAY END // ///////////////////// // TODO: this is currently not working as intended; only called when selection changed -- iOS bug; public override void TextDidChange(IUITextInput textInput) { this.contextChanged(); }