add sort by chapter number in download queue (#4337)
* add sort by chapter number in download queue * Bigest, smallest chapter download * grouped
This commit is contained in:
parent
86b9d7e843
commit
a083e1f71a
@ -157,6 +157,17 @@ class DownloadController :
|
||||
val downloads = items.mapNotNull { it.download }
|
||||
presenter.reorder(downloads)
|
||||
}
|
||||
R.id.bigest, R.id.smallest -> {
|
||||
val adapter = adapter ?: return false
|
||||
val items = adapter.currentItems.sortedBy { it.download.chapter.chapter_number }
|
||||
.toMutableList()
|
||||
if (item.itemId == R.id.bigest) {
|
||||
items.reverse()
|
||||
}
|
||||
adapter.updateDataSet(items)
|
||||
val downloads = items.mapNotNull { it.download }
|
||||
presenter.reorder(downloads)
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
@ -6,6 +6,11 @@
|
||||
android:id="@+id/reorder"
|
||||
android:title="@string/action_reorganize_by"
|
||||
app:showAsAction="never">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/action_sort_date"
|
||||
android:title="@string/action_order_by_upload_date"
|
||||
app:showAsAction="never">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/newest"
|
||||
@ -15,6 +20,21 @@
|
||||
android:title="@string/action_oldest" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_sort_chapter"
|
||||
android:title="@string/action_order_by_chapter_number"
|
||||
app:showAsAction="never">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/bigest"
|
||||
android:title="@string/action_bigest" />
|
||||
<item
|
||||
android:id="@+id/smallest"
|
||||
android:title="@string/action_smallest" />
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/clear_queue"
|
||||
|
@ -103,8 +103,12 @@
|
||||
<string name="action_sort">Sort</string>
|
||||
<string name="action_sort_descending">Descending</string>
|
||||
<string name="action_reorganize_by">Reorder</string>
|
||||
<string name="action_order_by_upload_date">By upload date</string>
|
||||
<string name="action_order_by_chapter_number">By chapter number</string>
|
||||
<string name="action_newest">Newest</string>
|
||||
<string name="action_oldest">Oldest</string>
|
||||
<string name="action_bigest">Bigest</string>
|
||||
<string name="action_smallest">Smallest</string>
|
||||
<string name="action_move_to_top">Move to top</string>
|
||||
<string name="action_move_to_bottom">Move to bottom</string>
|
||||
<string name="action_install">Install</string>
|
||||
|
Loading…
Reference in New Issue
Block a user