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,11 +43,7 @@ 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) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (badge != null) {
|
if (badge != null) {
|
||||||
GlideApp
|
GlideApp
|
||||||
.with(this)
|
.with(this)
|
||||||
|
@ -59,5 +56,8 @@ class BadgeImageView @JvmOverloads constructor(
|
||||||
.with(this)
|
.with(this)
|
||||||
.clear(this)
|
.clear(this)
|
||||||
}
|
}
|
||||||
|
} catch (e: IllegalArgumentException) {
|
||||||
|
// Do nothing. Activity was destroyed.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue