首次打开显示帮助

pull/475/head
gedoor 4 years ago
parent e7b699ae68
commit e9c7bb0f11
  1. 23
      app/src/main/java/io/legado/app/help/LocalConfig.kt
  2. 5
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  3. 7
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -0,0 +1,23 @@
package io.legado.app.help
import android.content.Context
import androidx.core.content.edit
import io.legado.app.App
object LocalConfig {
private val localConfig =
App.INSTANCE.getSharedPreferences("local", Context.MODE_PRIVATE)
var isFirstOpen: Boolean
get() = localConfig.getBoolean("firstOpen", true)
set(value) {
localConfig.edit { putBoolean("firstOpen", value) }
}
var isFirstRead: Boolean
get() = localConfig.getBoolean("firstRead", true)
set(value) {
localConfig.edit { putBoolean("firstRead", value) }
}
}

@ -18,6 +18,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.Bookmark
import io.legado.app.help.AppConfig
import io.legado.app.help.LocalConfig
import io.legado.app.help.ReadBookConfig
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.lib.dialogs.*
@ -60,6 +61,10 @@ abstract class ReadBookBaseActivity :
override fun onActivityCreated(savedInstanceState: Bundle?) {
initView()
if (LocalConfig.isFirstRead) {
showClickRegionalConfig()
LocalConfig.isFirstRead = false
}
}
/**

@ -17,6 +17,7 @@ import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.help.AppConfig
import io.legado.app.help.BookHelp
import io.legado.app.help.LocalConfig
import io.legado.app.help.storage.Backup
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.elevation
@ -102,7 +103,11 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
private fun upVersion() {
if (getPrefInt(PreferKey.versionCode) != App.versionCode) {
putPrefInt(PreferKey.versionCode, App.versionCode)
if (!BuildConfig.DEBUG) {
if (LocalConfig.isFirstOpen) {
val text = String(assets.open("help/help.md").readBytes())
TextDialog.show(supportFragmentManager, text, TextDialog.MD)
LocalConfig.isFirstOpen = false
} else if (!BuildConfig.DEBUG) {
val log = String(assets.open("updateLog.md").readBytes())
TextDialog.show(supportFragmentManager, log, TextDialog.MD, 5000, true)
}

Loading…
Cancel
Save