From b4dfcee04140cdfa5714718d3dec14311a4229d5 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:01:13 +0400 Subject: [PATCH 1/4] fix(YouTube - Settings): Do not clip settings menus when using an Android 15 device --- .../preference/AbstractPreferenceFragment.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java index 038dfefafc..984ff81f41 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java @@ -8,12 +8,14 @@ import android.app.Dialog; import android.content.Context; import android.content.SharedPreferences; +import android.graphics.Insets; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.preference.*; import android.util.TypedValue; import android.view.ViewGroup; +import android.view.WindowInsets; import android.widget.TextView; import android.widget.Toolbar; @@ -310,6 +312,18 @@ private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) { .findViewById(android.R.id.content) .getParent(); + // Fix required for Android 15 and YT 19.46+ + // FIXME: + // On Android 15 the text layout is not aligned the same as the parent + // screen and it looks a little off. Otherwise this works. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + rootView.setOnApplyWindowInsetsListener((v, insets) -> { + Insets statusInsets = insets.getInsets(WindowInsets.Type.statusBars()); + v.setPadding(0, statusInsets.top, 0, 0); + return insets; + }); + } + Toolbar toolbar = new Toolbar(childScreen.getContext()); toolbar.setTitle(childScreen.getTitle()); toolbar.setNavigationIcon(getBackButtonDrawable()); From f57fc2c62abc33eedc360749dd6bb1618937744c Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:43:55 +0400 Subject: [PATCH 2/4] fix: Change SDK to 35 (Android 15), apply menu fix only for Android 15 devices. --- extensions/shared/build.gradle.kts | 2 ++ .../shared/settings/preference/AbstractPreferenceFragment.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/shared/build.gradle.kts b/extensions/shared/build.gradle.kts index 5abaf83aba..2d04800bbd 100644 --- a/extensions/shared/build.gradle.kts +++ b/extensions/shared/build.gradle.kts @@ -10,6 +10,8 @@ android { isMinifyEnabled = true } } + compileSdk = 35 + buildToolsVersion = "35.0.0" } dependencies { diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java index 984ff81f41..ea591f876c 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java @@ -316,7 +316,7 @@ private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) { // FIXME: // On Android 15 the text layout is not aligned the same as the parent // screen and it looks a little off. Otherwise this works. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { rootView.setOnApplyWindowInsetsListener((v, insets) -> { Insets statusInsets = insets.getInsets(WindowInsets.Type.statusBars()); v.setPadding(0, statusInsets.top, 0, 0); From 849d566e719c7905028ec48cc2d96b68504896cc Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:11:02 +0400 Subject: [PATCH 3/4] Revert "fix: Change SDK to 35 (Android 15), apply menu fix only for Android 15 devices." This reverts commit f57fc2c62abc33eedc360749dd6bb1618937744c. --- extensions/shared/build.gradle.kts | 2 -- .../shared/settings/preference/AbstractPreferenceFragment.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/extensions/shared/build.gradle.kts b/extensions/shared/build.gradle.kts index 2d04800bbd..5abaf83aba 100644 --- a/extensions/shared/build.gradle.kts +++ b/extensions/shared/build.gradle.kts @@ -10,8 +10,6 @@ android { isMinifyEnabled = true } } - compileSdk = 35 - buildToolsVersion = "35.0.0" } dependencies { diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java index ea591f876c..984ff81f41 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java @@ -316,7 +316,7 @@ private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) { // FIXME: // On Android 15 the text layout is not aligned the same as the parent // screen and it looks a little off. Otherwise this works. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { rootView.setOnApplyWindowInsetsListener((v, insets) -> { Insets statusInsets = insets.getInsets(WindowInsets.Type.statusBars()); v.setPadding(0, statusInsets.top, 0, 0); From 4916bbca0a04115bc262a83129f5f673781103d6 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:29:01 +0400 Subject: [PATCH 4/4] comments --- .../shared/settings/preference/AbstractPreferenceFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java index 984ff81f41..b7dd650633 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/settings/preference/AbstractPreferenceFragment.java @@ -312,7 +312,7 @@ private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) { .findViewById(android.R.id.content) .getParent(); - // Fix required for Android 15 and YT 19.46+ + // Fix required for Android 15 and YT 19.45+ // FIXME: // On Android 15 the text layout is not aligned the same as the parent // screen and it looks a little off. Otherwise this works.