diff --git a/app/src/main/java/com/nextcloud/utils/extensions/WindowExtensions.kt b/app/src/main/java/com/nextcloud/utils/extensions/WindowExtensions.kt
index 41cccada97..1cd98d039c 100644
--- a/app/src/main/java/com/nextcloud/utils/extensions/WindowExtensions.kt
+++ b/app/src/main/java/com/nextcloud/utils/extensions/WindowExtensions.kt
@@ -9,28 +9,25 @@ package com.nextcloud.utils.extensions
import android.view.View
import android.view.Window
-import android.view.WindowManager
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
+import androidx.core.view.updatePadding
-fun Window?.makeStatusBarTransparent() {
- val flag = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
- this?.setFlags(flag, flag)
-}
-
-fun Window?.addStatusBarPadding() {
+fun Window?.addSystemBarPaddings() {
if (this == null) {
return
}
ViewCompat.setOnApplyWindowInsetsListener(decorView) { v: View, insets: WindowInsetsCompat ->
- val statusBarInsets = insets.getInsets(WindowInsetsCompat.Type.statusBars())
- v.setPadding(
- v.paddingLeft,
- statusBarInsets.top,
- v.paddingRight,
- v.paddingBottom
+ val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+
+ v.updatePadding(
+ left = bars.left,
+ top = bars.top,
+ right = bars.right,
+ bottom = bars.bottom,
)
- insets
+
+ WindowInsetsCompat.CONSUMED
}
}
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/BaseActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/BaseActivity.java
index 9c963aa26e..8b11e60b4d 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/BaseActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/BaseActivity.java
@@ -11,7 +11,6 @@ import android.accounts.Account;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
-import android.view.WindowManager;
import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
@@ -20,7 +19,6 @@ import com.nextcloud.client.mixins.MixinRegistry;
import com.nextcloud.client.mixins.SessionMixin;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.DarkMode;
-import com.nextcloud.utils.extensions.ActivityExtensionsKt;
import com.nextcloud.utils.extensions.WindowExtensionsKt;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@@ -35,7 +33,6 @@ import androidx.activity.EdgeToEdge;
import androidx.activity.SystemBarStyle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
-import androidx.core.view.WindowCompat;
/**
* Base activity with common behaviour for activities dealing with ownCloud {@link Account}s .
@@ -72,8 +69,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
enableEdgeToEdge();
- WindowExtensionsKt.makeStatusBarTransparent(getWindow());
- WindowExtensionsKt.addStatusBarPadding(getWindow());
+ WindowExtensionsKt.addSystemBarPaddings(getWindow());
super.onCreate(savedInstanceState);
sessionMixin = new SessionMixin(this, accountManager);
mixinRegistry.add(sessionMixin);
diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
index 973ecca38d..e2619d45d4 100644
--- a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
+++ b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
@@ -50,8 +50,6 @@ import com.nextcloud.client.network.ConnectivityService;
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
-import com.nextcloud.utils.extensions.ViewExtensionsKt;
-import com.nextcloud.utils.extensions.WindowExtensionsKt;
import com.nextcloud.utils.mdm.MDMConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
@@ -146,8 +144,6 @@ public class SettingsActivity extends PreferenceActivity
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
- WindowExtensionsKt.makeStatusBarTransparent(getWindow());
- WindowExtensionsKt.addStatusBarPadding(getWindow());
super.onCreate(savedInstanceState);
getDelegate().installViewFactory();
@@ -191,19 +187,6 @@ public class SettingsActivity extends PreferenceActivity
// workaround for mismatched color when app dark mode and system dark mode don't agree
setListBackground();
showPasscodeDialogIfEnforceAppProtection();
- adjustTopMarginForActionBar();
- }
-
- private void adjustTopMarginForActionBar() {
- if (getListView() == null) {
- return;
- }
-
- float topMarginInDp = getResources().getDimension(R.dimen.settings_activity_padding);
- int topMarginInPx = DisplayUtils.convertDpToPixel(topMarginInDp, this);
- ViewExtensionsKt.setMargins(getListView(), 0, topMarginInPx, 0, 0);
-
- getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(this, R.color.bg_default));
}
private void showPasscodeDialogIfEnforceAppProtection() {
diff --git a/app/src/main/res/values/dims.xml b/app/src/main/res/values/dims.xml
index ddcc166374..e1a65104fc 100644
--- a/app/src/main/res/values/dims.xml
+++ b/app/src/main/res/values/dims.xml
@@ -51,7 +51,6 @@
12dp
3dp
16dp
- 24dp
10dp
72dp
0dp