Fix hideStartReadingButton setting not updating in real time

This commit is contained in:
Jays2Kings 2021-05-03 13:37:21 -04:00
parent 449b33d731
commit 799ac037e6
3 changed files with 10 additions and 6 deletions

View File

@ -357,7 +357,7 @@ class PreferencesHelper(val context: Context) {
fun unreadBadgeType() = flowPrefs.getInt("unread_badge_type", 2)
fun hideStartReadingButton() = rxPrefs.getBoolean("hide_reading_button", false)
fun hideStartReadingButton() = flowPrefs.getBoolean("hide_reading_button", false)
fun alwaysShowChapterTransition() = flowPrefs.getBoolean(Keys.alwaysShowChapterTransition, true)

View File

@ -832,8 +832,7 @@ class LibraryController(
listOf(
preferences.libraryLayout(),
preferences.uniformGrid(),
preferences.gridSize(),
preferences.unreadBadgeType()
preferences.gridSize()
).forEach {
it.asFlow()
.drop(1)
@ -842,6 +841,12 @@ class LibraryController(
}
.launchIn(viewScope)
}
preferences.hideStartReadingButton().asFlow()
.drop(1)
.onEach {
adapter.notifyDataSetChanged()
}
.launchIn(viewScope)
}
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
@ -1081,7 +1086,7 @@ class LibraryController(
destroyActionModeIfNeeded()
}
fun reattachAdapter() {
private fun reattachAdapter() {
libraryLayout = preferences.libraryLayout().get()
setRecyclerLayout()
val position =

View File

@ -15,7 +15,6 @@ import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.LibraryManga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.databinding.MangaGridItemBinding
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.util.system.dpToPx
@ -43,7 +42,7 @@ class LibraryItem(
get() = preferences.libraryLayout().get()
val hideReadingButton: Boolean
get() = preferences.hideStartReadingButton().getOrDefault()
get() = preferences.hideStartReadingButton().get()
override fun getLayoutRes(): Int {
return if (libraryLayout == 0 || manga.isBlank()) {