pull/51/head
kunfei 5 years ago
parent 64210aec08
commit 3f2f5a5e1c
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 6
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  3. 11
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  4. 1
      app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt

@ -8,4 +8,5 @@ object PreferKey {
const val precisionSearch = "precisionSearch" const val precisionSearch = "precisionSearch"
const val prevKey = "prevKeyCode" const val prevKey = "prevKeyCode"
const val nextKey = "nextKeyCode" const val nextKey = "nextKeyCode"
const val showRss = "showRss"
} }

@ -15,10 +15,7 @@ import io.legado.app.help.BookHelp
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.receiver.SharedReceiverActivity import io.legado.app.receiver.SharedReceiverActivity
import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.filechooser.FileChooserDialog
import io.legado.app.utils.LogUtils import io.legado.app.utils.*
import io.legado.app.utils.getPrefString
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.putPrefString
class ConfigFragment : PreferenceFragmentCompat(), class ConfigFragment : PreferenceFragmentCompat(),
@ -76,6 +73,7 @@ class ConfigFragment : PreferenceFragmentCompat(),
"process_text" -> sharedPreferences?.let { "process_text" -> sharedPreferences?.let {
setProcessTextEnable(it.getBoolean("process_text", true)) setProcessTextEnable(it.getBoolean("process_text", true))
} }
PreferKey.showRss -> postEvent(PreferKey.showRss, PreferKey.showRss)
} }
} }

@ -13,6 +13,7 @@ import io.legado.app.BuildConfig
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseActivity import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Bus import io.legado.app.constant.Bus
import io.legado.app.constant.PreferKey
import io.legado.app.help.ActivityHelp import io.legado.app.help.ActivityHelp
import io.legado.app.help.storage.Backup import io.legado.app.help.storage.Backup
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
@ -45,7 +46,7 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
view_pager_main.adapter = TabFragmentPageAdapter(supportFragmentManager) view_pager_main.adapter = TabFragmentPageAdapter(supportFragmentManager)
view_pager_main.addOnPageChangeListener(this) view_pager_main.addOnPageChangeListener(this)
bottom_navigation_view.setOnNavigationItemSelectedListener(this) bottom_navigation_view.setOnNavigationItemSelectedListener(this)
bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = showRss() upShowRss()
upVersion() upVersion()
} }
@ -59,6 +60,11 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
return false return false
} }
private fun upShowRss() {
bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = showRss()
view_pager_main.adapter?.notifyDataSetChanged()
}
private fun upVersion() { private fun upVersion() {
if (getPrefInt("versionCode") != App.INSTANCE.versionCode) { if (getPrefInt("versionCode") != App.INSTANCE.versionCode) {
putPrefInt("versionCode", App.INSTANCE.versionCode) putPrefInt("versionCode", App.INSTANCE.versionCode)
@ -122,6 +128,9 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
observeEvent<Boolean>(Bus.UP_CONFIG) { observeEvent<Boolean>(Bus.UP_CONFIG) {
content_view.upStyle() content_view.upStyle()
} }
observeEvent<String>(PreferKey.showRss) {
upShowRss()
}
} }
private fun showRss(): Boolean { private fun showRss(): Boolean {

@ -87,7 +87,6 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) {
"isNightTheme" -> App.INSTANCE.applyDayNight() "isNightTheme" -> App.INSTANCE.applyDayNight()
"recordLog" -> LogUtils.upLevel() "recordLog" -> LogUtils.upLevel()
"downloadPath" -> BookHelp.upDownloadPath() "downloadPath" -> BookHelp.upDownloadPath()
"showRss" -> activity?.recreate()
} }
} }

Loading…
Cancel
Save