Fix crashes
parent
84e5400522
commit
13946783a5
@ -0,0 +1,14 @@
|
|||||||
|
package org.koitharu.kotatsu.core.util.ext
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.appcompat.widget.Toolbar
|
||||||
|
|
||||||
|
fun Toolbar.setNavigationIconSafe(@DrawableRes iconRes: Int, retry: Boolean = true) {
|
||||||
|
try {
|
||||||
|
setNavigationIcon(iconRes)
|
||||||
|
} catch (e: IllegalStateException) {
|
||||||
|
if (retry) {
|
||||||
|
post { setNavigationIconSafe(iconRes, retry = false) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue