|
|
|
@ -4,9 +4,11 @@ using Avalonia.Platform; |
|
|
|
|
|
|
|
namespace Avalonia.Android.Platform |
|
|
|
{ |
|
|
|
internal class AndroidSystemNavigationManagerImpl : ISystemNavigationManagerImpl |
|
|
|
internal class AndroidSystemNavigationManagerImpl : ISystemNavigationManagerImpl, IDisposable |
|
|
|
{ |
|
|
|
public event EventHandler<RoutedEventArgs> BackRequested; |
|
|
|
private readonly IActivityNavigationService? _navigationService; |
|
|
|
|
|
|
|
public event EventHandler<RoutedEventArgs>? BackRequested; |
|
|
|
|
|
|
|
public AndroidSystemNavigationManagerImpl(IActivityNavigationService? navigationService) |
|
|
|
{ |
|
|
|
@ -14,6 +16,7 @@ namespace Avalonia.Android.Platform |
|
|
|
{ |
|
|
|
navigationService.BackRequested += OnBackRequested; |
|
|
|
} |
|
|
|
_navigationService = navigationService; |
|
|
|
} |
|
|
|
|
|
|
|
private void OnBackRequested(object sender, AndroidBackRequestedEventArgs e) |
|
|
|
@ -24,5 +27,13 @@ namespace Avalonia.Android.Platform |
|
|
|
|
|
|
|
e.Handled = routedEventArgs.Handled; |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
if (_navigationService != null) |
|
|
|
{ |
|
|
|
_navigationService.BackRequested -= OnBackRequested; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|