kopia lustrzana https://github.com/ryukoposting/Signal-Android
Catch IAE instead of checking lifecycle.
rodzic
26e04ce6d2
commit
566e981473
|
@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.recipients.Recipient
|
||||||
import org.thoughtcrime.securesms.util.ThemeUtil
|
import org.thoughtcrime.securesms.util.ThemeUtil
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil
|
import org.thoughtcrime.securesms.util.ViewUtil
|
||||||
import org.thoughtcrime.securesms.util.visible
|
import org.thoughtcrime.securesms.util.visible
|
||||||
|
import java.lang.IllegalArgumentException
|
||||||
|
|
||||||
private val TAG = Log.tag(BadgeImageView::class.java)
|
private val TAG = Log.tag(BadgeImageView::class.java)
|
||||||
|
|
||||||
|
@ -42,22 +43,21 @@ class BadgeImageView @JvmOverloads constructor(
|
||||||
fun setBadge(badge: Badge?) {
|
fun setBadge(badge: Badge?) {
|
||||||
visible = badge != null
|
visible = badge != null
|
||||||
|
|
||||||
val lifecycle = ViewUtil.getActivityLifecycle(this)
|
try {
|
||||||
if (lifecycle?.currentState == Lifecycle.State.DESTROYED) {
|
if (badge != null) {
|
||||||
return
|
GlideApp
|
||||||
}
|
.with(this)
|
||||||
|
.load(badge)
|
||||||
if (badge != null) {
|
.downsample(DownsampleStrategy.NONE)
|
||||||
GlideApp
|
.transform(BadgeSpriteTransformation(BadgeSpriteTransformation.Size.fromInteger(badgeSize), badge.imageDensity, ThemeUtil.isDarkTheme(context)))
|
||||||
.with(this)
|
.into(this)
|
||||||
.load(badge)
|
} else {
|
||||||
.downsample(DownsampleStrategy.NONE)
|
GlideApp
|
||||||
.transform(BadgeSpriteTransformation(BadgeSpriteTransformation.Size.fromInteger(badgeSize), badge.imageDensity, ThemeUtil.isDarkTheme(context)))
|
.with(this)
|
||||||
.into(this)
|
.clear(this)
|
||||||
} else {
|
}
|
||||||
GlideApp
|
} catch (e: IllegalArgumentException) {
|
||||||
.with(this)
|
// Do nothing. Activity was destroyed.
|
||||||
.clear(this)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue