pull/525/head
gedoor 4 years ago
parent c5703b0c71
commit 3ce65b1eea
  1. 66
      app/src/main/java/io/legado/app/help/LocalConfig.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt

@ -27,48 +27,38 @@ object LocalConfig {
return value
}
val isFirstRead: Boolean
get() {
val value = localConfig.getBoolean("firstRead", true)
if (value) {
localConfig.edit { putBoolean("firstRead", false) }
@Suppress("SameParameterValue")
private fun isLastVersion(lastVersion: Int, versionKey: String, firstOpenKey: String): Boolean {
var version = localConfig.getInt(versionKey, 0)
if (version == 0) {
if (!localConfig.getBoolean(firstOpenKey, true)) {
version = 1
}
return value
}
val isFirstOpenBackup: Boolean
get() {
val value = localConfig.getBoolean("firstBackup", true)
if (value) {
localConfig.edit { putBoolean("firstBackup", false) }
}
return value
if (version < lastVersion) {
localConfig.edit { putInt(versionKey, lastVersion) }
return false
}
return true
}
val isFirstReadMenuShow: Boolean
get() {
val value = localConfig.getBoolean("firstReadMenu", true)
if (value) {
localConfig.edit { putBoolean("firstReadMenu", false) }
}
return value
}
val readHelpVersionIsLast: Boolean by lazy {
isLastVersion(1, "readHelpVersion", "firstRead")
}
val isFirstOpenBookSources: Boolean
get() {
val value = localConfig.getBoolean("firstOpenBookSources", true)
if (value) {
localConfig.edit { putBoolean("firstOpenBookSources", false) }
}
return value
}
val backupHelpVersionIsLast: Boolean by lazy {
isLastVersion(1, "backupHelpVersion", "firstBackup")
}
val isFirstOpenDebug: Boolean
get() {
val value = localConfig.getBoolean("firstOpenDebug", true)
if (value) {
localConfig.edit { putBoolean("firstOpenDebug", false) }
}
return value
}
val readMenuHelpVersionIsLast: Boolean by lazy {
isLastVersion(1, "readMenuHelpVersion", "firstReadMenu")
}
val bookSourcesHelpVersionIsLast: Boolean by lazy {
isLastVersion(1, "bookSourceHelpVersion", "firstOpenBookSources")
}
val debugHelpVersionIsLast: Boolean by lazy {
isLastVersion(1, "debugHelpVersion", "firstOpenDebug")
}
}

@ -56,7 +56,7 @@ abstract class ReadBookBaseActivity :
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
if (LocalConfig.isFirstRead) {
if (!LocalConfig.readHelpVersionIsLast) {
showClickRegionalConfig()
}
}

@ -242,7 +242,7 @@ class ReadMenu @JvmOverloads constructor(
binding.vwNavigationBar.layoutParams = binding.vwNavigationBar.layoutParams.apply {
height = activity!!.navigationBarHeight
}
if (LocalConfig.isFirstReadMenuShow) {
if (!LocalConfig.readMenuHelpVersionIsLast) {
callBack.showReadMenuHelp()
}
}

@ -48,7 +48,7 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
if (LocalConfig.isFirstOpenDebug) {
if (!LocalConfig.debugHelpVersionIsLast) {
showHelp()
}
}

@ -78,7 +78,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
initLiveDataBookSource()
initLiveDataGroup()
initSelectActionBar()
if (LocalConfig.isFirstOpenBookSources) {
if (!LocalConfig.bookSourcesHelpVersionIsLast) {
showHelp()
}
}

@ -61,7 +61,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)
ATH.applyEdgeEffectColor(listView)
setHasOptionsMenu(true)
if (LocalConfig.isFirstOpenBackup) {
if (!LocalConfig.backupHelpVersionIsLast) {
showHelp()
}
}

Loading…
Cancel
Save