Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide navigation buttons and use cutouts area #128

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -898,9 +898,25 @@ 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);
WindowManager.LayoutParams.FLAG_FULLSCREEN); // 1024

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
| 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();
Expand Down Expand Up @@ -1773,6 +1789,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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (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
| 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);
Expand All @@ -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() {


Expand Down