Skip to content

Commit

Permalink
Only draw behind status and navigation bars for Android 8.0 and above.
Browse files Browse the repository at this point in the history
  • Loading branch information
CDrummond committed Aug 4, 2024
1 parent 5212830 commit 87b8ecf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/601.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Fixed
• Handle screen rotation.
• Fix edge-to-edge view for pre Android 14 devices.
• Set Android 6.0 as minimum level.
• Only draw behind status and navigation bars for Android 8.0 and above.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ private String getConfiguredUrl() {
if (Utils.notificationAllowed(this, DownloadService.NOTIFICATION_CHANNEL_ID)) {
builder.appendQueryParameter("download", "native");
}
if (!sharedPreferences.getBoolean(SettingsActivity.FULLSCREEN_PREF_KEY, false)) {
if (!sharedPreferences.getBoolean(SettingsActivity.FULLSCREEN_PREF_KEY, false) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
boolean gestureNav = usingGestureNavigation();
builder.appendQueryParameter("topPad", "24");
builder.appendQueryParameter("botPad", gestureNav ? "12" : "40");
Expand Down Expand Up @@ -508,9 +509,14 @@ public void onConfigurationChanged(Configuration newConfig) {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "MainActivity.onCreate");
requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = getWindow();
WindowCompat.setDecorFitsSystemWindows(window, false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} else {
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorBackground));
getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorBackground));
}

sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
//isDark = sharedPreferences.getBoolean(SettingsActivity.IS_DARK_PREF_KEY, true);
Expand All @@ -531,7 +537,6 @@ protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
setContentView(R.layout.activity_main);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
init5497Workaround();
manageShowOverLockscreen();
webView = findViewById(R.id.webview);
Expand Down Expand Up @@ -1215,7 +1220,9 @@ private void setFullScreen(boolean on, boolean isStartup) {
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
}
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
if (!isStartup) {
recreate();
recreateTime = SystemClock.elapsedRealtime();
Expand Down

0 comments on commit 87b8ecf

Please sign in to comment.