Fix possible crash-on-start from getToolbarNavigationItem
This commit is contained in:
parent
995a1155e4
commit
8be5be4720
@ -47,6 +47,7 @@ import eu.kanade.tachiyomi.source.online.all.Hitomi
|
|||||||
import eu.kanade.tachiyomi.util.vibrate
|
import eu.kanade.tachiyomi.util.vibrate
|
||||||
import exh.HITOMI_SOURCE_ID
|
import exh.HITOMI_SOURCE_ID
|
||||||
import rx.schedulers.Schedulers
|
import rx.schedulers.Schedulers
|
||||||
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
@ -260,6 +261,7 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getToolbarNavigationIcon(toolbar: Toolbar): View? {
|
fun getToolbarNavigationIcon(toolbar: Toolbar): View? {
|
||||||
|
try {
|
||||||
//check if contentDescription previously was set
|
//check if contentDescription previously was set
|
||||||
val hadContentDescription = TextUtils.isEmpty(toolbar.navigationContentDescription)
|
val hadContentDescription = TextUtils.isEmpty(toolbar.navigationContentDescription)
|
||||||
val contentDescription = if (!hadContentDescription) toolbar.navigationContentDescription else "navigationIcon"
|
val contentDescription = if (!hadContentDescription) toolbar.navigationContentDescription else "navigationIcon"
|
||||||
@ -277,6 +279,10 @@ class MainActivity : BaseActivity() {
|
|||||||
if (hadContentDescription)
|
if (hadContentDescription)
|
||||||
toolbar.navigationContentDescription = null
|
toolbar.navigationContentDescription = null
|
||||||
return navIcon
|
return navIcon
|
||||||
|
} catch(t: Throwable) {
|
||||||
|
Timber.w(t, "Could not find toolbar nav icon!")
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun syncActivityViewWithController(to: Controller?, from: Controller? = null) {
|
private fun syncActivityViewWithController(to: Controller?, from: Controller? = null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user