feat: 修复恢复时需要退出重进的bug

pull/248/head
gedoor 5 years ago
parent 57565e0c14
commit 5b0323d492
  1. 16
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -105,16 +105,17 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
view_pager_main.currentItem = 0 view_pager_main.currentItem = 0
return true return true
} }
if (!BaseReadAloudService.pause) {
if (System.currentTimeMillis() - exitTime > 2000) { if (System.currentTimeMillis() - exitTime > 2000) {
toast(R.string.double_click_exit) toast(R.string.double_click_exit)
exitTime = System.currentTimeMillis() exitTime = System.currentTimeMillis()
} else {
if (BaseReadAloudService.pause) {
finish()
} else { } else {
moveTaskToBack(true) moveTaskToBack(true)
return true
} }
return false
} }
return true
} }
} }
} }
@ -128,15 +129,6 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
} }
} }
override fun finish() {
if (System.currentTimeMillis() - exitTime > 2000) {
toast(R.string.double_click_exit)
exitTime = System.currentTimeMillis()
} else {
super.finish()
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
ReadAloud.stop(this) ReadAloud.stop(this)

Loading…
Cancel
Save