On Android, change default implementation to ignore volume keys and let operating system handle them (#2748)

This commit is contained in:
Robin Thunström 2023-06-06 23:04:51 +02:00 committed by GitHub
parent ab46aa5b79
commit 4a36741f9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 57 deletions

View file

@ -42,6 +42,11 @@ pub trait EventLoopBuilderExtAndroid {
///
/// This must be called on Android since the `AndroidApp` is not global state.
fn with_android_app(&mut self, app: AndroidApp) -> &mut Self;
/// Calling this will mark the volume keys to be manually handled by the application
///
/// Default is to let the operating system handle the volume keys
fn handle_volume_keys(&mut self) -> &mut Self;
}
impl<T> EventLoopBuilderExtAndroid for EventLoopBuilder<T> {
@ -49,6 +54,11 @@ impl<T> EventLoopBuilderExtAndroid for EventLoopBuilder<T> {
self.platform_specific.android_app = Some(app);
self
}
fn handle_volume_keys(&mut self) -> &mut Self {
self.platform_specific.ignore_volume_keys = false;
self
}
}
/// Re-export of the `android_activity` API