A few more crashes fixed

This commit is contained in:
len 2016-04-07 20:39:37 +02:00
parent 4196a0f585
commit fe49286d97

View File

@ -143,6 +143,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
override fun onBackPressed() { override fun onBackPressed() {
if (isFinishing) return
presenter.onChapterLeft() presenter.onChapterLeft()
val chapterToUpdate = presenter.getMangaSyncChapterToUpdate() val chapterToUpdate = presenter.getMangaSyncChapterToUpdate()
@ -173,6 +175,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
} }
override fun dispatchKeyEvent(event: KeyEvent): Boolean { override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (!isFinishing) {
val action = event.action val action = event.action
val keyCode = event.keyCode val keyCode = event.keyCode
when (keyCode) { when (keyCode) {
@ -186,13 +189,14 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
viewer?.moveToPrevious() viewer?.moveToPrevious()
return true return true
} }
else -> return super.dispatchKeyEvent(event)
} }
} }
return super.dispatchKeyEvent(event)
}
fun onChapterError(error: Throwable) { fun onChapterError(error: Throwable) {
finish()
Timber.e(error, error.message) Timber.e(error, error.message)
finish()
toast(R.string.page_list_error) toast(R.string.page_list_error)
} }