Skip to content

Commit 0c24210

Browse files
committed
Fix Crash for low end devices.
Used Coil instead of Glide to load Image.
1 parent 87b79e5 commit 0c24210

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies {
4848
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
4949
implementation "androidx.activity:activity-compose:$compose_activity_version"
5050

51-
implementation "com.github.skydoves:landscapist-glide:$landscapist_version"
5251
implementation "com.mxalbert.zoomable:zoomable:$zoomable_version"
52+
53+
implementation("io.coil-kt:coil-compose:1.4.0")
5354
}

app/src/main/kotlin/io/getstream/androiddeveloperroadmap/MainActivity.kt

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,53 +19,55 @@ package io.getstream.androiddeveloperroadmap
1919
import android.os.Bundle
2020
import androidx.activity.ComponentActivity
2121
import androidx.activity.compose.setContent
22+
import androidx.compose.foundation.Image
2223
import androidx.compose.foundation.layout.fillMaxSize
23-
import androidx.compose.foundation.layout.height
2424
import androidx.compose.material.MaterialTheme
2525
import androidx.compose.material.Surface
2626
import androidx.compose.runtime.Composable
2727
import androidx.compose.ui.Modifier
2828
import androidx.compose.ui.layout.ContentScale
2929
import androidx.compose.ui.tooling.preview.Preview
30-
import androidx.compose.ui.unit.dp
30+
import coil.compose.rememberImagePainter
3131
import com.mxalbert.zoomable.Zoomable
32-
import com.skydoves.landscapist.glide.GlideImage
3332
import io.getstream.androiddeveloperroadmap.ui.theme.AndroidDeveloperRoadmapTheme
3433

3534
class MainActivity : ComponentActivity() {
36-
override fun onCreate(savedInstanceState: Bundle?) {
37-
super.onCreate(savedInstanceState)
35+
override fun onCreate(savedInstanceState: Bundle?) {
36+
super.onCreate(savedInstanceState)
3837

39-
setContent {
40-
AndroidDeveloperRoadmapTheme {
41-
Surface(
42-
color = MaterialTheme.colors.background
43-
) {
44-
Roadmap()
38+
setContent {
39+
AndroidDeveloperRoadmapTheme {
40+
Surface(
41+
color = MaterialTheme.colors.background
42+
) {
43+
Roadmap()
44+
}
45+
}
4546
}
46-
}
4747
}
48-
}
4948
}
5049

5150
@Composable
5251
private fun Roadmap() {
53-
Zoomable(
54-
modifier = Modifier.height(3200.dp)
55-
) {
56-
GlideImage(
57-
imageModel = "https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png",
58-
modifier = Modifier.fillMaxSize(),
59-
previewPlaceholder = R.drawable.roadmap_preview,
60-
contentScale = ContentScale.Fit
61-
)
62-
}
52+
Zoomable(
53+
modifier = Modifier.fillMaxSize(),
54+
) {
55+
Image(
56+
painter = rememberImagePainter("https://user-images.githubusercontent.com/24237865/144350753-5a52e6e5-3517-476c-8e5c-adad919abe8e.png",
57+
builder = {
58+
placeholder(R.drawable.roadmap_preview)
59+
}),
60+
modifier = Modifier.fillMaxSize(),
61+
contentScale = ContentScale.Fit,
62+
contentDescription = null
63+
)
64+
}
6365
}
6466

6567
@Preview(showBackground = true)
6668
@Composable
6769
private fun DefaultPreview() {
68-
AndroidDeveloperRoadmapTheme {
69-
Roadmap()
70-
}
70+
AndroidDeveloperRoadmapTheme {
71+
Roadmap()
72+
}
7173
}

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ pluginManagement {
55
mavenCentral()
66
}
77
plugins {
8-
id 'com.android.application' version '7.1.0-alpha13'
9-
id 'com.android.library' version '7.1.0-alpha13'
8+
id 'com.android.application' version '7.1.0-beta03'
9+
id 'com.android.library' version '7.1.0-beta03'
1010
id 'org.jetbrains.kotlin.android' version '1.5.31'
1111
}
1212
}

0 commit comments

Comments
 (0)