Browse Source
fix crash with samsung keyboard when using password textboxes (#18793)
pull/18816/head
Emmanuel Hansen
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
4 additions and
4 deletions
-
src/Android/Avalonia.Android/Platform/Input/AvaloniaInputConnection.cs
-
src/Android/Avalonia.Android/Platform/Input/TextEditBuffer.cs
|
|
|
@ -279,20 +279,20 @@ namespace Avalonia.Android.Platform.Input |
|
|
|
|
|
|
|
public ICharSequence? GetSelectedTextFormatted([GeneratedEnum] GetTextFlags flags) |
|
|
|
{ |
|
|
|
return new SpannableString(_editBuffer.SelectedText); |
|
|
|
return new Java.Lang.String(_editBuffer.SelectedText ?? ""); |
|
|
|
} |
|
|
|
|
|
|
|
public ICharSequence? GetTextAfterCursorFormatted(int n, [GeneratedEnum] GetTextFlags flags) |
|
|
|
{ |
|
|
|
var end = Math.Min(_editBuffer.Selection.End, _editBuffer.Text.Length); |
|
|
|
return new SpannableString(_editBuffer.Text.Substring(end, Math.Min(n, _editBuffer.Text.Length - end))); |
|
|
|
return new Java.Lang.String(_editBuffer.Text.Substring(end, Math.Min(n, _editBuffer.Text.Length - end))); |
|
|
|
} |
|
|
|
|
|
|
|
public ICharSequence? GetTextBeforeCursorFormatted(int n, [GeneratedEnum] GetTextFlags flags) |
|
|
|
{ |
|
|
|
var start = Math.Max(0, _editBuffer.Selection.Start - n); |
|
|
|
var length = _editBuffer.Selection.Start - start; |
|
|
|
return _editBuffer.Text == null ? null : new SpannableString(_editBuffer.Text.Substring(start, length)); |
|
|
|
return _editBuffer.Text == null ? null : new Java.Lang.String(_editBuffer.Text.Substring(start, length)); |
|
|
|
} |
|
|
|
|
|
|
|
public bool PerformPrivateCommand(string? action, Bundle? data) |
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ namespace Avalonia.Android.Platform.Input |
|
|
|
SelectionStart = Selection.Start, |
|
|
|
SelectionEnd = Selection.End, |
|
|
|
StartOffset = 0, |
|
|
|
Text = new SpannableString(Text) |
|
|
|
Text = new Java.Lang.String(Text) |
|
|
|
}; |
|
|
|
|
|
|
|
internal void Remove(int index, int length) |
|
|
|
|