Replace custom visibility extension functions
This commit is contained in:
@@ -4,13 +4,12 @@ import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.ImageView.ScaleType
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
|
||||
import com.bumptech.glide.request.target.ImageViewTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
|
||||
/**
|
||||
* A glide target to display an image with an optional view to show while loading and a configurable
|
||||
@@ -37,12 +36,12 @@ class StateImageViewTarget(
|
||||
}
|
||||
|
||||
override fun onLoadStarted(placeholder: Drawable?) {
|
||||
progress?.visible()
|
||||
progress?.isVisible = true
|
||||
super.onLoadStarted(placeholder)
|
||||
}
|
||||
|
||||
override fun onLoadFailed(errorDrawable: Drawable?) {
|
||||
progress?.gone()
|
||||
progress?.isVisible = false
|
||||
view.scaleType = errorScaleType
|
||||
|
||||
val vector = VectorDrawableCompat.create(view.context.resources, errorDrawableRes, null)
|
||||
@@ -51,12 +50,12 @@ class StateImageViewTarget(
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
progress?.gone()
|
||||
progress?.isVisible = false
|
||||
super.onLoadCleared(placeholder)
|
||||
}
|
||||
|
||||
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
|
||||
progress?.gone()
|
||||
progress?.isVisible = false
|
||||
view.scaleType = imageScaleType
|
||||
super.onResourceReady(resource, transition)
|
||||
this.resource = resource
|
||||
|
||||
Reference in New Issue
Block a user