Update demo codes

This commit is contained in:
skydoves 2022-10-07 10:09:48 +09:00
parent 859c4f64f3
commit a082bcb7da
No known key found for this signature in database
GPG key ID: D7662013FA1A5596
7 changed files with 36 additions and 38 deletions

View file

@ -4,12 +4,12 @@ plugins {
} }
android { android {
compileSdk 31 compileSdk 33
defaultConfig { defaultConfig {
applicationId "io.getstream.androiddeveloperroadmap" applicationId "io.getstream.androiddeveloperroadmap"
minSdk 21 minSdk 21
targetSdk 31 targetSdk 33
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
} }
@ -28,7 +28,7 @@ android {
} }
composeOptions { composeOptions {
kotlinCompilerExtensionVersion compose_version kotlinCompilerExtensionVersion compose_compiler_version
} }
packagingOptions { packagingOptions {
@ -39,7 +39,6 @@ android {
} }
dependencies { dependencies {
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$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.compose.foundation:foundation-layout:$compose_version"
implementation "androidx.activity:activity-compose:$compose_activity_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"
} }

View file

@ -19,7 +19,6 @@ package io.getstream.androiddeveloperroadmap
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface import androidx.compose.material.Surface
@ -27,9 +26,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import coil.compose.rememberImagePainter
import com.mxalbert.zoomable.Zoomable 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.AndroidDeveloperRoadmapTheme
import io.getstream.androiddeveloperroadmap.ui.theme.shimmerHighLight
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -40,7 +43,7 @@ class MainActivity : ComponentActivity() {
Surface( Surface(
color = MaterialTheme.colors.background color = MaterialTheme.colors.background
) { ) {
Roadmap() AndroidRoadmap()
} }
} }
} }
@ -48,20 +51,21 @@ class MainActivity : ComponentActivity() {
} }
@Composable @Composable
private fun Roadmap() { private fun AndroidRoadmap() {
Zoomable( Zoomable(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
) { ) {
Image( val background = MaterialTheme.colors.background
painter = rememberImagePainter( CoilImage(
"https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png", imageModel = "https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png",
builder = { component = rememberImageComponent {
placeholder(R.drawable.roadmap_preview) // shows a shimmering effect when loading an image.
} +ShimmerPlugin(
), baseColor = background,
modifier = Modifier.fillMaxSize(), highlightColor = shimmerHighLight
contentScale = ContentScale.Fit, )
contentDescription = null },
imageOptions = ImageOptions(contentScale = ContentScale.Fit)
) )
} }
} }
@ -70,6 +74,6 @@ private fun Roadmap() {
@Composable @Composable
private fun DefaultPreview() { private fun DefaultPreview() {
AndroidDeveloperRoadmapTheme { AndroidDeveloperRoadmapTheme {
Roadmap() AndroidRoadmap()
} }
} }

View file

@ -22,3 +22,5 @@ val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE) val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3) val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5) val Teal200 = Color(0xFF03DAC5)
val background800 = Color(0xFF424242)
val shimmerHighLight = Color(0xA3C2C2C2)

View file

@ -32,15 +32,6 @@ private val LightColorPalette = lightColors(
primary = Purple500, primary = Purple500,
primaryVariant = Purple700, primaryVariant = Purple700,
secondary = Teal200 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 @Composable

View file

@ -1,14 +1,15 @@
buildscript { buildscript {
ext { 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' compose_activity_version = '1.4.0'
landscapist_version = '1.4.3' landscapist_version = '2.0.0'
zoomable_version = '1.2.0' zoomable_version = '1.5.1'
} }
} }
plugins { plugins {
id "com.diffplug.spotless" version "5.15.0" id "com.diffplug.spotless" version "6.3.0"
} }
subprojects { subprojects {

View file

@ -1,6 +1,6 @@
#Wed Dec 01 10:04:43 KST 2021 #Wed Dec 01 10:04:43 KST 2021
distributionBase=GRADLE_USER_HOME 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 distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -5,9 +5,9 @@ pluginManagement {
mavenCentral() mavenCentral()
} }
plugins { plugins {
id 'com.android.application' version '7.1.0-beta03' id 'com.android.application' version '7.3.0'
id 'com.android.library' version '7.1.0-beta03' id 'com.android.library' version '7.3.0'
id 'org.jetbrains.kotlin.android' version '1.5.31' id 'org.jetbrains.kotlin.android' version '1.7.20'
} }
} }
dependencyResolutionManagement { dependencyResolutionManagement {