From 8825555be28d04d7e9cb3fc961e7e45ea93bff8b Mon Sep 17 00:00:00 2001 From: Chris Banes Date: Thu, 14 Sep 2023 11:48:57 +0300 Subject: [PATCH] Migrate away from InsetsX No longer needed now that Compose Multiplatform v1.5 added WindowInsets support --- common/ui/compose/build.gradle.kts | 1 - .../kotlin/app/tivi/common/compose/EntryGrid.kt | 5 +---- .../kotlin/app/tivi/common/compose/Layout.kt | 10 ++++------ .../kotlin/app/tivi/common/compose/ui/AppBar.kt | 6 ++---- gradle/libs.versions.toml | 2 -- .../kotlin/app/tivi/developer/log/DevLog.kt | 6 ++---- .../app/tivi/settings/developer/DevSettings.kt | 6 ++---- .../kotlin/app/tivi/home/discover/Discover.kt | 3 --- .../app/tivi/episodedetails/EpisodeDetails.kt | 2 +- .../kotlin/app/tivi/home/library/Library.kt | 3 --- .../app/tivi/settings/licenses/Licenses.kt | 6 ++---- .../src/commonMain/kotlin/app/tivi/home/Home.kt | 16 ++++++++-------- .../kotlin/app/tivi/home/search/Search.kt | 7 +++---- .../kotlin/app/tivi/settings/Settings.kt | 6 ++---- .../app/tivi/showdetails/details/ShowDetails.kt | 9 +++++---- .../app/tivi/showdetails/seasons/ShowSeasons.kt | 3 --- .../kotlin/app/tivi/home/upnext/UpNext.kt | 3 --- 17 files changed, 32 insertions(+), 62 deletions(-) diff --git a/common/ui/compose/build.gradle.kts b/common/ui/compose/build.gradle.kts index c0c4328e05..604800f68e 100644 --- a/common/ui/compose/build.gradle.kts +++ b/common/ui/compose/build.gradle.kts @@ -30,7 +30,6 @@ kotlin { api(libs.compose.material3.windowsizeclass) implementation(compose.animation) - api(libs.insetsx) implementation(libs.uuid) implementation(libs.paging.compose) diff --git a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/EntryGrid.kt b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/EntryGrid.kt index 3a4e844ffc..a8173c86c1 100644 --- a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/EntryGrid.kt +++ b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/EntryGrid.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight @@ -54,7 +53,6 @@ import app.tivi.common.compose.ui.RefreshButton import app.tivi.common.compose.ui.plus import app.tivi.data.compoundmodels.EntryWithShow import app.tivi.data.models.Entry -import com.moriatsushi.insetsx.systemBars import kotlin.math.roundToInt @OptIn(ExperimentalFoundationApi::class, ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class) @@ -117,7 +115,6 @@ fun EntryGrid( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { paddingValues -> val refreshing = lazyPagingItems.loadState.refresh == LoadStateLoading @@ -206,7 +203,7 @@ private fun EntryGridAppBar( ) } }, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), modifier = modifier, scrollBehavior = scrollBehavior, diff --git a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/Layout.kt b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/Layout.kt index fcb839bffc..41699ada09 100644 --- a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/Layout.kt +++ b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/Layout.kt @@ -5,17 +5,16 @@ package app.tivi.common.compose import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides -import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.composed import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.moriatsushi.insetsx.systemBars object Layout { val bodyMargin: Dp @@ -42,9 +41,8 @@ object Layout { fun Modifier.bodyWidth() = fillMaxWidth() .composed { - padding( + windowInsetsPadding( WindowInsets.systemBars - .only(WindowInsetsSides.Horizontal) - .asPaddingValues(), + .only(WindowInsetsSides.Horizontal), ) } diff --git a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/ui/AppBar.kt b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/ui/AppBar.kt index 7fedc236ad..14578f7d5a 100644 --- a/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/ui/AppBar.kt +++ b/common/ui/compose/src/commonMain/kotlin/app/tivi/common/compose/ui/AppBar.kt @@ -7,7 +7,6 @@ import androidx.compose.animation.Crossfade import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.only import androidx.compose.material3.ExperimentalMaterial3Api @@ -26,7 +25,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import app.tivi.data.models.TraktUser -import com.moriatsushi.insetsx.systemBars /** * A wrapper around [TopAppBar] which allows some [bottomContent] below the bar, but within the same @@ -60,7 +58,7 @@ fun TopAppBarWithBottomContent( titleContentColor = LocalContentColor.current, actionIconContentColor = LocalContentColor.current, ), - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), ) bottomContent?.invoke(this) @@ -82,7 +80,7 @@ fun TiviRootScreenAppBar( ) { TopAppBar( modifier = modifier, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), scrollBehavior = scrollBehavior, title = { Text(text = title) }, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d91c2b9e8b..c29a12a990 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,8 +83,6 @@ google-firebase-analytics = "com.google.firebase:firebase-analytics-ktx:21.3.0" google-firebase-crashlytics = "com.google.firebase:firebase-crashlytics-ktx:18.4.1" google-firebase-perf = "com.google.firebase:firebase-perf-ktx:20.4.1" -insetsx = "com.moriatsushi.insetsx:insetsx:0.1.0-alpha10" - imageloader = "io.github.qdsfdhvh:image-loader:1.6.7" junit = "junit:junit:4.13.2" diff --git a/ui/developer/log/src/commonMain/kotlin/app/tivi/developer/log/DevLog.kt b/ui/developer/log/src/commonMain/kotlin/app/tivi/developer/log/DevLog.kt index 8dab340dfd..90e463a290 100644 --- a/ui/developer/log/src/commonMain/kotlin/app/tivi/developer/log/DevLog.kt +++ b/ui/developer/log/src/commonMain/kotlin/app/tivi/developer/log/DevLog.kt @@ -4,7 +4,6 @@ package app.tivi.developer.log import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only @@ -20,6 +19,7 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -32,7 +32,6 @@ import androidx.compose.ui.unit.sp import app.tivi.common.compose.LocalStrings import app.tivi.screens.DevLogScreen import app.tivi.util.Severity -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -72,11 +71,10 @@ internal fun DevLog( ) } }, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), ) }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { contentPadding -> LazyColumn( diff --git a/ui/developer/settings/src/commonMain/kotlin/app/tivi/settings/developer/DevSettings.kt b/ui/developer/settings/src/commonMain/kotlin/app/tivi/settings/developer/DevSettings.kt index af9ec1ff74..c0f8e113b7 100644 --- a/ui/developer/settings/src/commonMain/kotlin/app/tivi/settings/developer/DevSettings.kt +++ b/ui/developer/settings/src/commonMain/kotlin/app/tivi/settings/developer/DevSettings.kt @@ -5,7 +5,6 @@ package app.tivi.settings.developer import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only @@ -18,13 +17,13 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import app.tivi.common.compose.LocalStrings import app.tivi.common.compose.ui.CheckboxPreference import app.tivi.common.compose.ui.Preference import app.tivi.screens.DevSettingsScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -64,11 +63,10 @@ internal fun DevSettings( ) } }, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), ) }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { contentPadding -> LazyColumn( diff --git a/ui/discover/src/commonMain/kotlin/app/tivi/home/discover/Discover.kt b/ui/discover/src/commonMain/kotlin/app/tivi/home/discover/Discover.kt index fceadea6cb..eb3258aaa4 100644 --- a/ui/discover/src/commonMain/kotlin/app/tivi/home/discover/Discover.kt +++ b/ui/discover/src/commonMain/kotlin/app/tivi/home/discover/Discover.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -75,7 +74,6 @@ import app.tivi.data.traktauth.TraktAuthState import app.tivi.overlays.showInDialog import app.tivi.screens.AccountScreen import app.tivi.screens.DiscoverScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.overlay.LocalOverlayHost import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen @@ -191,7 +189,6 @@ internal fun Discover( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { paddingValues -> val refreshState = rememberPullRefreshState(refreshing = false, onRefresh = refresh) diff --git a/ui/episode/details/src/commonMain/kotlin/app/tivi/episodedetails/EpisodeDetails.kt b/ui/episode/details/src/commonMain/kotlin/app/tivi/episodedetails/EpisodeDetails.kt index 9ae04b1c82..ad144ea2d9 100644 --- a/ui/episode/details/src/commonMain/kotlin/app/tivi/episodedetails/EpisodeDetails.kt +++ b/ui/episode/details/src/commonMain/kotlin/app/tivi/episodedetails/EpisodeDetails.kt @@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.sizeIn +import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.windowInsetsTopHeight import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -82,7 +83,6 @@ import app.tivi.data.models.Season import app.tivi.overlays.showInDialog import app.tivi.screens.EpisodeDetailsScreen import app.tivi.screens.EpisodeTrackScreen -import com.moriatsushi.insetsx.statusBars import com.slack.circuit.overlay.LocalOverlayHost import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen diff --git a/ui/library/src/commonMain/kotlin/app/tivi/home/library/Library.kt b/ui/library/src/commonMain/kotlin/app/tivi/home/library/Library.kt index cbf1a5b65c..5b662fea3c 100644 --- a/ui/library/src/commonMain/kotlin/app/tivi/home/library/Library.kt +++ b/ui/library/src/commonMain/kotlin/app/tivi/home/library/Library.kt @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize @@ -84,7 +83,6 @@ import app.tivi.data.traktauth.TraktAuthState import app.tivi.overlays.showInDialog import app.tivi.screens.AccountScreen import app.tivi.screens.LibraryScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.overlay.LocalOverlayHost import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen @@ -198,7 +196,6 @@ internal fun Library( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier.fillMaxSize(), ) { paddingValues -> val refreshState = rememberPullRefreshState( diff --git a/ui/licenses/src/commonMain/kotlin/app/tivi/settings/licenses/Licenses.kt b/ui/licenses/src/commonMain/kotlin/app/tivi/settings/licenses/Licenses.kt index 25bc84b3c6..58e00a6ad4 100644 --- a/ui/licenses/src/commonMain/kotlin/app/tivi/settings/licenses/Licenses.kt +++ b/ui/licenses/src/commonMain/kotlin/app/tivi/settings/licenses/Licenses.kt @@ -5,7 +5,6 @@ package app.tivi.settings.licenses import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only @@ -19,12 +18,12 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import app.tivi.common.compose.LocalStrings import app.tivi.common.compose.ui.Preference import app.tivi.screens.LicensesScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -64,11 +63,10 @@ internal fun Licenses( ) } }, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), ) }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { contentPadding -> LazyColumn( diff --git a/ui/root/src/commonMain/kotlin/app/tivi/home/Home.kt b/ui/root/src/commonMain/kotlin/app/tivi/home/Home.kt index a6e8089525..6ac0409a8e 100644 --- a/ui/root/src/commonMain/kotlin/app/tivi/home/Home.kt +++ b/ui/root/src/commonMain/kotlin/app/tivi/home/Home.kt @@ -12,10 +12,14 @@ import androidx.compose.foundation.layout.exclude import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeContent +import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.windowInsetsBottomHeight +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Subscriptions @@ -24,7 +28,6 @@ import androidx.compose.material.icons.filled.Weekend import androidx.compose.material.icons.outlined.VideoLibrary import androidx.compose.material.icons.outlined.Weekend import androidx.compose.material3.Divider -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem @@ -32,6 +35,7 @@ import androidx.compose.material3.NavigationDrawerItem import androidx.compose.material3.NavigationRail import androidx.compose.material3.NavigationRailItem import androidx.compose.material3.Scaffold +import androidx.compose.material3.ScaffoldDefaults import androidx.compose.material3.Text import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowSizeClass @@ -51,10 +55,6 @@ import app.tivi.screens.DiscoverScreen import app.tivi.screens.LibraryScreen import app.tivi.screens.SearchScreen import app.tivi.screens.UpNextScreen -import com.moriatsushi.insetsx.navigationBars -import com.moriatsushi.insetsx.safeContentPadding -import com.moriatsushi.insetsx.statusBars -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.backstack.SaveableBackStack import com.slack.circuit.backstack.isAtRoot import com.slack.circuit.foundation.NavigableCircuitContent @@ -99,7 +99,8 @@ internal fun Home( } }, // We let content handle the status bar - contentWindowInsets = WindowInsets.systemBars.exclude(WindowInsets.statusBars), + contentWindowInsets = ScaffoldDefaults.contentWindowInsets + .exclude(WindowInsets.statusBars), modifier = modifier, ) { paddingValues -> Row( @@ -206,12 +207,11 @@ private fun HomeNavigationDrawer( ) { Column( modifier = modifier - .safeContentPadding() + .windowInsetsPadding(WindowInsets.safeContent) .padding(16.dp) .widthIn(max = 280.dp), ) { for (item in navigationItems) { - @OptIn(ExperimentalMaterial3Api::class) NavigationDrawerItem( icon = { Icon( diff --git a/ui/search/src/commonMain/kotlin/app/tivi/home/search/Search.kt b/ui/search/src/commonMain/kotlin/app/tivi/home/search/Search.kt index 1143b6111f..490b386b01 100644 --- a/ui/search/src/commonMain/kotlin/app/tivi/home/search/Search.kt +++ b/ui/search/src/commonMain/kotlin/app/tivi/home/search/Search.kt @@ -16,7 +16,9 @@ import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBars import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.items @@ -53,8 +55,6 @@ import app.tivi.common.compose.ui.SearchTextField import app.tivi.common.compose.ui.plus import app.tivi.data.models.TiviShow import app.tivi.screens.SearchScreen -import com.moriatsushi.insetsx.statusBarsPadding -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -129,7 +129,7 @@ internal fun Search( Box( Modifier .padding(horizontal = Layout.bodyMargin, vertical = 8.dp) - .statusBarsPadding() + .windowInsetsPadding(WindowInsets.statusBars) .bodyWidth(), ) { var searchQuery by remember { mutableStateOf(TextFieldValue(state.query)) } @@ -157,7 +157,6 @@ internal fun Search( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { padding -> if (state.searchResults.isEmpty() && !state.refreshing) { diff --git a/ui/settings/src/commonMain/kotlin/app/tivi/settings/Settings.kt b/ui/settings/src/commonMain/kotlin/app/tivi/settings/Settings.kt index 9805cb5b55..3016f27584 100644 --- a/ui/settings/src/commonMain/kotlin/app/tivi/settings/Settings.kt +++ b/ui/settings/src/commonMain/kotlin/app/tivi/settings/Settings.kt @@ -6,7 +6,6 @@ package app.tivi.settings import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.only @@ -24,6 +23,7 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector @@ -35,7 +35,6 @@ import app.tivi.common.compose.ui.Preference import app.tivi.common.compose.ui.PreferenceDivider import app.tivi.common.compose.ui.PreferenceHeader import app.tivi.screens.SettingsScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -79,11 +78,10 @@ internal fun Settings( ) } }, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), ) }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier, ) { contentPadding -> LazyColumn( diff --git a/ui/show/details/src/commonMain/kotlin/app/tivi/showdetails/details/ShowDetails.kt b/ui/show/details/src/commonMain/kotlin/app/tivi/showdetails/details/ShowDetails.kt index 26832b6ef6..243c7574a1 100644 --- a/ui/show/details/src/commonMain/kotlin/app/tivi/showdetails/details/ShowDetails.kt +++ b/ui/show/details/src/commonMain/kotlin/app/tivi/showdetails/details/ShowDetails.kt @@ -26,6 +26,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -59,6 +60,7 @@ import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold +import androidx.compose.material3.ScaffoldDefaults import androidx.compose.material3.Snackbar import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState @@ -111,8 +113,6 @@ import app.tivi.data.models.ShowStatus import app.tivi.data.models.TiviShow import app.tivi.data.views.ShowsWatchStats import app.tivi.screens.ShowDetailsScreen -import com.moriatsushi.insetsx.navigationBars -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -237,7 +237,8 @@ internal fun ShowDetails( } }, // The nav bar is handled by the root Scaffold - contentWindowInsets = WindowInsets.systemBars.exclude(WindowInsets.navigationBars), + contentWindowInsets = ScaffoldDefaults.contentWindowInsets + .exclude(WindowInsets.navigationBars), modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection), ) { contentPadding -> Surface(modifier = Modifier.bodyWidth()) { @@ -976,7 +977,7 @@ private fun ShowDetailsAppBar( ) }, scrollBehavior = scrollBehavior, - windowInsets = WindowInsets.systemBars + windowInsets = TopAppBarDefaults.windowInsets .only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top), modifier = modifier, ) diff --git a/ui/show/seasons/src/commonMain/kotlin/app/tivi/showdetails/seasons/ShowSeasons.kt b/ui/show/seasons/src/commonMain/kotlin/app/tivi/showdetails/seasons/ShowSeasons.kt index 9095d99617..d3d99b5b08 100644 --- a/ui/show/seasons/src/commonMain/kotlin/app/tivi/showdetails/seasons/ShowSeasons.kt +++ b/ui/show/seasons/src/commonMain/kotlin/app/tivi/showdetails/seasons/ShowSeasons.kt @@ -8,7 +8,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -76,7 +75,6 @@ import app.tivi.data.compoundmodels.SeasonWithEpisodesAndWatches import app.tivi.data.models.Episode import app.tivi.data.models.Season import app.tivi.screens.ShowSeasonsScreen -import com.moriatsushi.insetsx.systemBars import com.slack.circuit.runtime.CircuitContext import com.slack.circuit.runtime.screen.Screen import com.slack.circuit.runtime.ui.Ui @@ -205,7 +203,6 @@ internal fun ShowSeasons( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier .testTag("show_seasons") .fillMaxSize(), diff --git a/ui/upnext/src/commonMain/kotlin/app/tivi/home/upnext/UpNext.kt b/ui/upnext/src/commonMain/kotlin/app/tivi/home/upnext/UpNext.kt index 521f869f80..5aeda66aaf 100644 --- a/ui/upnext/src/commonMain/kotlin/app/tivi/home/upnext/UpNext.kt +++ b/ui/upnext/src/commonMain/kotlin/app/tivi/home/upnext/UpNext.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize @@ -83,7 +82,6 @@ import app.tivi.overlays.showInDialog import app.tivi.screens.AccountScreen import app.tivi.screens.EpisodeTrackScreen import app.tivi.screens.UpNextScreen -import com.moriatsushi.insetsx.systemBars import com.seiko.imageloader.model.ImageResult import com.slack.circuit.overlay.LocalOverlayHost import com.slack.circuit.runtime.CircuitContext @@ -203,7 +201,6 @@ internal fun UpNext( ) } }, - contentWindowInsets = WindowInsets.systemBars, modifier = modifier.fillMaxSize(), ) { paddingValues -> val refreshState = rememberPullRefreshState(