diff --git a/app/src/main/java/io/legado/app/help/LocalConfig.kt b/app/src/main/java/io/legado/app/help/LocalConfig.kt new file mode 100644 index 000000000..aee7a8665 --- /dev/null +++ b/app/src/main/java/io/legado/app/help/LocalConfig.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) } + } +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 47f3ac855..2b5f8c14a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -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 + } } /** 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 59a5bd79c..b5d9eb333 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 @@ -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(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) }