Avoid crash when unknown reading mode is used
This commit is contained in:
parent
544adb9940
commit
b4577d6676
@ -554,11 +554,15 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showReadingModeToast(mode: Int) {
|
private fun showReadingModeToast(mode: Int) {
|
||||||
|
try {
|
||||||
val strings = resources.getStringArray(R.array.viewers_selector)
|
val strings = resources.getStringArray(R.array.viewers_selector)
|
||||||
readingModeToast?.cancel()
|
readingModeToast?.cancel()
|
||||||
readingModeToast = toast(strings[mode]) {
|
readingModeToast = toast(strings[mode]) {
|
||||||
it.setGravity(Gravity.CENTER_VERTICAL or Gravity.CENTER_HORIZONTAL, 0, 0)
|
it.setGravity(Gravity.CENTER_VERTICAL or Gravity.CENTER_HORIZONTAL, 0, 0)
|
||||||
}
|
}
|
||||||
|
} catch (e: ArrayIndexOutOfBoundsException) {
|
||||||
|
Timber.e("Unknown reading mode: $mode")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user