From a082bcb7daf2c7011c00fe991008555d859ab149 Mon Sep 17 00:00:00 2001 From: skydoves Date: Fri, 7 Oct 2022 10:09:48 +0900 Subject: [PATCH] Update demo codes --- app/build.gradle | 12 +++---- .../androiddeveloperroadmap/MainActivity.kt | 34 +++++++++++-------- .../androiddeveloperroadmap/ui/theme/Color.kt | 2 ++ .../androiddeveloperroadmap/ui/theme/Theme.kt | 9 ----- build.gradle | 9 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 6 ++-- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2806edb..1d0a802 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,12 +4,12 @@ plugins { } android { - compileSdk 31 + compileSdk 33 defaultConfig { applicationId "io.getstream.androiddeveloperroadmap" minSdk 21 - targetSdk 31 + targetSdk 33 versionCode 1 versionName "1.0" } @@ -28,7 +28,7 @@ android { } composeOptions { - kotlinCompilerExtensionVersion compose_version + kotlinCompilerExtensionVersion compose_compiler_version } packagingOptions { @@ -39,7 +39,6 @@ android { } dependencies { - implementation "androidx.core:core-ktx:1.7.0" implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" @@ -48,7 +47,8 @@ dependencies { implementation "androidx.compose.foundation:foundation-layout:$compose_version" implementation "androidx.activity:activity-compose:$compose_activity_version" - implementation "com.mxalbert.zoomable:zoomable:$zoomable_version" + implementation "com.github.skydoves:landscapist-coil:$landscapist_version" + implementation "com.github.skydoves:landscapist-placeholder:$landscapist_version" - implementation("io.coil-kt:coil-compose:1.4.0") + implementation "com.mxalbert.zoomable:zoomable:$zoomable_version" } diff --git a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/MainActivity.kt b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/MainActivity.kt index 9d7dfc3..6494895 100644 --- a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/MainActivity.kt +++ b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/MainActivity.kt @@ -19,7 +19,6 @@ package io.getstream.androiddeveloperroadmap import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.compose.foundation.Image import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface @@ -27,9 +26,13 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.tooling.preview.Preview -import coil.compose.rememberImagePainter import com.mxalbert.zoomable.Zoomable +import com.skydoves.landscapist.ImageOptions +import com.skydoves.landscapist.coil.CoilImage +import com.skydoves.landscapist.components.rememberImageComponent +import com.skydoves.landscapist.placeholder.shimmer.ShimmerPlugin import io.getstream.androiddeveloperroadmap.ui.theme.AndroidDeveloperRoadmapTheme +import io.getstream.androiddeveloperroadmap.ui.theme.shimmerHighLight class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -40,7 +43,7 @@ class MainActivity : ComponentActivity() { Surface( color = MaterialTheme.colors.background ) { - Roadmap() + AndroidRoadmap() } } } @@ -48,20 +51,21 @@ class MainActivity : ComponentActivity() { } @Composable -private fun Roadmap() { +private fun AndroidRoadmap() { Zoomable( modifier = Modifier.fillMaxSize(), ) { - Image( - painter = rememberImagePainter( - "https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png", - builder = { - placeholder(R.drawable.roadmap_preview) - } - ), - modifier = Modifier.fillMaxSize(), - contentScale = ContentScale.Fit, - contentDescription = null + val background = MaterialTheme.colors.background + CoilImage( + imageModel = "https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png", + component = rememberImageComponent { + // shows a shimmering effect when loading an image. + +ShimmerPlugin( + baseColor = background, + highlightColor = shimmerHighLight + ) + }, + imageOptions = ImageOptions(contentScale = ContentScale.Fit) ) } } @@ -70,6 +74,6 @@ private fun Roadmap() { @Composable private fun DefaultPreview() { AndroidDeveloperRoadmapTheme { - Roadmap() + AndroidRoadmap() } } diff --git a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Color.kt b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Color.kt index 4ec0a65..7a76c8c 100644 --- a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Color.kt +++ b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Color.kt @@ -22,3 +22,5 @@ val Purple200 = Color(0xFFBB86FC) val Purple500 = Color(0xFF6200EE) val Purple700 = Color(0xFF3700B3) val Teal200 = Color(0xFF03DAC5) +val background800 = Color(0xFF424242) +val shimmerHighLight = Color(0xA3C2C2C2) diff --git a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Theme.kt b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Theme.kt index c803116..bcfac78 100644 --- a/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Theme.kt +++ b/app/src/main/kotlin/io/getstream/androiddeveloperroadmap/ui/theme/Theme.kt @@ -32,15 +32,6 @@ private val LightColorPalette = lightColors( primary = Purple500, primaryVariant = Purple700, secondary = Teal200 - - /* Other default colors to override - background = Color.White, - surface = Color.White, - onPrimary = Color.White, - onSecondary = Color.Black, - onBackground = Color.Black, - onSurface = Color.Black, - */ ) @Composable diff --git a/build.gradle b/build.gradle index c2ca0fa..fcf520b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,15 @@ buildscript { ext { - compose_version = '1.1.0-beta03' + compose_version = '1.3.0-rc01' + compose_compiler_version = '1.3.2' compose_activity_version = '1.4.0' - landscapist_version = '1.4.3' - zoomable_version = '1.2.0' + landscapist_version = '2.0.0' + zoomable_version = '1.5.1' } } plugins { - id "com.diffplug.spotless" version "5.15.0" + id "com.diffplug.spotless" version "6.3.0" } subprojects { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0493ae..2a171fd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Dec 01 10:04:43 KST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index 7b04270..4e1ed8e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,9 +5,9 @@ pluginManagement { mavenCentral() } plugins { - id 'com.android.application' version '7.1.0-beta03' - id 'com.android.library' version '7.1.0-beta03' - id 'org.jetbrains.kotlin.android' version '1.5.31' + id 'com.android.application' version '7.3.0' + id 'com.android.library' version '7.3.0' + id 'org.jetbrains.kotlin.android' version '1.7.20' } } dependencyResolutionManagement {