Fix downloaded only filter
Cette révision appartient à :
Parent
687f3d48ea
révision
7641bb4d0d
2 fichiers modifiés avec 9 ajouts et 6 suppressions
|
@ -4,6 +4,7 @@ import androidx.core.content.edit
|
|||
import androidx.preference.PreferenceManager
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.updater.UpdaterJob
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
|
@ -100,12 +101,14 @@ object Migrations {
|
|||
return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.STATE_INCLUDE
|
||||
else ExtendedNavigationView.Item.TriStateGroup.STATE_IGNORE
|
||||
}
|
||||
preferences.filterDownloaded().set(convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
||||
preferences.filterUnread().set(convertBooleanPrefToTriState("pref_filter_unread_key"))
|
||||
preferences.filterCompleted().set(convertBooleanPrefToTriState("pref_filter_completed_key"))
|
||||
prefs.edit {
|
||||
putInt(PreferenceKeys.filterDownloaded, convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
||||
remove("pref_filter_downloaded_key")
|
||||
|
||||
putInt(PreferenceKeys.filterUnread, convertBooleanPrefToTriState("pref_filter_unread_key"))
|
||||
remove("pref_filter_unread_key")
|
||||
|
||||
putInt(PreferenceKeys.filterCompleted, convertBooleanPrefToTriState("pref_filter_completed_key"))
|
||||
remove("pref_filter_completed_key")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|||
import eu.kanade.tachiyomi.data.database.models.MangaCategory
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.isLocal
|
||||
import eu.kanade.tachiyomi.util.lang.combineLatest
|
||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
|
@ -134,9 +134,9 @@ class LibraryPresenter(
|
|||
}
|
||||
|
||||
val filterFnDownloaded: (LibraryItem) -> Boolean = downloaded@{ item ->
|
||||
if (filterDownloaded == STATE_IGNORE) return@downloaded true
|
||||
if (!downloadedOnly && filterDownloaded == STATE_IGNORE) return@downloaded true
|
||||
val isDownloaded = when {
|
||||
item.manga.source == LocalSource.ID -> true
|
||||
item.manga.isLocal() -> true
|
||||
item.downloadCount != -1 -> item.downloadCount > 0
|
||||
else -> downloadManager.getDownloadCount(item.manga) > 0
|
||||
}
|
||||
|
|
Référencer dans un nouveau ticket