Apply only for api level 35

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-11-29 12:31:32 +01:00 committed by Tobias Kaminsky
parent 9487e8b3c8
commit b9be105730
2 changed files with 19 additions and 5 deletions

View file

@ -10,6 +10,7 @@ package com.owncloud.android.ui.activity;
import android.accounts.Account; import android.accounts.Account;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import com.nextcloud.client.account.User; import com.nextcloud.client.account.User;
@ -68,8 +69,13 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
enableEdgeToEdge(); boolean isApiLevel35OrHigher = (Build.VERSION.SDK_INT >= 35);
WindowExtensionsKt.addSystemBarPaddings(getWindow());
if (isApiLevel35OrHigher) {
enableEdgeToEdge();
WindowExtensionsKt.addSystemBarPaddings(getWindow());
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
sessionMixin = new SessionMixin(this, accountManager); sessionMixin = new SessionMixin(this, accountManager);
mixinRegistry.add(sessionMixin); mixinRegistry.add(sessionMixin);

View file

@ -23,6 +23,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
@ -146,8 +147,12 @@ public class SettingsActivity extends PreferenceActivity
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
WindowExtensionsKt.addSystemBarPaddings(getWindow()); boolean isApiLevel35OrHigher = (Build.VERSION.SDK_INT >= 35);
WindowExtensionsKt.setNoLimitLayout(getWindow()); if (isApiLevel35OrHigher) {
WindowExtensionsKt.addSystemBarPaddings(getWindow());
WindowExtensionsKt.setNoLimitLayout(getWindow());
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getDelegate().installViewFactory(); getDelegate().installViewFactory();
@ -191,7 +196,10 @@ public class SettingsActivity extends PreferenceActivity
// workaround for mismatched color when app dark mode and system dark mode don't agree // workaround for mismatched color when app dark mode and system dark mode don't agree
setListBackground(); setListBackground();
showPasscodeDialogIfEnforceAppProtection(); showPasscodeDialogIfEnforceAppProtection();
adjustTopMarginForActionBar();
if (isApiLevel35OrHigher) {
adjustTopMarginForActionBar();
}
} }
private void adjustTopMarginForActionBar() { private void adjustTopMarginForActionBar() {