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:
Riztard Lanthorn
2021-01-24 01:10:57 +07:00
committed by GitHub
parent 86b9d7e843
commit a083e1f71a
3 changed files with 39 additions and 4 deletions

View File

@ -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)
}