Skip to content

Commit

Permalink
update androidx window core
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlaster committed May 3, 2024
1 parent e36281e commit cdca31b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.material3.adaptive.currentWindowSize
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
Expand All @@ -73,6 +74,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.toSize
import androidx.window.core.layout.WindowWidthSizeClass
import com.eygraber.compose.placeholder.material3.placeholder
import com.ramcosta.composedestinations.annotation.Destination
Expand Down Expand Up @@ -473,6 +475,10 @@ private fun ProfileScreen(
RegisterTabCallback(tabState = tabState, lazyListState = listState)
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
val windowInfo = currentWindowAdaptiveInfo()
val windowSize =
with(LocalDensity.current) {
currentWindowSize().toSize().toDpSize()
}
val bigScreen = windowInfo.windowSizeClass.windowWidthSizeClass == WindowWidthSizeClass.EXPANDED
FlareScaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
Expand Down Expand Up @@ -585,8 +591,8 @@ private fun ProfileScreen(
Row {
if (bigScreen) {
val width =
when (windowInfo.windowSizeClass.widthDp) {
in 840..1024 -> 332.dp
when (windowSize.width) {
in 840.dp..1024.dp -> 332.dp
else -> 432.dp
}
Column(
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ navigation-compose = { group = "androidx.navigation", name = "navigation-compose
composeIcons-fontAwesome = { module = "br.com.devsrsouza.compose.icons:font-awesome", version.ref = "composeIcons" }
datastore = { group = "androidx.datastore", name = "datastore", version = "1.1.1" }
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
androidx-window = { group = "androidx.window", name = "window-core", version = "1.3.0-beta01" }
androidx-window = { group = "androidx.window", name = "window-core", version = "1.3.0-beta02" }
androidx-splash = { group = "androidx.core", name = "core-splashscreen", version = "1.2.0-alpha01" }

media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }
Expand Down

0 comments on commit cdca31b

Please sign in to comment.