Merge pull request #9 from oleksandrbalan/feature/compose-2023.01.00

Update to compose bom 2023.01.00
This commit is contained in:
Oleksandr Balan
2023-03-20 17:45:27 +01:00
committed by GitHub
12 changed files with 71 additions and 50 deletions

View File

@@ -4,15 +4,16 @@ buildscript {
min_sdk_version = 24
target_sdk_version = 33
compose_version = "1.3.0"
compose_compiler_version = "1.3.2"
activity = "1.6.1"
compose_bom_version = "2023.01.00"
compose_compiler_version = "1.4.2"
accompanist_version = "0.28.0"
activity_version = "1.6.1"
}
}
plugins {
id "com.android.application" version "7.3.1" apply false
id "com.android.library" version "7.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.7.20" apply false
id "com.android.application" version '7.4.2' apply false
id "com.android.library" version '7.4.2' apply false
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
id "io.gitlab.arturbosch.detekt" version "1.21.0"
id "com.diffplug.spotless" version "6.5.1"
id "com.vanniktech.maven.publish" version "0.21.0"

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>

View File

@@ -1,6 +1,6 @@
#Wed Nov 09 10:15:20 CET 2022
#Wed Mar 15 10:05:21 CET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -39,6 +39,7 @@ android {
}
dependencies {
implementation("androidx.compose.ui:ui:$compose_version")
implementation("androidx.compose.foundation:foundation:$compose_version")
implementation(platform("androidx.compose:compose-bom:$compose_bom_version"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.foundation:foundation")
}