添加文件夹分组样式

pull/1023/head
gedoor 4 years ago
parent 3757995e69
commit 9371d1795d
  1. 2
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  2. 4
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  3. 5
      app/src/main/java/io/legado/app/ui/main/bookshelf/BaseBookshelfFragment.kt

@ -133,7 +133,7 @@ class OtherConfigFragment : BasePreferenceFragment(),
PreferKey.processText -> sharedPreferences?.let { PreferKey.processText -> sharedPreferences?.let {
setProcessTextEnable(it.getBoolean(key, true)) setProcessTextEnable(it.getBoolean(key, true))
} }
PreferKey.showDiscovery, PreferKey.showRss -> postEvent(EventBus.NOTIFY_MAIN, "") PreferKey.showDiscovery, PreferKey.showRss -> postEvent(EventBus.NOTIFY_MAIN, true)
PreferKey.defaultCover -> upPreferenceSummary( PreferKey.defaultCover -> upPreferenceSummary(
key, getPrefString(PreferKey.defaultCover) key, getPrefString(PreferKey.defaultCover)
) )

@ -172,13 +172,15 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
observeEvent<String>(EventBus.RECREATE) { observeEvent<String>(EventBus.RECREATE) {
recreate() recreate()
} }
observeEvent<String>(EventBus.NOTIFY_MAIN) { observeEvent<Boolean>(EventBus.NOTIFY_MAIN) {
binding.apply { binding.apply {
upBottomMenu() upBottomMenu()
viewPagerMain.adapter?.notifyDataSetChanged() viewPagerMain.adapter?.notifyDataSetChanged()
if (it) {
viewPagerMain.setCurrentItem(bottomMenuCount - 1, false) viewPagerMain.setCurrentItem(bottomMenuCount - 1, false)
} }
} }
}
observeEvent<String>(PreferKey.threadCount) { observeEvent<String>(PreferKey.threadCount) {
viewModel.upPool() viewModel.upPool()
} }

@ -6,6 +6,7 @@ import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.VMBaseFragment import io.legado.app.base.VMBaseFragment
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.databinding.DialogBookshelfConfigBinding import io.legado.app.databinding.DialogBookshelfConfigBinding
@ -93,7 +94,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
var changed = false var changed = false
if (AppConfig.bookGroupStyle != spGroupStyle.selectedItemPosition) { if (AppConfig.bookGroupStyle != spGroupStyle.selectedItemPosition) {
AppConfig.bookGroupStyle = spGroupStyle.selectedItemPosition AppConfig.bookGroupStyle = spGroupStyle.selectedItemPosition
changed = true postEvent(EventBus.NOTIFY_MAIN, false)
} }
if (bookshelfLayout != rgLayout.getCheckedIndex()) { if (bookshelfLayout != rgLayout.getCheckedIndex()) {
putPrefInt(PreferKey.bookshelfLayout, rgLayout.getCheckedIndex()) putPrefInt(PreferKey.bookshelfLayout, rgLayout.getCheckedIndex())
@ -104,7 +105,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
changed = true changed = true
} }
if (changed) { if (changed) {
activity?.recreate() postEvent(EventBus.RECREATE, "")
} }
} }
} }

Loading…
Cancel
Save