From b6c07d696502ef61f0bd6d22d3be9e96378ffd04 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 26 Mar 2021 13:58:50 +0300 Subject: [PATCH 1/8] Hide navigation bar in SDL mode. --- .../android/limbo/main/LimboSDLActivity.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java index dd506a7f1..5a01f04a3 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java @@ -902,6 +902,15 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE // always use full screen + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // overlayed navigation + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // overlayed status bar + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide navigation buttons + | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY // keep navigation hidden + ); + super.onCreate(savedInstanceState); setupVolume(); @@ -1773,6 +1782,16 @@ protected int getCurrentVolume() { @Override public void onWindowFocusChanged(boolean hasFocus) { + if(hasFocus) // hide navigation only when using screen + 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 + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ); + } public boolean rightClick(final MotionEvent e, final int i) { From da24fa8efbca2c4d966f07dd55c3a47933ccf058 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 26 Mar 2021 14:20:37 +0300 Subject: [PATCH 2/8] Forgot braces. --- .../java/com/max2idea/android/limbo/main/LimboSDLActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java index 5a01f04a3..bb2999d5b 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java @@ -898,7 +898,7 @@ protected void onCreate(Bundle savedInstanceState) { // Log.v("SDL", "onCreate()"); activity = this; - if (LimboSettingsManager.getFullscreen(this)) + if (LimboSettingsManager.getFullscreen(this)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -910,6 +910,7 @@ protected void onCreate(Bundle savedInstanceState) { | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY // keep navigation hidden ); + } super.onCreate(savedInstanceState); setupVolume(); From b25413840598e09c1985330e60f06cda066acd51 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:33:48 +0300 Subject: [PATCH 3/8] Use cutouts area in SDL mode --- .../com/max2idea/android/limbo/main/LimboSDLActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java index bb2999d5b..9fbb64df4 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java @@ -900,7 +900,13 @@ protected void onCreate(Bundle savedInstanceState) { if (LimboSettingsManager.getFullscreen(this)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); + WindowManager.LayoutParams.FLAG_FULLSCREEN); // 1024 + + if (VERSION.SDK_INT >= 28) { // Android 9+ supports cutouts + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 + if (VERSION.SDK_INT >= 30) // Android 11 + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 + } getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE // always use full screen From 25188e1023aa478e7479acf1febcd4b01727e254 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:58:29 +0300 Subject: [PATCH 4/8] Hide navigation buttons + use cutouts in VNC mode --- .../android/limbo/main/LimboVNCActivity.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java index 360053c8c..ae9331a82 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java @@ -92,10 +92,26 @@ public class LimboVNCActivity extends VncCanvasActivity { @Override public void onCreate(Bundle b) { - if (LimboSettingsManager.getFullscreen(this)) + if (LimboSettingsManager.getFullscreen(this)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + if (VERSION.SDK_INT >= 28) { // Android 9 + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 + if (VERSION.SDK_INT >= 30) // Android 11 + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 + } + + 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 + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ); + } + super.onCreate(b); this.vncCanvas.setFocusableInTouchMode(true); @@ -109,6 +125,19 @@ public void onCreate(Bundle b) { } + @Override + public void onWindowFocusChanged(boolean hasFocus) { + if(hasFocus) // hide navigation only when using screen + 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 + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ); + } + private void setDefaulViewMode() { From b6099197daf49e546509ffc2af6c789cbbb8a32d Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:50:07 +0300 Subject: [PATCH 5/8] Correct variable names --- .../com/max2idea/android/limbo/main/LimboSDLActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java index 9fbb64df4..f202a244d 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java @@ -902,9 +902,9 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 1024 - if (VERSION.SDK_INT >= 28) { // Android 9+ supports cutouts + if (Build.VERSION.SDK_INT >= 28) { // Android 9+ supports cutouts getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 - if (VERSION.SDK_INT >= 30) // Android 11 + if (Build.VERSION.SDK_INT >= 30) // Android 11 getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 } From e2ca72565db48e47e114cf1359fb5b6c00cbb449 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:52:46 +0300 Subject: [PATCH 6/8] Proper variables names --- .../com/max2idea/android/limbo/main/LimboVNCActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java index ae9331a82..6a7c72f37 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java @@ -96,9 +96,9 @@ public void onCreate(Bundle b) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - if (VERSION.SDK_INT >= 28) { // Android 9 + if (Build.VERSION.SDK_INT >= 28) { // Android 9 getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 - if (VERSION.SDK_INT >= 30) // Android 11 + if (Build.VERSION.SDK_INT >= 30) // Android 11 getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 } From a5583dd740ad0c0d976ba854fd5713543f686c1d Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 18:17:28 +0300 Subject: [PATCH 7/8] Simplification --- .../com/max2idea/android/limbo/main/LimboSDLActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java index f202a244d..57687bd98 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboSDLActivity.java @@ -902,11 +902,11 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 1024 - if (Build.VERSION.SDK_INT >= 28) { // Android 9+ supports cutouts - getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 + if (Build.VERSION.SDK_INT >= 28) // Android 9+ supports cutouts if (Build.VERSION.SDK_INT >= 30) // Android 11 getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 - } + else + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE // always use full screen From 6497fac5e743cfbd097a8c4aa77f66b04c258704 Mon Sep 17 00:00:00 2001 From: vmobilis <75476228+vmobilis@users.noreply.github.com> Date: Fri, 30 Jul 2021 18:22:08 +0300 Subject: [PATCH 8/8] Simplification --- .../com/max2idea/android/limbo/main/LimboVNCActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java index 6a7c72f37..d4961855f 100644 --- a/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java +++ b/limbo-android-lib/src/main/java/com/max2idea/android/limbo/main/LimboVNCActivity.java @@ -96,11 +96,11 @@ public void onCreate(Bundle b) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - if (Build.VERSION.SDK_INT >= 28) { // Android 9 - getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 + if (Build.VERSION.SDK_INT >= 28) // Android 9+ supports cutouts if (Build.VERSION.SDK_INT >= 30) // Android 11 getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; // 3 - } + else + getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; // 1 getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE