mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:41:50 +01:00
Fix downloaded only filter
This commit is contained in:
parent
687f3d48ea
commit
7641bb4d0d
@ -4,6 +4,7 @@ import androidx.core.content.edit
|
|||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
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.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.updater.UpdaterJob
|
import eu.kanade.tachiyomi.data.updater.UpdaterJob
|
||||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||||
@ -100,12 +101,14 @@ object Migrations {
|
|||||||
return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.STATE_INCLUDE
|
return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.STATE_INCLUDE
|
||||||
else ExtendedNavigationView.Item.TriStateGroup.STATE_IGNORE
|
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 {
|
prefs.edit {
|
||||||
|
putInt(PreferenceKeys.filterDownloaded, convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
||||||
remove("pref_filter_downloaded_key")
|
remove("pref_filter_downloaded_key")
|
||||||
|
|
||||||
|
putInt(PreferenceKeys.filterUnread, convertBooleanPrefToTriState("pref_filter_unread_key"))
|
||||||
remove("pref_filter_unread_key")
|
remove("pref_filter_unread_key")
|
||||||
|
|
||||||
|
putInt(PreferenceKeys.filterCompleted, convertBooleanPrefToTriState("pref_filter_completed_key"))
|
||||||
remove("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.database.models.MangaCategory
|
||||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.source.LocalSource
|
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
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.combineLatest
|
||||||
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
import eu.kanade.tachiyomi.util.lang.isNullOrUnsubscribed
|
||||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||||
@ -134,9 +134,9 @@ class LibraryPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val filterFnDownloaded: (LibraryItem) -> Boolean = downloaded@{ item ->
|
val filterFnDownloaded: (LibraryItem) -> Boolean = downloaded@{ item ->
|
||||||
if (filterDownloaded == STATE_IGNORE) return@downloaded true
|
if (!downloadedOnly && filterDownloaded == STATE_IGNORE) return@downloaded true
|
||||||
val isDownloaded = when {
|
val isDownloaded = when {
|
||||||
item.manga.source == LocalSource.ID -> true
|
item.manga.isLocal() -> true
|
||||||
item.downloadCount != -1 -> item.downloadCount > 0
|
item.downloadCount != -1 -> item.downloadCount > 0
|
||||||
else -> downloadManager.getDownloadCount(item.manga) > 0
|
else -> downloadManager.getDownloadCount(item.manga) > 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user