mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-09-10 20:43:14 +02:00
Renaming pref to hide category instead
So all filters are default off
This commit is contained in:
parent
fee697f148
commit
3d3c6b3db5
@ -186,7 +186,7 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun filterTracked() = rxPrefs.getInteger(Keys.filterTrcaked, 0)
|
fun filterTracked() = rxPrefs.getInteger(Keys.filterTrcaked, 0)
|
||||||
|
|
||||||
fun showCategories() = rxPrefs.getBoolean("show_categories", true)
|
fun hideCategories() = rxPrefs.getBoolean("hide_categories", false)
|
||||||
|
|
||||||
fun librarySortingMode() = rxPrefs.getInteger(Keys.librarySortingMode, 0)
|
fun librarySortingMode() = rxPrefs.getInteger(Keys.librarySortingMode, 0)
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class LibraryCategoryAdapter(val view: LibraryCategoryView) :
|
|||||||
val preferences:PreferencesHelper by injectLazy()
|
val preferences:PreferencesHelper by injectLazy()
|
||||||
when (preferences.librarySortingMode().getOrDefault()) {
|
when (preferences.librarySortingMode().getOrDefault()) {
|
||||||
LibrarySort.DRAG_AND_DROP -> {
|
LibrarySort.DRAG_AND_DROP -> {
|
||||||
if (preferences.showCategories().getOrDefault()) {
|
if (!preferences.hideCategories().getOrDefault()) {
|
||||||
val title = (iFlexible as LibraryItem).manga.currentTitle()
|
val title = (iFlexible as LibraryItem).manga.currentTitle()
|
||||||
if (preferences.removeArticles().getOrDefault())
|
if (preferences.removeArticles().getOrDefault())
|
||||||
title.removeArticles().substring(0, 1).toUpperCase(Locale.US)
|
title.removeArticles().substring(0, 1).toUpperCase(Locale.US)
|
||||||
|
@ -102,7 +102,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
// Disable swipe refresh when view is not at the top
|
// Disable swipe refresh when view is not at the top
|
||||||
val firstPos = (recycler.layoutManager as LinearLayoutManager)
|
val firstPos = (recycler.layoutManager as LinearLayoutManager)
|
||||||
.findFirstCompletelyVisibleItemPosition()
|
.findFirstCompletelyVisibleItemPosition()
|
||||||
swipe_refresh.isEnabled = firstPos <= 0 && preferences.showCategories().getOrDefault()
|
swipe_refresh.isEnabled = firstPos <= 0 && !preferences.hideCategories()
|
||||||
|
.getOrDefault()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fast_scroller.addOnScrollStateChangeListener {
|
fast_scroller.addOnScrollStateChangeListener {
|
||||||
@ -189,7 +190,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
preferences.filterTracked().getOrDefault() +
|
preferences.filterTracked().getOrDefault() +
|
||||||
preferences.filterUnread().getOrDefault() +
|
preferences.filterUnread().getOrDefault() +
|
||||||
preferences.filterCompleted().getOrDefault() == 0 &&
|
preferences.filterCompleted().getOrDefault() == 0 &&
|
||||||
preferences.showCategories().getOrDefault()
|
!preferences.hideCategories().getOrDefault()
|
||||||
return sortingMode == LibrarySort.DRAG_AND_DROP && filterOff &&
|
return sortingMode == LibrarySort.DRAG_AND_DROP && filterOff &&
|
||||||
adapter.mode != SelectableAdapter.Mode.MULTI
|
adapter.mode != SelectableAdapter.Mode.MULTI
|
||||||
}
|
}
|
||||||
@ -218,7 +219,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
// Update the category with its manga.
|
// Update the category with its manga.
|
||||||
adapter.setItems(mangaForCategory)
|
adapter.setItems(mangaForCategory)
|
||||||
|
|
||||||
swipe_refresh.isEnabled = preferences.showCategories().getOrDefault()
|
swipe_refresh.isEnabled = !preferences.hideCategories().getOrDefault()
|
||||||
|
|
||||||
if (adapter.mode == SelectableAdapter.Mode.MULTI) {
|
if (adapter.mode == SelectableAdapter.Mode.MULTI) {
|
||||||
controller.selectedMangas.forEach { manga ->
|
controller.selectedMangas.forEach { manga ->
|
||||||
|
@ -363,7 +363,8 @@ class LibraryController(
|
|||||||
* Called when a filter is changed.
|
* Called when a filter is changed.
|
||||||
*/
|
*/
|
||||||
private fun onFilterChanged(item: ExtendedNavigationView.Item) {
|
private fun onFilterChanged(item: ExtendedNavigationView.Item) {
|
||||||
if (item is ExtendedNavigationView.Item.MultiStateGroup && item.resTitle == R.string.categories) {
|
if (item is ExtendedNavigationView.Item.MultiStateGroup &&
|
||||||
|
item.resTitle == R.string.action_hide_categories) {
|
||||||
activity?.invalidateOptionsMenu()
|
activity?.invalidateOptionsMenu()
|
||||||
presenter.requestFullUpdate()
|
presenter.requestFullUpdate()
|
||||||
return
|
return
|
||||||
@ -425,7 +426,7 @@ class LibraryController(
|
|||||||
val reorganizeItem = menu.findItem(R.id.action_reorganize)
|
val reorganizeItem = menu.findItem(R.id.action_reorganize)
|
||||||
reorganizeItem.isVisible =
|
reorganizeItem.isVisible =
|
||||||
preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
|
preferences.librarySortingMode().getOrDefault() == LibrarySort.DRAG_AND_DROP &&
|
||||||
preferences.showCategories().getOrDefault()
|
!preferences.hideCategories().getOrDefault()
|
||||||
reorderMenuItem = reorganizeItem
|
reorderMenuItem = reorganizeItem
|
||||||
enableReorderItems()
|
enableReorderItems()
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
|
|||||||
|
|
||||||
private val tracked = Item.TriStateGroup(R.string.tracked, this)
|
private val tracked = Item.TriStateGroup(R.string.tracked, this)
|
||||||
|
|
||||||
private val categories = Item.TriStateGroup(R.string.categories, this)
|
private val categories = Item.TriStateGroup(R.string.action_hide_categories, this)
|
||||||
|
|
||||||
override val items:List<Item> = {
|
override val items:List<Item> = {
|
||||||
val list = mutableListOf<Item>()
|
val list = mutableListOf<Item>()
|
||||||
@ -112,8 +112,9 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
|
|||||||
|
|
||||||
override fun initModels() {
|
override fun initModels() {
|
||||||
try {
|
try {
|
||||||
categories.state = if (preferences.showCategories().getOrDefault()) STATE_INCLUDE
|
categories.state =
|
||||||
else STATE_IGNORE
|
if (preferences.hideCategories().getOrDefault()) STATE_INCLUDE
|
||||||
|
else STATE_IGNORE
|
||||||
downloaded.state = preferences.filterDownloaded().getOrDefault()
|
downloaded.state = preferences.filterDownloaded().getOrDefault()
|
||||||
unread.state = preferences.filterUnread().getOrDefault()
|
unread.state = preferences.filterUnread().getOrDefault()
|
||||||
completed.state = preferences.filterCompleted().getOrDefault()
|
completed.state = preferences.filterCompleted().getOrDefault()
|
||||||
@ -133,7 +134,7 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
|
|||||||
}
|
}
|
||||||
item.state = newState
|
item.state = newState
|
||||||
when (item) {
|
when (item) {
|
||||||
categories -> preferences.showCategories().set(item.state == STATE_INCLUDE)
|
categories -> preferences.hideCategories().set(item.state == STATE_INCLUDE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (item is Item.TriStateGroup) {
|
else if (item is Item.TriStateGroup) {
|
||||||
|
@ -325,7 +325,7 @@ class LibraryPresenter(
|
|||||||
else dbCategories
|
else dbCategories
|
||||||
|
|
||||||
this.allCategories = categories
|
this.allCategories = categories
|
||||||
this.categories = if (!preferences.showCategories().getOrDefault())
|
this.categories = if (preferences.hideCategories().getOrDefault())
|
||||||
arrayListOf(createDefaultCategory())
|
arrayListOf(createDefaultCategory())
|
||||||
else categories
|
else categories
|
||||||
Library(this.categories, libraryManga)
|
Library(this.categories, libraryManga)
|
||||||
@ -359,7 +359,7 @@ class LibraryPresenter(
|
|||||||
val libraryAsList = preferences.libraryAsList()
|
val libraryAsList = preferences.libraryAsList()
|
||||||
return db.getLibraryMangas().asRxObservable()
|
return db.getLibraryMangas().asRxObservable()
|
||||||
.map { list ->
|
.map { list ->
|
||||||
if (preferences.showCategories().getOrDefault()) {
|
if (!preferences.hideCategories().getOrDefault()) {
|
||||||
list.map { LibraryItem(it, libraryAsList) }.groupBy { it.manga.category }
|
list.map { LibraryItem(it, libraryAsList) }.groupBy { it.manga.category }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<string name="action_sort_total">Total chapters</string>
|
<string name="action_sort_total">Total chapters</string>
|
||||||
<string name="action_sort_last_read">Last read</string>
|
<string name="action_sort_last_read">Last read</string>
|
||||||
<string name="action_sort_drag_and_drop">Drag & Drop</string>
|
<string name="action_sort_drag_and_drop">Drag & Drop</string>
|
||||||
|
<string name="action_hide_categories">Hide categories</string>
|
||||||
<string name="action_search">Search</string>
|
<string name="action_search">Search</string>
|
||||||
<string name="action_skip_manga">Don\'t migrate</string>
|
<string name="action_skip_manga">Don\'t migrate</string>
|
||||||
<string name="action_select_all">Select all</string>
|
<string name="action_select_all">Select all</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user