Update to compose bom 2023.01.00

This commit is contained in:
Oleksandr Balan
2023-03-20 17:16:56 +01:00
parent 14fb43987a
commit 2c1d7b3ef9
12 changed files with 71 additions and 50 deletions

View File

@@ -50,7 +50,9 @@ android {
dependencies {
implementation(project(":pagecurl"))
implementation("androidx.compose.ui:ui:$compose_version")
implementation("androidx.compose.material:material:$compose_version")
implementation("androidx.activity:activity-compose:$activity")
implementation(platform("androidx.compose:compose-bom:$compose_bom_version"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material:material")
implementation("androidx.activity:activity-compose:$activity_version")
implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanist_version")
}

View File

@@ -16,6 +16,7 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowRight
@@ -55,15 +56,17 @@ class MainActivity : ComponentActivity() {
example = null
}
Crossfade(targetState = example, Modifier.safeDrawingPadding()) { selected ->
when (selected) {
null -> RootScreen(onExampleClick = { example = it })
Example.SimplePageCurl -> SimplePageCurlScreen()
Example.SettingsPageCurl -> SettingsPageCurlScreen()
Example.StateInPageCurl -> StateInPageCurlScreen()
Example.InteractionConfigInPageCurl -> InteractionConfigInPageCurlScreen()
Example.ShadowPageCurl -> ShadowInPageCurlScreen()
Example.BackPagePageCurl -> BackPagePageCurlScreen()
Surface(color = MaterialTheme.colors.background) {
Crossfade(targetState = example, Modifier.safeDrawingPadding()) { selected ->
when (selected) {
null -> RootScreen(onExampleClick = { example = it })
Example.SimplePageCurl -> SimplePageCurlScreen()
Example.SettingsPageCurl -> SettingsPageCurlScreen()
Example.StateInPageCurl -> StateInPageCurlScreen()
Example.InteractionConfigInPageCurl -> InteractionConfigInPageCurlScreen()
Example.ShadowPageCurl -> ShadowInPageCurlScreen()
Example.BackPagePageCurl -> BackPagePageCurlScreen()
}
}
}
}

View File

@@ -1,6 +1,7 @@
package eu.wewox.pagecurl.components
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
@@ -19,5 +20,6 @@ fun TopBar(title: String) {
style = MaterialTheme.typography.h4,
modifier = Modifier
.padding(SpacingMedium)
.statusBarsPadding()
)
}

View File

@@ -52,14 +52,18 @@ fun ZoomOutLayout(
bottom = bottom,
modifier = modifier,
) {
// Animate radius and elevation with the same value, because we not :)
// Animate radius and elevation with the same value, because why not :)
val cornersAndElevation by animateDpAsState(if (zoomOut) 16.dp else 0.dp)
Card(
shape = RoundedCornerShape(cornersAndElevation),
elevation = cornersAndElevation,
content = pageCurl,
)
if (cornersAndElevation != 0.dp) {
Card(
shape = RoundedCornerShape(cornersAndElevation),
elevation = cornersAndElevation,
content = pageCurl,
)
} else {
pageCurl()
}
}
}

View File

@@ -4,7 +4,5 @@ package eu.wewox.pagecurl.ui.theme
import androidx.compose.ui.graphics.Color
val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5)
val LightBlue = Color(0xFF6DD3FF)
val LightYellow = Color(0xFFFFF281)

View File

@@ -6,17 +6,28 @@ import androidx.compose.material.Typography
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.Color
import com.google.accompanist.systemuicontroller.rememberSystemUiController
private val DarkColorPalette = darkColors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200,
primary = LightBlue,
primaryVariant = LightBlue,
secondary = LightYellow,
secondaryVariant = LightYellow,
onPrimary = Color.Black,
onSecondary = Color.Black,
)
private val LightColorPalette = lightColors(
primary = Purple500,
primaryVariant = Purple700,
secondary = Teal200,
primary = LightBlue,
primaryVariant = LightBlue,
secondary = LightYellow,
secondaryVariant = LightYellow,
onPrimary = Color.Black,
onSecondary = Color.Black,
)
/**
@@ -24,6 +35,15 @@ private val LightColorPalette = lightColors(
*/
@Composable
fun PageCurlTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) {
val sysUiController = rememberSystemUiController()
SideEffect {
sysUiController.setSystemBarsColor(
color = Color.Transparent,
darkIcons = !darkTheme,
isNavigationBarContrastEnforced = false
)
}
val colors = if (darkTheme) {
DarkColorPalette
} else {

View File

@@ -1,10 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@@ -2,6 +2,6 @@
<resources>
<style name="Theme.PageCurl" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@color/purple_700</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>