From cabcccf15761af9adc7e47b6b96a03456ab69df4 Mon Sep 17 00:00:00 2001 From: David Hontiveros Gordo Date: Tue, 2 Sep 2025 13:00:49 +0200 Subject: [PATCH 1/5] ANDROID-16185/update-a16: Update compileSdk and targetSdk from 34 -> 36 --- library/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 6729450..e152012 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -6,11 +6,11 @@ plugins { android { namespace "com.telefonica.tweaks" - compileSdk 34 + compileSdk 36 defaultConfig { minSdk 21 - targetSdk 34 + targetSdk 36 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" From c408380ae7e601b44725e9a1ad61e2ec1d3517eb Mon Sep 17 00:00:00 2001 From: David Hontiveros Gordo Date: Wed, 3 Sep 2025 08:43:21 +0200 Subject: [PATCH 2/5] ANDROID-16185/update-a16: Update client :app module --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a3f4007..06d7315 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,12 +5,12 @@ plugins { android { namespace "com.telefonica.tweaks.demo" - compileSdk 34 + compileSdk 36 defaultConfig { applicationId "com.telefonica.tweaks.demo" minSdk 21 - targetSdk 34 + targetSdk 36 versionCode 1 versionName "1.0" From a62b4efe356e888e5748d813271218205fe23ab0 Mon Sep 17 00:00:00 2001 From: David Hontiveros Gordo Date: Wed, 3 Sep 2025 09:44:13 +0200 Subject: [PATCH 3/5] ANDROID-16185/update-a16: Include a Modifier composable function to provide WindowInsets spaces in portrait and landscape mode --- .../telefonica/tweaks/ui/TweakComponents.kt | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt index 6550df1..1a4d9e5 100644 --- a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt +++ b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt @@ -1,5 +1,6 @@ package com.telefonica.tweaks.ui +import android.content.res.Configuration import android.widget.Toast import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background @@ -10,13 +11,20 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.displayCutout import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.ime import androidx.compose.foundation.layout.navigationBars +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.statusBars +import androidx.compose.foundation.layout.systemGestures +import androidx.compose.foundation.layout.union import androidx.compose.foundation.layout.windowInsetsBottomHeight +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.layout.windowInsetsTopHeight import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions @@ -57,6 +65,7 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.platform.LocalClipboardManager +import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.platform.SoftwareKeyboardController @@ -99,11 +108,12 @@ fun TweaksScreen( .fillMaxSize() .background(TweaksTheme.colors.tweaksBackground) .padding(horizontal = 16.dp) + .edgeToEdgeInsetsForOrientation() .verticalScroll(scrollState), verticalArrangement = Arrangement.spacedBy(8.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { - Spacer(modifier = Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) +// Spacer(modifier = Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) tweaksGraph.cover?.let { TweakGroupBody( @@ -118,7 +128,7 @@ fun TweaksScreen( text = category.title, ) } - Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) +// Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } @@ -134,6 +144,7 @@ fun TweaksCategoryScreen( .fillMaxSize() .background(TweaksTheme.colors.tweaksBackground) .padding(horizontal = 16.dp) + .edgeToEdgeInsetsForOrientation() .verticalScroll(scrollState), verticalArrangement = Arrangement.spacedBy(8.dp), horizontalAlignment = Alignment.CenterHorizontally, @@ -600,4 +611,27 @@ internal fun TweakButton( color = TweaksTheme.colors.tweaksOnPrimary, ) } +} + +@Composable +fun Modifier.edgeToEdgeInsetsForOrientation(includeIme: Boolean = true): Modifier { + val isLandscape = + LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE + + val sides = + if (isLandscape) WindowInsetsSides.Top + WindowInsetsSides.Horizontal + else WindowInsetsSides.Top + WindowInsetsSides.Bottom + + var base = WindowInsets.statusBars + .union(WindowInsets.navigationBars) + .union(WindowInsets.displayCutout) + .union(WindowInsets.systemGestures) + .only(sides) + + if (includeIme && !isLandscape) { + // In portrait mode: is add the IME space + base = base.union(WindowInsets.ime.only(WindowInsetsSides.Bottom)) + } + + return this.windowInsetsPadding(base) } \ No newline at end of file From e37168a0cb2722258e11fc7e398c0357c2afa47f Mon Sep 17 00:00:00 2001 From: David Hontiveros Gordo Date: Wed, 3 Sep 2025 10:21:31 +0200 Subject: [PATCH 4/5] ANDROID-16185/update-a16: Remove commented lines --- .../java/com/telefonica/tweaks/ui/TweakComponents.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt index 1a4d9e5..1c3494f 100644 --- a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt +++ b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt @@ -113,8 +113,6 @@ fun TweaksScreen( verticalArrangement = Arrangement.spacedBy(8.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { -// Spacer(modifier = Modifier.windowInsetsTopHeight(WindowInsets.statusBars)) - tweaksGraph.cover?.let { TweakGroupBody( tweakGroup = it, @@ -128,7 +126,6 @@ fun TweaksScreen( text = category.title, ) } -// Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)) } } @@ -614,7 +611,7 @@ internal fun TweakButton( } @Composable -fun Modifier.edgeToEdgeInsetsForOrientation(includeIme: Boolean = true): Modifier { +fun Modifier.edgeToEdgeInsetsForOrientation(): Modifier { val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE @@ -628,10 +625,5 @@ fun Modifier.edgeToEdgeInsetsForOrientation(includeIme: Boolean = true): Modifie .union(WindowInsets.systemGestures) .only(sides) - if (includeIme && !isLandscape) { - // In portrait mode: is add the IME space - base = base.union(WindowInsets.ime.only(WindowInsetsSides.Bottom)) - } - return this.windowInsetsPadding(base) } \ No newline at end of file From 6be6913f803fce8ce0c090b4682759eec93c62af Mon Sep 17 00:00:00 2001 From: David Hontiveros Gordo Date: Wed, 3 Sep 2025 10:27:31 +0200 Subject: [PATCH 5/5] ANDROID-16185/update-a16: Remove unused code --- .../src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt index 1c3494f..1b4d664 100644 --- a/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt +++ b/library/src/enabled/java/com/telefonica/tweaks/ui/TweakComponents.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.displayCutout import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.ime import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding