mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 02:41:51 +01:00
Updating for change of category pref
This commit is contained in:
parent
596597c910
commit
a9a94d7654
@ -411,7 +411,7 @@ class LibraryPresenter(
|
||||
private fun getLibraryFromDB(): Library {
|
||||
val categories = db.getCategories().executeAsBlocking().toMutableList()
|
||||
val libraryAsList = preferences.libraryAsList()
|
||||
val showCategories = preferences.showCategories().getOrDefault()
|
||||
val showCategories = !preferences.hideCategories().getOrDefault()
|
||||
var libraryManga = db.getLibraryMangas().executeAsBlocking()
|
||||
if (!showCategories)
|
||||
libraryManga = libraryManga.distinctBy { it.id }
|
||||
@ -424,7 +424,7 @@ class LibraryPresenter(
|
||||
categories.add(0, createDefaultCategory())
|
||||
|
||||
this.allCategories = categories
|
||||
this.categories = if (!preferences.showCategories().getOrDefault())
|
||||
this.categories = if (preferences.hideCategories().getOrDefault())
|
||||
arrayListOf(createDefaultCategory())
|
||||
else categories
|
||||
return Library(this.categories, libraryMap)
|
||||
|
@ -231,7 +231,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
val sortingMode = preferences.librarySortingMode().getOrDefault()
|
||||
return if (!trueSort && sortingMode == LibrarySort.DRAG_AND_DROP &&
|
||||
lastCategory != null &&
|
||||
preferences.showCategories().getOrDefault()) {
|
||||
!preferences.hideCategories().getOrDefault()) {
|
||||
when (lastCategory?.mangaSort) {
|
||||
'a', 'b' -> LibrarySort.ALPHA
|
||||
'c', 'd' -> LibrarySort.LAST_UPDATED
|
||||
@ -247,7 +247,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
|
||||
private fun getFilters(): List<Int> {
|
||||
val filters = mutableListOf<Int>()
|
||||
val categoriesOn = preferences.showCategories().getOrDefault()
|
||||
val categoriesOn = !preferences.hideCategories().getOrDefault()
|
||||
if (!categoriesOn) {
|
||||
filters.add(R.string.hiding_categories)
|
||||
}
|
||||
@ -324,7 +324,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
}
|
||||
}
|
||||
launchUI {
|
||||
categories.setState(!preferences.showCategories().getOrDefault())
|
||||
categories.setState(preferences.hideCategories().getOrDefault())
|
||||
downloaded.setState(preferences.filterDownloaded())
|
||||
completed.setState(preferences.filterCompleted())
|
||||
unread.setState(preferences.filterUnread())
|
||||
@ -479,7 +479,8 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
|
||||
private fun setCatSortText() {
|
||||
launchUI {
|
||||
if (preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP && preferences.showCategories().getOrDefault() && lastCategory != null) {
|
||||
if (preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
|
||||
!preferences.hideCategories().getOrDefault() && lastCategory != null) {
|
||||
val sortId = withContext(Dispatchers.IO) { sorting() }
|
||||
val drawable = withContext(Dispatchers.IO) {
|
||||
tintVector(
|
||||
@ -536,7 +537,7 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
override fun onFilterClicked(view: FilterTagGroup, index: Int, updatePreference:Boolean) {
|
||||
if (updatePreference) {
|
||||
if (view == categories) {
|
||||
preferences.showCategories().set(index != 0)
|
||||
preferences.hideCategories().set(index == 0)
|
||||
onGroupClicked(ACTION_REFRESH)
|
||||
} else {
|
||||
when (view) {
|
||||
@ -559,10 +560,10 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
|
||||
}
|
||||
|
||||
private fun clearFilters() {
|
||||
val action = if (preferences.showCategories().getOrDefault()) ACTION_REFRESH
|
||||
val action = if (preferences.hideCategories().getOrDefault()) ACTION_REFRESH
|
||||
else ACTION_FILTER
|
||||
|
||||
preferences.showCategories().set(true)
|
||||
preferences.hideCategories().set(false)
|
||||
preferences.filterDownloaded().set(0)
|
||||
preferences.filterUnread().set(0)
|
||||
preferences.filterCompleted().set(0)
|
||||
|
@ -19,7 +19,10 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<HorizontalScrollView
|
||||
@ -91,7 +94,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:clickable="true"
|
||||
android:drawablePadding="16dp"
|
||||
android:drawablePadding="6dp"
|
||||
android:background="@drawable/square_ripple"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
|
Loading…
Reference in New Issue
Block a user