Remove library sort by source

This commit is contained in:
arkon 2020-02-11 19:05:16 -05:00
parent 144418434b
commit 9e4c61c139
3 changed files with 4 additions and 13 deletions

View File

@ -115,11 +115,9 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
private val unread = Item.MultiSort(R.string.action_filter_unread, this) private val unread = Item.MultiSort(R.string.action_filter_unread, this)
private val source = Item.MultiSort(R.string.manga_info_source_label, this)
private val latestChapter = Item.MultiSort(R.string.action_sort_latest_chapter, this) private val latestChapter = Item.MultiSort(R.string.action_sort_latest_chapter, this)
override val items = listOf(alphabetically, lastRead, lastUpdated, unread, total, source, latestChapter) override val items = listOf(alphabetically, lastRead, lastUpdated, unread, total, latestChapter)
override val header = Item.Header(R.string.action_sort) override val header = Item.Header(R.string.action_sort)
@ -135,7 +133,6 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
lastUpdated.state = if (sorting == LibrarySort.LAST_UPDATED) order else SORT_NONE lastUpdated.state = if (sorting == LibrarySort.LAST_UPDATED) order else SORT_NONE
unread.state = if (sorting == LibrarySort.UNREAD) order else SORT_NONE unread.state = if (sorting == LibrarySort.UNREAD) order else SORT_NONE
total.state = if (sorting == LibrarySort.TOTAL) order else SORT_NONE total.state = if (sorting == LibrarySort.TOTAL) order else SORT_NONE
source.state = if (sorting == LibrarySort.SOURCE) order else SORT_NONE
latestChapter.state = if (sorting == LibrarySort.LATEST_CHAPTER) order else SORT_NONE latestChapter.state = if (sorting == LibrarySort.LATEST_CHAPTER) order else SORT_NONE
} }
@ -157,11 +154,10 @@ class LibraryNavigationView @JvmOverloads constructor(context: Context, attrs: A
lastUpdated -> LibrarySort.LAST_UPDATED lastUpdated -> LibrarySort.LAST_UPDATED
unread -> LibrarySort.UNREAD unread -> LibrarySort.UNREAD
total -> LibrarySort.TOTAL total -> LibrarySort.TOTAL
source -> LibrarySort.SOURCE
latestChapter -> LibrarySort.LATEST_CHAPTER latestChapter -> LibrarySort.LATEST_CHAPTER
else -> throw Exception("Unknown sorting") else -> throw Exception("Unknown sorting")
}) })
preferences.librarySortingAscending().set(if (item.state == SORT_ASC) true else false) preferences.librarySortingAscending().set(item.state == SORT_ASC)
item.group.items.forEach { adapter.notifyItemChanged(it) } item.group.items.forEach { adapter.notifyItemChanged(it) }
} }

View File

@ -206,11 +206,6 @@ class LibraryPresenter(
val mange2TotalChapter = totalChapterManga[i2.manga.id!!] ?: 0 val mange2TotalChapter = totalChapterManga[i2.manga.id!!] ?: 0
manga1TotalChapter.compareTo(mange2TotalChapter) manga1TotalChapter.compareTo(mange2TotalChapter)
} }
LibrarySort.SOURCE -> {
val source1Name = sourceManager.getOrStub(i1.manga.source).name
val source2Name = sourceManager.getOrStub(i2.manga.source).name
source1Name.compareTo(source2Name)
}
LibrarySort.LATEST_CHAPTER -> { LibrarySort.LATEST_CHAPTER -> {
val manga1latestChapter = latestChapterManga[i1.manga.id!!] ?: 0 val manga1latestChapter = latestChapterManga[i1.manga.id!!] ?: 0
val manga2latestChapter = latestChapterManga[i2.manga.id!!] ?: 0 val manga2latestChapter = latestChapterManga[i2.manga.id!!] ?: 0

View File

@ -7,6 +7,6 @@ object LibrarySort {
const val LAST_UPDATED = 2 const val LAST_UPDATED = 2
const val UNREAD = 3 const val UNREAD = 3
const val TOTAL = 4 const val TOTAL = 4
const val SOURCE = 5
const val LATEST_CHAPTER = 6 const val LATEST_CHAPTER = 6
} }