Skip to content

Commit

Permalink
Fix the deprecation after the Glide update
Browse files Browse the repository at this point in the history
  • Loading branch information
emartynov authored and nickbutcher committed Jul 4, 2019
1 parent eeb4b51 commit 06d9db6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/src/main/java/io/plaidapp/core/util/glide/ImageSpanTarget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ package io.plaidapp.core.util.glide
import `in`.uncod.android.bypass.style.ImageLoadingSpan
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.style.ImageSpan
import android.transition.TransitionManager
import android.view.ViewGroup
import android.widget.TextView
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.target.CustomViewTarget
import com.bumptech.glide.request.transition.Transition
import java.lang.ref.WeakReference

Expand All @@ -36,8 +37,7 @@ import java.lang.ref.WeakReference
class ImageSpanTarget(
textView: TextView,
private val loadingSpan: ImageLoadingSpan
) : SimpleTarget<Bitmap>() {

) : CustomViewTarget<TextView, Bitmap>(textView) {
private val textView: WeakReference<TextView> = WeakReference(textView)

override fun onResourceReady(bitmap: Bitmap, transition: Transition<in Bitmap>?) {
Expand Down Expand Up @@ -66,4 +66,12 @@ class ImageSpanTarget(
}
}
}

override fun onLoadFailed(errorDrawable: Drawable?) {
// I don't think it is useful to set compound drawable to error drawable
}

override fun onResourceCleared(placeholder: Drawable?) {
// I don't think it is useful to set compound drawable to placeholder drawable
}
}

0 comments on commit 06d9db6

Please sign in to comment.