Skip to content

Commit

Permalink
Dropped hardware support in Coil for avoiding possible errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Javinator9889 committed Jul 3, 2020
1 parent fe89631 commit d78d41b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -40,7 +40,7 @@ android {
applicationId "com.javinator9889.handwashingreminder"
minSdkVersion 17
targetSdkVersion 29
versionCode 135
versionCode 136
versionName "1.2.0-${gitCommitHash}"
multiDexEnabled true
resConfigs "en", "es"
Expand Down
Expand Up @@ -24,7 +24,6 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import coil.Coil
import coil.api.load
import coil.size.Scale
import com.airbnb.lottie.LottieAnimationView
Expand Down Expand Up @@ -72,42 +71,17 @@ data class News(
item.lifecycleOwner.lifecycleScope.launch(Dispatchers.Main) {
title.text = item.title
description.text = item.short
val imageLoader = Coil.imageLoader(view.context)
if (item.imageUrl != null) {
imageHeader.load(item.imageUrl) {
scale(Scale.FILL)
lifecycle(item.lifecycleOwner)
allowHardware(true)
}
/*val request = GetRequest.Builder(view.context)
.data(item.imageUrl)
.allowHardware(true)
.scale(Scale.FILL)
.build()
launch(Dispatchers.IO) {
val drawable = imageLoader.execute(request).drawable
withContext(Dispatchers.Main) {
imageHeader.setImageDrawable(drawable)
}
}*/
} else imageHeader.visibility = View.GONE
if (item.websiteImageUrl != null) {
websiteLogo.load(item.websiteImageUrl) {
scale(Scale.FILL)
lifecycle(item.lifecycleOwner)
allowHardware(true)
}
/*val request = GetRequest.Builder(view.context)
.data(item.websiteImageUrl)
.allowHardware(true)
.scale(Scale.FILL)
.build()
launch(Dispatchers.IO) {
val drawable = imageLoader.execute(request).drawable
withContext(Dispatchers.Main) {
websiteLogo.setImageDrawable(drawable)
}
}*/
} else websiteLogo.visibility = View.GONE
websiteName.text = item.website
?: context.getString(R.string.no_website)
Expand Down

0 comments on commit d78d41b

Please sign in to comment.