Skip to content

Commit

Permalink
Update compose UI to 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed Oct 3, 2023
1 parent 369a568 commit 0e03bd9
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ object Android {
const val minSdkLibraryCompose = 21
const val minSdkSample = 21
const val targetSdk = 33
const val compileSdk = 33
const val compileSdk = 34

// See compose/kotlin version mapping
// https://developer.android.com/jetpack/androidx/releases/compose-kotlin
const val composeCompiler = "1.4.7"
const val composeCompiler = "1.5.3"
}

object Plugins {
const val android = "com.android.tools.build:gradle:8.0.2"
const val android = "com.android.tools.build:gradle:8.1.0"
const val kotlin = Kotlin.gradlePlugin
const val kotlinter = "org.jmailen.gradle:kotlinter-gradle:3.14.0"
const val versions = "com.github.ben-manes:gradle-versions-plugin:0.46.0"
const val mavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.25.1"
const val kotlinter = "org.jmailen.gradle:kotlinter-gradle:3.16.0"
const val versions = "com.github.ben-manes:gradle-versions-plugin:0.48.0"
const val mavenPublish = "com.vanniktech:gradle-maven-publish-plugin:0.25.3"
}

object Kotlin {
private const val version = "1.8.21"
private const val version = "1.9.10"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val stdLib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
}
Expand All @@ -47,10 +47,10 @@ object Libs {
object View {
const val legacySupport = "androidx.legacy:legacy-support-v4:1.0.0"
const val appCompat = "androidx.appcompat:appcompat:1.6.1"
const val coreKtx = "androidx.core:core-ktx:1.10.0"
const val coreKtx = "androidx.core:core-ktx:1.12.0"
const val constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.4"
const val cardView = "androidx.cardview:cardview:1.0.0"
const val recyclerView = "androidx.recyclerview:recyclerview:1.3.0"
const val recyclerView = "androidx.recyclerview:recyclerview:1.3.1"
const val material = "com.google.android.material:material:1.9.0"

object Test {
Expand All @@ -64,14 +64,14 @@ object Libs {
}

object Compose {
private const val composeVersion = "1.5.0-beta01"
private const val composeVersion = "1.5.2"
const val ui = "androidx.compose.ui:ui:$composeVersion"
const val foundation = "androidx.compose.foundation:foundation:$composeVersion"
const val tooling = "androidx.compose.ui:ui-tooling:$composeVersion"
const val runtime = "androidx.compose.runtime:runtime:$composeVersion"
const val material = "androidx.compose.material:material:$composeVersion"
const val activity = "androidx.activity:activity-compose:1.7.2"
const val navigation = "com.google.accompanist:accompanist-navigation-animation:0.31.3-beta"
const val navigation = "androidx.navigation:navigation-compose:2.7.2"

object Test {
const val uiJunit = "androidx.compose.ui:ui-test-junit4:$composeVersion"
Expand Down
2 changes: 1 addition & 1 deletion compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion Android.compileSdk
compileSdk Android.compileSdk
namespace 'com.kizitonwose.calendar.compose'
defaultConfig {
minSdkVersion Android.minSdkLibraryCompose
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion Android.compileSdk
compileSdk Android.compileSdk
namespace 'com.kizitonwose.calendar.core'
defaultConfig {
minSdkVersion Android.minSdkLibraryCore
Expand Down
4 changes: 2 additions & 2 deletions data/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import com.kizitonwose.calendar.buildsrc.Android
import com.kizitonwose.calendar.buildsrc.Config
import com.kizitonwose.calendar.buildsrc.Libs
import com.kizitonwose.calendar.buildsrc.Kotlin
import com.kizitonwose.calendar.buildsrc.Libs

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion Android.compileSdk
compileSdk Android.compileSdk
namespace 'com.kizitonwose.calendar.data'
defaultConfig {
minSdkVersion Android.minSdkLibraryCore
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion Android.compileSdk
compileSdk Android.compileSdk
namespace 'com.kizitonwose.calendar.sample'
defaultConfig {
applicationId "com.kizitonwose.calendar.sample"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.kizitonwose.calendar.sample.compose
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand All @@ -20,15 +19,13 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.colorResource
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.google.accompanist.navigation.animation.AnimatedNavHost
import com.google.accompanist.navigation.animation.composable
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
import com.kizitonwose.calendar.sample.R
import com.kizitonwose.calendar.sample.shared.dateRangeDisplayText
import kotlinx.coroutines.launch

@OptIn(ExperimentalAnimationApi::class)
class CalendarComposeActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -37,7 +34,7 @@ class CalendarComposeActivity : AppCompatActivity() {
val primaryColor = colorResource(id = R.color.colorPrimary)
var toolBarTitle by remember { mutableStateOf("") }
var toolBarVisible by remember { mutableStateOf(true) }
val navController = rememberAnimatedNavController()
val navController = rememberNavController()
val coroutineScope = rememberCoroutineScope()
val scaffoldState = rememberScaffoldState()
LaunchedEffect(navController) {
Expand Down Expand Up @@ -96,7 +93,7 @@ class CalendarComposeActivity : AppCompatActivity() {
navController: NavHostController = rememberNavController(),
showSnack: (String) -> Unit = {},
) {
AnimatedNavHost(
NavHost(
modifier = modifier,
navController = navController,
startDestination = Page.List.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
@file:OptIn(ExperimentalAnimationApi::class)

package com.kizitonwose.calendar.sample.compose

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.AnimatedVisibilityScope
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.runtime.Composable
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavGraphBuilder
import com.google.accompanist.navigation.animation.composable
import androidx.navigation.compose.composable

private const val animDurationMillis = 400
private typealias SlideDirection = AnimatedContentTransitionScope.SlideDirection
private const val ANIM_DURATION_MILLIS = 400

fun NavGraphBuilder.horizontallyAnimatedComposable(
route: String,
Expand All @@ -24,16 +20,28 @@ fun NavGraphBuilder.horizontallyAnimatedComposable(
route = route,
content = content,
enterTransition = {
slideIntoContainer(SlideDirection.Left, animationSpec = tween(animDurationMillis))
slideIntoContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
exitTransition = {
slideOutOfContainer(SlideDirection.Left, animationSpec = tween(animDurationMillis))
slideOutOfContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
popEnterTransition = {
slideIntoContainer(SlideDirection.Right, animationSpec = tween(animDurationMillis))
slideIntoContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
popExitTransition = {
slideOutOfContainer(SlideDirection.Right, animationSpec = tween(animDurationMillis))
slideOutOfContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
)
}
Expand All @@ -46,16 +54,22 @@ fun NavGraphBuilder.verticallyAnimatedComposable(
route = route,
content = content,
enterTransition = {
slideIntoContainer(SlideDirection.Up, animationSpec = tween(animDurationMillis))
slideIntoContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Up,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
exitTransition = {
fadeOut(animationSpec = tween(animDurationMillis))
fadeOut(animationSpec = tween(ANIM_DURATION_MILLIS))
},
popEnterTransition = {
fadeIn(animationSpec = tween(animDurationMillis))
fadeIn(animationSpec = tween(ANIM_DURATION_MILLIS))
},
popExitTransition = {
slideOutOfContainer(SlideDirection.Down, animationSpec = tween(animDurationMillis))
slideOutOfContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Down,
animationSpec = tween(ANIM_DURATION_MILLIS),
)
},
)
}
2 changes: 1 addition & 1 deletion view/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion Android.compileSdk
compileSdk Android.compileSdk
namespace 'com.kizitonwose.calendar.view'
defaultConfig {
minSdkVersion Android.minSdkLibraryView
Expand Down

0 comments on commit 0e03bd9

Please sign in to comment.