File tree Expand file tree Collapse file tree
app/src/main/java/me/bmax/apatch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ import me.bmax.apatch.util.Version.getManagerVersion
145145import me.bmax.apatch.util.getSELinuxStatus
146146import me.bmax.apatch.util.reboot
147147import me.bmax.apatch.util.ui.APDialogBlurBehindUtils
148+ import me.bmax.apatch.util.ui.HomeBottomSpacer
148149
149150private val managerVersion = getManagerVersion()
150151
@@ -226,7 +227,7 @@ fun HomeScreenV1(
226227 if (! hideApatchCard) {
227228 LearnMoreCard ()
228229 }
229- Spacer ( Modifier )
230+ HomeBottomSpacer ( )
230231 }
231232}
232233
@@ -254,7 +255,7 @@ fun HomeScreenSign(
254255 if (! hideApatchCard) {
255256 LearnMoreCard ()
256257 }
257- Spacer ( Modifier )
258+ HomeBottomSpacer ( )
258259 }
259260}
260261
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ import me.bmax.apatch.ui.theme.BackgroundConfig
4747import androidx.compose.material3.surfaceColorAtElevation
4848import kotlinx.coroutines.Dispatchers
4949import kotlinx.coroutines.withContext
50+ import me.bmax.apatch.util.ui.HomeBottomSpacer
5051
5152@Composable
5253fun HomeScreenCircle (
@@ -207,7 +208,7 @@ fun HomeScreenCircle(
207208 LearnMoreCardCircle ()
208209 }
209210
210- Spacer ( Modifier )
211+ HomeBottomSpacer ( )
211212 }
212213}
213214
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import me.bmax.apatch.ui.viewmodel.TimeSeriesData
3636import me.bmax.apatch.util.AppData
3737import me.bmax.apatch.ui.theme.BackgroundConfig
3838import kotlin.math.roundToInt
39+ import me.bmax.apatch.util.ui.HomeBottomSpacer
3940
4041@Composable
4142fun HomeScreenStats (
@@ -722,4 +723,6 @@ private fun StatsGridTopSection(
722723 if (kpState != APApplication .State .UNKNOWN_STATE && apState != APApplication .State .ANDROIDPATCH_INSTALLED ) {
723724 AStatusCard (apState)
724725 }
726+
727+ HomeBottomSpacer ()
725728}
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import coil.request.ImageRequest
3939import android.os.Build
4040import me.bmax.apatch.apApp
4141import me.bmax.apatch.util.Version.getManagerVersion
42+ import me.bmax.apatch.util.ui.HomeBottomSpacer
4243
4344private val managerVersion = getManagerVersion()
4445
@@ -174,7 +175,7 @@ fun HomeScreenV2(
174175 LearnMoreCard ()
175176 }
176177
177- Spacer ( Modifier .height( 16 .dp) )
178+ HomeBottomSpacer ( )
178179 }
179180}
180181
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import me.bmax.apatch.util.Version
4040import me.bmax.apatch.util.Version.getManagerVersion
4141import me.bmax.apatch.util.getSELinuxStatus
4242import me.bmax.apatch.util.rootShellForResult
43+ import me.bmax.apatch.util.ui.HomeBottomSpacer
4344
4445private val managerVersion = getManagerVersion()
4546
@@ -178,7 +179,7 @@ fun HomeScreenV3(
178179 StorageCard (isWallpaperMode = isWallpaperMode)
179180 }
180181
181- Spacer ( Modifier .height( 16 .dp) )
182+ HomeBottomSpacer ( )
182183 }
183184 }
184185}
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ import me.bmax.apatch.util.Version.getManagerVersion
120120import me.bmax.apatch.util.getSELinuxStatus
121121import me.bmax.apatch.util.reboot
122122import me.bmax.apatch.util.rootShellForResult
123+ import me.bmax.apatch.util.ui.HomeBottomSpacer
123124
124125private val managerVersion = getManagerVersion()
125126
@@ -314,7 +315,7 @@ fun HomeScreenV4(
314315 }
315316 }
316317
317- Spacer ( Modifier )
318+ HomeBottomSpacer ( )
318319 }
319320}
320321
Original file line number Diff line number Diff line change 1+ package me.bmax.apatch.util.ui
2+
3+ import androidx.compose.animation.core.animateDpAsState
4+ import androidx.compose.animation.core.tween
5+ import androidx.compose.foundation.layout.Spacer
6+ import androidx.compose.foundation.layout.WindowInsets
7+ import androidx.compose.foundation.layout.asPaddingValues
8+ import androidx.compose.foundation.layout.height
9+ import androidx.compose.foundation.layout.navigationBars
10+ import androidx.compose.runtime.Composable
11+ import androidx.compose.runtime.getValue
12+ import androidx.compose.ui.Modifier
13+ import androidx.compose.ui.unit.dp
14+ import me.bmax.apatch.ui.LocalBottomBarVisible
15+ import me.bmax.apatch.ui.LocalIsFloatingNavMode
16+
17+ @Composable
18+ fun HomeBottomSpacer (modifier : Modifier = Modifier ) {
19+ val isFloatingMode = LocalIsFloatingNavMode .current
20+ val bottomBarVisible = LocalBottomBarVisible .current.value
21+ val navBarBottom = WindowInsets .navigationBars.asPaddingValues().calculateBottomPadding()
22+
23+ val targetHeight by animateDpAsState(
24+ targetValue = when {
25+ isFloatingMode && bottomBarVisible -> 80 .dp + navBarBottom
26+ isFloatingMode -> navBarBottom
27+ else -> 16 .dp
28+ },
29+ animationSpec = tween(durationMillis = 300 ),
30+ label = " homeBottomSpacer"
31+ )
32+
33+ Spacer (modifier.height(targetHeight))
34+ }
You can’t perform that action at this time.
0 commit comments