diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 8664d2eab..d604465a1 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -105,16 +105,17 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), view_pager_main.currentItem = 0 return true } - if (!BaseReadAloudService.pause) { - if (System.currentTimeMillis() - exitTime > 2000) { - toast(R.string.double_click_exit) - exitTime = System.currentTimeMillis() + if (System.currentTimeMillis() - exitTime > 2000) { + toast(R.string.double_click_exit) + exitTime = System.currentTimeMillis() + } else { + if (BaseReadAloudService.pause) { + finish() } else { moveTaskToBack(true) - return true } - return false } + return true } } } @@ -128,15 +129,6 @@ class MainActivity : VMBaseActivity(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() { super.onDestroy() ReadAloud.stop(this)