mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Added "Reverse order" option to d&d sorting to reduce menu size
This commit is contained in:
parent
ea281be29e
commit
5ea683b686
@ -219,15 +219,15 @@ class LibraryController(
|
||||
if (orderOfCat != null) {
|
||||
subMenu.setGroupCheckable(R.id.reorder_group, true, true)
|
||||
when (orderOfCat) {
|
||||
'a' -> subMenu.findItem(R.id.action_alpha_asc)?.isChecked = true
|
||||
'b' -> subMenu.findItem(R.id.action_alpha_dsc)?.isChecked = true
|
||||
'c' -> subMenu.findItem(R.id.action_update_asc)?.isChecked = true
|
||||
'd' -> subMenu.findItem(R.id.action_update_dsc)?.isChecked = true
|
||||
'e' -> subMenu.findItem(R.id.action_unread)?.isChecked = true
|
||||
'f' -> subMenu.findItem(R.id.action_last_read)?.isChecked = true
|
||||
'a', 'b' -> subMenu.findItem(R.id.action_alpha_asc)?.isChecked = true
|
||||
'c', 'd' -> subMenu.findItem(R.id.action_update_asc)?.isChecked = true
|
||||
'e', 'f' -> subMenu.findItem(R.id.action_unread)?.isChecked = true
|
||||
'g', 'h' -> subMenu.findItem(R.id.action_last_read)?.isChecked = true
|
||||
}
|
||||
subMenu.findItem(R.id.action_reverse)?.isVisible = true
|
||||
}
|
||||
else {
|
||||
subMenu.findItem(R.id.action_reverse)?.isVisible = false
|
||||
subMenu.setGroupCheckable(R.id.reorder_group, false, false)
|
||||
}
|
||||
}
|
||||
@ -479,12 +479,11 @@ class LibraryController(
|
||||
R.id.action_source_migration -> {
|
||||
router.pushController(MigrationController().withFadeTransaction())
|
||||
}
|
||||
R.id.action_alpha_asc -> reOrder(1)
|
||||
R.id.action_alpha_dsc -> reOrder(2)
|
||||
R.id.action_update_asc -> reOrder(3)
|
||||
R.id.action_update_dsc -> reOrder(4)
|
||||
R.id.action_unread -> reOrder(5)
|
||||
R.id.action_last_read -> reOrder(6)
|
||||
R.id.action_alpha_asc -> reOrder(0)
|
||||
R.id.action_update_asc -> reOrder(1)
|
||||
R.id.action_unread -> reOrder(2)
|
||||
R.id.action_last_read -> reOrder(3)
|
||||
R.id.action_reverse -> reOrder(-1)
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
@ -492,8 +491,15 @@ class LibraryController(
|
||||
}
|
||||
|
||||
private fun reOrder(type: Int) {
|
||||
val modType = if (type == -1) {
|
||||
val t = (adapter?.categories?.getOrNull(library_pager.currentItem)?.mangaSort
|
||||
?.minus('a') ?: 0) + 1
|
||||
if (t % 2 != 0) t + 1
|
||||
else t - 1
|
||||
}
|
||||
else 2 * type + 1
|
||||
adapter?.categories?.getOrNull(library_pager.currentItem)?.id?.let {
|
||||
reorganizeRelay.call(it to type)
|
||||
reorganizeRelay.call(it to modType)
|
||||
onSortChanged()
|
||||
}
|
||||
}
|
||||
|
@ -236,19 +236,20 @@ class LibraryPresenter(
|
||||
val category = catListing.find { it.id == i1.manga.category }
|
||||
when {
|
||||
category?.mangaSort != null -> {
|
||||
when (category.mangaSort) {
|
||||
'a' -> sortAlphabetical(i1, i2)
|
||||
'b' -> sortAlphabetical(i2, i1)
|
||||
'c' -> i2.manga.last_update.compareTo(i1.manga.last_update)
|
||||
'd' -> i1.manga.last_update.compareTo(i2.manga.last_update)
|
||||
'e' -> i2.manga.unread.compareTo(i1.manga.unread)
|
||||
'f' -> {
|
||||
var sort = when (category.mangaSort) {
|
||||
'a', 'b' -> sortAlphabetical(i1, i2)
|
||||
'c', 'd' -> i2.manga.last_update.compareTo(i1.manga.last_update)
|
||||
'e', 'f' -> i2.manga.unread.compareTo(i1.manga.unread)
|
||||
'g', 'h' -> {
|
||||
val manga1LastRead = lastReadManga[i1.manga.id!!] ?: lastReadManga.size
|
||||
val manga2LastRead = lastReadManga[i2.manga.id!!] ?: lastReadManga.size
|
||||
manga1LastRead.compareTo(manga2LastRead)
|
||||
}
|
||||
else -> sortAlphabetical(i1, i2)
|
||||
}
|
||||
if ((category.mangaSort!! - 'a') % 2 == 1 )
|
||||
sort *= -1
|
||||
sort
|
||||
}
|
||||
category?.mangaOrder?.isEmpty() == false -> {
|
||||
val order = category.mangaOrder
|
||||
|
@ -42,15 +42,9 @@
|
||||
<item
|
||||
android:id="@+id/action_alpha_asc"
|
||||
android:title="@string/title"/>
|
||||
<item
|
||||
android:id="@+id/action_alpha_dsc"
|
||||
android:title="@string/action_title_reverse"/>
|
||||
<item
|
||||
android:id="@+id/action_update_asc"
|
||||
android:title="@string/action_sort_last_updated"/>
|
||||
<item
|
||||
android:id="@+id/action_update_dsc"
|
||||
android:title="@string/action_sort_first_updated"/>
|
||||
<item
|
||||
android:id="@+id/action_unread"
|
||||
android:title="@string/action_filter_unread"/>
|
||||
@ -59,6 +53,10 @@
|
||||
android:title="@string/action_sort_last_read"/>
|
||||
|
||||
</group>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reverse"
|
||||
android:title="@string/action_reverse_order"/>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
@ -75,14 +75,12 @@
|
||||
<string name="action_sort_down">По убыванию</string>
|
||||
<string name="action_sort_drag_and_drop">Перетаскивание</string>
|
||||
<string name="action_sort_enabled">По статусу вкл/выкл</string>
|
||||
<string name="action_sort_first_updated">Последняя обновленная (обр. порядок)</string>
|
||||
<string name="action_sort_last_read">Последняя прочитанная</string>
|
||||
<string name="action_sort_last_updated">Последняя обновленная</string>
|
||||
<string name="action_sort_total">По количеству глав</string>
|
||||
<string name="action_sort_up">По возрастанию</string>
|
||||
<string name="action_start">Старт</string>
|
||||
<string name="action_stop">Стоп</string>
|
||||
<string name="action_title_reverse">Название (обр. порядок)</string>
|
||||
<string name="action_track">Отслеживать</string>
|
||||
<string name="action_undo">Отменить</string>
|
||||
<string name="action_update">Обновить</string>
|
||||
|
@ -107,9 +107,8 @@
|
||||
<string name="action_migrate_now">Migrate now</string>
|
||||
<string name="action_copy_now">Copy now</string>
|
||||
<string name="action_reorganize_by">Reorder</string>
|
||||
<string name="action_title_reverse">Title (descending)</string>
|
||||
<string name="action_reverse_order">Reverse order</string>
|
||||
<string name="action_sort_last_updated">Last updated</string>
|
||||
<string name="action_sort_first_updated">Last updated (desc.)</string>
|
||||
<string name="action_hide_title">Hide title</string>
|
||||
<string name="action_show_title">Show title</string>
|
||||
<string name="action_newest">Newest</string>
|
||||
|
Loading…
Reference in New Issue
Block a user