From 5b0323d49258ac4d05edc39518f227eaf6ea4609 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 16 Jun 2020 19:52:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E8=A6=81=E9=80=80=E5=87=BA=E9=87=8D=E8=BF=9B?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/main/MainActivity.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) 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)