Browse Source
Android - call base dispatch key event before called toplevel's override (#16969 )
* android - call base dispatch key event before called toplevel's override
* android - handle keyevent in avalonia before calling base DispatchKeyEvent
---------
Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
pull/17021/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
8 additions and
2 deletions
src/Android/Avalonia.Android/AvaloniaView.cs
src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidKeyboardEventsHelper.cs
@ -66,7 +66,9 @@ namespace Avalonia.Android
public override bool DispatchKeyEvent ( KeyEvent ? e )
{
return _ view . View . DispatchKeyEvent ( e ) ;
if ( ! _ view . View . DispatchKeyEvent ( e ) )
return base . DispatchKeyEvent ( e ) ;
return true ;
}
[SupportedOSPlatform("android24.0")]
@ -70,6 +70,8 @@ namespace Avalonia.Android.Platform.Specific.Helpers
_ view . Input ? . Invoke ( rawKeyEvent ) ;
bool handled = rawKeyEvent . Handled ;
if ( ( e . Action = = KeyEventActions . Down & & e . UnicodeChar > = 3 2 )
| | unicodeTextInput ! = null )
{
@ -80,6 +82,8 @@ namespace Avalonia.Android.Platform.Specific.Helpers
unicodeTextInput ? ? Convert . ToChar ( e . UnicodeChar ) . ToString ( )
) ;
_ view . Input ? . Invoke ( rawTextEvent ) ;
handled = handled | | rawTextEvent . Handled ;
}
if ( e . Action = = KeyEventActions . Up )
@ -90,7 +94,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers
}
callBase = false ;
return false ;
return handled ;
}
private static RawInputModifiers GetModifierKeys ( KeyEvent e )