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

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

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

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

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

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

Loading…
Cancel
Save