[Scummvm-git-logs] scummvm master -> 6352a0c212d7b313bf5fe281e31b7eeff6d9f209
antoniou79
a.antoniou79 at gmail.com
Tue Aug 11 08:24:00 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6352a0c212 ANDROID: Improve on Immersive full screen
Commit: 6352a0c212d7b313bf5fe281e31b7eeff6d9f209
https://github.com/scummvm/scummvm/commit/6352a0c212d7b313bf5fe281e31b7eeff6d9f209
Author: antoniou (a.antoniou79 at gmail.com)
Date: 2020-08-11T11:21:53+03:00
Commit Message:
ANDROID: Improve on Immersive full screen
Sample is taken from android developers, takes into account focus change
The system bars should now be hidden when resuming back to the ScummVM app
https://developer.android.com/training/system-ui/immersive.html#java
Changed paths:
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index ea94f11a53..01bebeb55c 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -195,17 +195,7 @@ public class ScummVMActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // TODO setSystemUiVisibility is introduced in API 11 and deprecated in API 30 - When we move to API 30 we will have to replace this code
- // TODO Code is taken from https://www.techrepublic.com/article/give-android-users-an-immersive-experience-by-using-kitkats-full-screen-decor-flags/
- // The code sample in the above url contains code to switch between immersive and default mode by clicking a button.
- // We could do something similar by making it a Global UI option.
- getWindow().getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
- | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+ hideSystemUI();
setVolumeControlStream(AudioManager.STREAM_MUSIC);
@@ -376,6 +366,49 @@ public class ScummVMActivity extends Activity {
return false;
}
+
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ if (hasFocus) {
+ hideSystemUI();
+ }
+ }
+
+
+ // TODO setSystemUiVisibility is introduced in API 11 and deprecated in API 30 - When we move to API 30 we will have to replace this code
+ // https://developer.android.com/training/system-ui/immersive.html#java
+ //
+ // The code sample in the url below contains code to switch between immersive and default mode
+ // https://github.com/android/user-interface-samples/tree/master/AdvancedImmersiveMode
+ // We could do something similar by making it a Global UI option.
+ private void hideSystemUI() {
+ // Enables regular immersive mode.
+ // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
+ // Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ View decorView = getWindow().getDecorView();
+ decorView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ // Set the content to appear under the system bars so that the
+ // content doesn't resize when the system bars hide and show.
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ // Hide the nav bar and status bar
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN);
+ }
+
+ // Shows the system bars by removing all the flags
+ // except for the ones that make the content appear under the system bars.
+ private void showSystemUI() {
+ View decorView = getWindow().getDecorView();
+ decorView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ }
+
private void showKeyboard(boolean show) {
SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface);
InputMethodManager imm = (InputMethodManager)
More information about the Scummvm-git-logs
mailing list