Skip to content

Commit

Permalink
[All] Update to Compose 1.0.3 (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelvicnt authored Sep 30, 2021
1 parent 8eabbd6 commit d3432e1
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.app.Application
import androidx.compose.samples.crane.util.UnsplashSizingInterceptor
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.annotation.ExperimentalCoilApi
import coil.compose.rememberImagePainter
import dagger.hilt.android.HiltAndroidApp

Expand All @@ -30,6 +31,7 @@ class CraneApplication : Application(), ImageLoaderFactory {
* Create the singleton [ImageLoader].
* This is used by [rememberImagePainter] to load images in the app.
*/
@OptIn(ExperimentalCoilApi::class)
override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
.componentRegistry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package com.example.crane.buildsrc

object Versions {
const val ktLint = "0.41.0"
const val ktLint = "0.42.1"
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0"
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.2"
const val ktLint = "com.pinterest:ktlint:${Versions.ktLint}"

object GoogleMaps {
Expand All @@ -34,18 +34,18 @@ object Libs {
}

object Accompanist {
const val version = "0.18.0"
const val version = "0.19.0"
const val insets = "com.google.accompanist:accompanist-insets:$version"
}

object Kotlin {
private const val version = "1.5.21"
private const val version = "1.5.30"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"

object Coroutines {
private const val version = "1.5.0"
private const val version = "1.5.2"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version"
}
Expand All @@ -60,7 +60,7 @@ object Libs {

object Compose {
const val snapshot = ""
const val version = "1.0.2"
const val version = "1.0.3"

const val runtime = "androidx.compose.runtime:runtime:$version"
const val runtimeLivedata = "androidx.compose.runtime:runtime-livedata:$version"
Expand All @@ -74,8 +74,8 @@ object Libs {
}

object Lifecycle {
private const val version = "2.3.1"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
private const val version = "2.4.0-rc01"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:$version"
const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
}

Expand All @@ -93,7 +93,7 @@ object Libs {
}

object Hilt {
private const val version = "2.38.1"
private const val version = "2.39"

const val gradlePlugin = "com.google.dagger:hilt-android-gradle-plugin:$version"
const val android = "com.google.dagger:hilt-android:$version"
Expand All @@ -107,7 +107,7 @@ object Libs {
}

object Coil {
const val coilCompose = "io.coil-kt:coil-compose:1.3.0"
const val coilCompose = "io.coil-kt:coil-compose:1.3.2"
}
}

Expand Down
4 changes: 2 additions & 2 deletions JetNews/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ dependencies {

implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0-rc01"

implementation 'androidx.navigation:navigation-compose:2.4.0-alpha08'
implementation 'androidx.navigation:navigation-compose:2.4.0-alpha10'

androidTestImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import androidx.navigation.NavHostController
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navArgument
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.example.jetnews.data.AppContainer
import com.example.jetnews.ui.article.ArticleScreen
import com.example.jetnews.ui.article.ArticleViewModel
Expand Down
6 changes: 3 additions & 3 deletions JetNews/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
*/

buildscript {
ext.kotlin_version = '1.5.21'
ext.compose_version = '1.0.2'
ext.kotlin_version = '1.5.30'
ext.compose_version = '1.0.3'
ext.coroutines_version = '1.5.2'
ext.accompanist_version = '0.18.0'
ext.accompanist_version = '0.19.0'

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import coil.annotation.ExperimentalCoilApi
import coil.compose.rememberImagePainter
import com.example.jetcaster.R
import com.example.jetcaster.data.PodcastWithExtraInfo
Expand Down Expand Up @@ -177,10 +178,7 @@ fun HomeContent(
}

DynamicThemePrimaryColorsFromImage(dominantColorState) {
val pagerState = rememberPagerState(
pageCount = featuredPodcasts.size,
initialOffscreenLimit = 2,
)
val pagerState = rememberPagerState()

val selectedImageUrl = featuredPodcasts.getOrNull(pagerState.currentPage)
?.podcast?.imageUrl
Expand Down Expand Up @@ -322,6 +320,7 @@ fun FollowedPodcasts(
onPodcastUnfollowed: (String) -> Unit,
) {
HorizontalPager(
count = items.size,
state = pagerState,
modifier = modifier
) { page ->
Expand All @@ -338,6 +337,7 @@ fun FollowedPodcasts(
}
}

@OptIn(ExperimentalCoilApi::class)
@Composable
private fun FollowedPodcastCarouselItem(
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension.Companion.fillToConstraints
import androidx.constraintlayout.compose.Dimension.Companion.preferredWrapContent
import androidx.lifecycle.viewmodel.compose.viewModel
import coil.annotation.ExperimentalCoilApi
import coil.compose.rememberImagePainter
import com.example.jetcaster.R
import com.example.jetcaster.data.Episode
Expand Down Expand Up @@ -138,6 +139,7 @@ private fun EpisodeList(episodes: List<EpisodeToPodcast>) {
}
}

@OptIn(ExperimentalCoilApi::class)
@Composable
fun EpisodeListItem(
episode: Episode,
Expand Down Expand Up @@ -324,6 +326,7 @@ private fun CategoryPodcastRow(
}
}

@OptIn(ExperimentalCoilApi::class)
@Composable
private fun TopPodcastRowItem(
podcastTitle: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
package com.example.jetcaster.buildsrc

object Versions {
const val ktlint = "0.41.0"
const val ktlint = "0.42.1"
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0"
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.2"
const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.1.5"

object Accompanist {
const val version = "0.18.0"
const val version = "0.19.0"
const val insets = "com.google.accompanist:accompanist-insets:$version"
const val pager = "com.google.accompanist:accompanist-pager:$version"
}

object Kotlin {
private const val version = "1.5.21"
private const val version = "1.5.30"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
Expand Down Expand Up @@ -66,12 +66,12 @@ object Libs {
}

object Constraint {
const val constraintLayoutCompose = "androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02"
const val constraintLayoutCompose = "androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01"
}

object Compose {
const val snapshot = ""
const val version = "1.0.2"
const val version = "1.0.3"

@get:JvmStatic
val snapshotUrl: String
Expand All @@ -89,8 +89,8 @@ object Libs {
}

object Lifecycle {
private const val version = "2.3.1"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
private const val version = "2.4.0-rc01"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:$version"
const val viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
}

Expand Down Expand Up @@ -122,6 +122,6 @@ object Libs {
}

object Coil {
const val coilCompose = "io.coil-kt:coil-compose:1.3.0"
const val coilCompose = "io.coil-kt:coil-compose:1.3.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
package com.example.compose.jetchat.buildsrc

object Versions {
const val ktlint = "0.41.0"
const val ktlint = "0.42.1"
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0"
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.2"
const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.1.5"

const val junit = "junit:junit:4.13"

const val material = "com.google.android.material:material:1.3.0"

object Accompanist {
const val version = "0.18.0"
const val version = "0.19.0"
const val insets = "com.google.accompanist:accompanist-insets:$version"
}

object Kotlin {
private const val version = "1.5.21"
private const val version = "1.5.30"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
Expand All @@ -57,7 +57,7 @@ object Libs {

object Compose {
const val snapshot = ""
const val version = "1.0.2"
const val version = "1.0.3"

const val foundation = "androidx.compose.foundation:foundation:$version"
const val layout = "androidx.compose.foundation:foundation-layout:$version"
Expand All @@ -74,7 +74,7 @@ object Libs {
}

object Navigation {
private const val version = "2.3.4"
private const val version = "2.3.5"
const val fragment = "androidx.navigation:navigation-fragment-ktx:$version"
const val uiKtx = "androidx.navigation:navigation-ui-ktx:$version"
}
Expand All @@ -93,11 +93,11 @@ object Libs {
}

object Lifecycle {
private const val version = "2.3.1"
private const val version = "2.4.0-rc01"
const val extensions = "androidx.lifecycle:lifecycle-extensions:$version"
const val livedata = "androidx.lifecycle:lifecycle-livedata-ktx:$version"
const val viewmodel = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
const val viewModelCompose = "androidx.lifecycle:lifecycle-viewmodel-compose:$version"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.navArgument
import androidx.navigation.navArgument
import androidx.navigation.navigation
import com.example.jetsnack.ui.components.JetsnackScaffold
import com.example.jetsnack.ui.components.JetsnackSnackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ private fun ButtonPreview() {
@Composable
private fun RectangleButtonPreview() {
JetsnackTheme {
JetsnackButton(onClick = {}, shape = RectangleShape) {
JetsnackButton(
onClick = {}, shape = RectangleShape
) {
Text(text = "Demo")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import coil.annotation.ExperimentalCoilApi
import coil.compose.rememberImagePainter
import com.example.jetsnack.R
import com.example.jetsnack.model.CollectionType
Expand Down Expand Up @@ -272,6 +273,7 @@ private fun HighlightSnackItem(
}
}

@OptIn(ExperimentalCoilApi::class)
@Composable
fun SnackImage(
imageUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.example.jetsnack.ui.home.cart

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
Expand Down Expand Up @@ -51,10 +52,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.LastBaseline
Expand Down Expand Up @@ -130,6 +129,7 @@ fun Cart(
}
}

@OptIn(ExperimentalAnimationApi::class)
@Composable
private fun CartContent(
orderLines: List<OrderLine>,
Expand Down
Loading

0 comments on commit d3432e1

Please sign in to comment.