Skip to content

Commit

Permalink
Replace Glide with Coil
Browse files Browse the repository at this point in the history
  • Loading branch information
t895 committed Apr 18, 2024
1 parent 262277c commit 4a74898
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 106 deletions.
5 changes: 1 addition & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if (useKeystoreProperties) {
plugins {
id("com.android.application")
kotlin("android")
id("com.google.devtools.ksp")
id("androidx.navigation.safeargs")
id("kotlin-parcelize")
}
Expand Down Expand Up @@ -109,7 +108,5 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")

val glideVersion = "4.16.0"
implementation("com.github.bumptech.glide:glide:$glideVersion")
ksp("com.github.bumptech.glide:ksp:$glideVersion")
implementation("io.coil-kt:coil:2.6.0")
}
14 changes: 6 additions & 8 deletions app/src/main/java/app/grapheneos/apps/ui/PackageListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import app.grapheneos.apps.core.PackageState
import app.grapheneos.apps.core.ReleaseChannel
import app.grapheneos.apps.databinding.PackageListItemBinding
import app.grapheneos.apps.util.maybeSetText
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import coil.load
import coil.transform.RoundedCornersTransformation

class ViewBindingVH<T : ViewBinding>(val binding: T) : ViewHolder(binding.root)

Expand Down Expand Up @@ -78,12 +78,10 @@ fun PackageListItemBinding.set(fragment: Fragment, pkgState: PackageState) {

val iconUrl = rPackage.common.iconUrl
if (iconUrl != null && pkgIcon.tag != iconUrl) {
Glide.with(fragment)
.load(iconUrl)
.placeholder(R.drawable.ic_placeholder_app_icon)
.centerInside()
.transform(RoundedCorners(20))
.into(pkgIcon)
pkgIcon.load(iconUrl) {
transformations(RoundedCornersTransformation(20f))
placeholder(R.drawable.ic_placeholder_app_icon)
}
}

if (iconUrl == null) {
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id("com.android.application") version "8.3.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.23" apply false
id("androidx.navigation.safeargs") version "2.7.7" apply false
id("com.google.devtools.ksp") version "1.9.23-1.0.20" apply false
}

allprojects {
Expand Down
Loading

0 comments on commit 4a74898

Please sign in to comment.