Hopefully fix issues with certain actions for some people

This commit is contained in:
Jobobby04 2020-08-10 00:55:39 -04:00
parent ead5a258be
commit 74065afc27

View File

@ -361,19 +361,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
}
// SY -->
override fun onItemReleased(position: Int) {
controller.invalidateActionMode()
val mangaIds = adapter.currentItems.mapNotNull { it.manga.id }
category.mangaOrder = mangaIds
if (category.id == 0) {
preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
} else {
db.insertCategory(category).asRxObservable().subscribe()
}
if (preferences.librarySortingMode().get() != LibrarySort.DRAG_AND_DROP) {
preferences.librarySortingAscending().set(true)
preferences.librarySortingMode().set(LibrarySort.DRAG_AND_DROP)
controller.refreshSort()
}
return
}
override fun shouldMoveItem(fromPosition: Int, toPosition: Int): Boolean {
@ -389,7 +377,20 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
}
override fun onItemMove(fromPosition: Int, toPosition: Int) {
return
if (fromPosition == toPosition) return
controller.invalidateActionMode()
val mangaIds = adapter.currentItems.mapNotNull { it.manga.id }
category.mangaOrder = mangaIds
if (category.id == 0) {
preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
} else {
db.insertCategory(category).asRxObservable().subscribe()
}
if (preferences.librarySortingMode().get() != LibrarySort.DRAG_AND_DROP) {
preferences.librarySortingAscending().set(true)
preferences.librarySortingMode().set(LibrarySort.DRAG_AND_DROP)
controller.refreshSort()
}
}
// SY <--