pull/62/head
kunfei 5 years ago
parent eb34e49ee3
commit 11a58cc54a
  1. 5
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  2. 15
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt

@ -13,7 +13,6 @@ import io.legado.app.BuildConfig
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Bus
import io.legado.app.help.ActivityHelp
import io.legado.app.help.storage.Backup
import io.legado.app.lib.theme.ATH
import io.legado.app.service.BaseReadAloudService
@ -113,15 +112,11 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
}
override fun finish() {
if (ActivityHelp.size() > 1) {
moveTaskToBack(true)
} else {
if (!BuildConfig.DEBUG) {
Backup.autoBackup()
}
super.finish()
}
}
override fun onDestroy() {
super.onDestroy()

@ -2,6 +2,7 @@ package io.legado.app.ui.rss.read
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.webkit.WebSettings
@ -90,4 +91,18 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r
}
DrawableUtils.setTint(starMenuItem?.icon, primaryTextColor)
}
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
event?.let {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> if (event.isTracking && !event.isCanceled && webView.canGoBack()) {
if (webView.copyBackForwardList().size > 1) {
webView.goBack()
return true
}
}
}
}
return super.onKeyUp(keyCode, event)
}
}
Loading…
Cancel
Save