Skip to content

Commit

Permalink
refactor: Switch to coil from glide
Browse files Browse the repository at this point in the history
  • Loading branch information
kongwoojin committed Mar 30, 2024
1 parent 6472a83 commit b470815
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dependencies {
implementation(libs.androidx.paging.runtime)

implementation(libs.coil)
implementation(libs.coil.compose)
implementation(libs.okhttp)
implementation(libs.okhttp.logging.interceptor)
implementation(libs.retrofit)
Expand Down
14 changes: 11 additions & 3 deletions app/src/main/java/com/kongjak/koreatechboard/ui/article/Article.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.kongjak.koreatechboard.ui.components.FileText
import com.kongjak.koreatechboard.ui.components.HtmlView
import com.kongjak.koreatechboard.ui.theme.articleSubText
Expand Down Expand Up @@ -106,12 +110,16 @@ fun ArticleScreen(
html = data?.content!!,
themeViewModel.isDarkTheme.value ?: isSystemInDarkTheme(),
image = { url, description ->
GlideImage(
AsyncImage(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxSize(),
model = url,
contentDescription = description
model = ImageRequest.Builder(LocalContext.current)
.data(url)
.crossfade(true)
.build(),
contentDescription = description,
contentScale = ContentScale.FillWidth
)
}
)
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ androidx-paging-compose = { module = "androidx.paging:paging-compose", version.r
androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "androidx-paging" }

coil = { module = "io.coil-kt:coil", version.ref = "coil" }
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
Expand Down

0 comments on commit b470815

Please sign in to comment.