Add manga-wised rotation mode settings (#4841)
* Add manga-wised rotation mode settings Based on #3522 Co-authored-by: bboyz269 <4453811+bboyz269@users.noreply.github.com> * Fix small mistakes * Complete TODOs * Rename functions rotation -> orientation * Fix orientation icon not changing Bug from video * Fix bug with force portrait not being force if a default value Bug from video * Backup viewer_flag as a seperate field in so legacy/forks doesn't crash * Make viewer_flags nullable so old backups viewer gets restored * Add migration for old rotation and viewer to new defaults ones * Rename variable in enums * Fix migration after OrientationType was changed * Remove untrue comment Co-authored-by: bboyz269 <4453811+bboyz269@users.noreply.github.com>
This commit is contained in:
@@ -122,9 +122,9 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
}
|
||||
|
||||
val sortFunction: (Chapter, Chapter) -> Int = when (manga.sorting) {
|
||||
Manga.SORTING_SOURCE -> { c1, c2 -> c2.source_order.compareTo(c1.source_order) }
|
||||
Manga.SORTING_NUMBER -> { c1, c2 -> c1.chapter_number.compareTo(c2.chapter_number) }
|
||||
Manga.SORTING_UPLOAD_DATE -> { c1, c2 -> c1.date_upload.compareTo(c2.date_upload) }
|
||||
Manga.CHAPTER_SORTING_SOURCE -> { c1, c2 -> c2.source_order.compareTo(c1.source_order) }
|
||||
Manga.CHAPTER_SORTING_NUMBER -> { c1, c2 -> c1.chapter_number.compareTo(c2.chapter_number) }
|
||||
Manga.CHAPTER_SORTING_UPLOAD_DATE -> { c1, c2 -> c1.date_upload.compareTo(c2.date_upload) }
|
||||
else -> throw NotImplementedError("Unknown sorting method")
|
||||
}
|
||||
|
||||
@@ -133,8 +133,8 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
|
||||
val currChapterIndex = chapters.indexOfFirst { chapter.id == it.id }
|
||||
return when (manga.sorting) {
|
||||
Manga.SORTING_SOURCE -> chapters.getOrNull(currChapterIndex + 1)
|
||||
Manga.SORTING_NUMBER -> {
|
||||
Manga.CHAPTER_SORTING_SOURCE -> chapters.getOrNull(currChapterIndex + 1)
|
||||
Manga.CHAPTER_SORTING_NUMBER -> {
|
||||
val chapterNumber = chapter.chapter_number
|
||||
|
||||
((currChapterIndex + 1) until chapters.size)
|
||||
@@ -144,7 +144,7 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
it.chapter_number <= chapterNumber + 1
|
||||
}
|
||||
}
|
||||
Manga.SORTING_UPLOAD_DATE -> {
|
||||
Manga.CHAPTER_SORTING_UPLOAD_DATE -> {
|
||||
chapters.drop(currChapterIndex + 1)
|
||||
.firstOrNull { it.date_upload >= chapter.date_upload }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user