mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 01:35:09 +01:00
More fixes to D&D sorting with new presenter
This commit is contained in:
parent
d4153a9f41
commit
c48252b61c
@ -81,8 +81,6 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
|
|
||||||
private var lastClickPosition = -1
|
private var lastClickPosition = -1
|
||||||
|
|
||||||
private var justDraggedAndDropped = false
|
|
||||||
|
|
||||||
fun onCreate(controller: LibraryController) {
|
fun onCreate(controller: LibraryController) {
|
||||||
this.controller = controller
|
this.controller = controller
|
||||||
|
|
||||||
@ -239,10 +237,10 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
val mangaForCategory = event.getMangaForCategory(category).orEmpty()
|
val mangaForCategory = event.getMangaForCategory(category).orEmpty()
|
||||||
|
|
||||||
// Update the category with its manga.
|
// Update the category with its manga.
|
||||||
if (!justDraggedAndDropped)
|
// if (!justDraggedAndDropped)
|
||||||
adapter.setItems(mangaForCategory)
|
adapter.setItems(mangaForCategory)
|
||||||
else
|
// else
|
||||||
justDraggedAndDropped = false
|
// justDraggedAndDropped = false
|
||||||
|
|
||||||
swipe_refresh.isEnabled = !preferences.hideCategories().getOrDefault()
|
swipe_refresh.isEnabled = !preferences.hideCategories().getOrDefault()
|
||||||
|
|
||||||
@ -366,7 +364,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
|
preferences.defaultMangaOrder().set(mangaIds.joinToString("/"))
|
||||||
else
|
else
|
||||||
db.insertCategory(category).asRxObservable().subscribe()
|
db.insertCategory(category).asRxObservable().subscribe()
|
||||||
justDraggedAndDropped = true
|
//justDraggedAndDropped = true
|
||||||
controller.onCatSortChanged(category.id)
|
controller.onCatSortChanged(category.id)
|
||||||
controller.enableReorderItems(category)
|
controller.enableReorderItems(category)
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,9 @@ class LibraryGridHolder(
|
|||||||
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
local_text.visibility = if (item.manga.source == LocalSource.ID) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
// Update the cover.
|
// Update the cover.
|
||||||
GlideApp.with(view.context).clear(thumbnail)
|
if (item.manga.thumbnail_url == null)
|
||||||
GlideApp.with(view.context)
|
GlideApp.with(view.context).clear(thumbnail)
|
||||||
.load(item.manga)
|
else GlideApp.with(view.context).load(item.manga)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
|
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.manga.id!!).toString()))
|
||||||
.centerCrop().into(thumbnail)
|
.centerCrop().into(thumbnail)
|
||||||
|
@ -211,7 +211,11 @@ class LibraryPresenter(
|
|||||||
|
|
||||||
private fun applySort(map: LibraryMap, catId: Int?): LibraryMap {
|
private fun applySort(map: LibraryMap, catId: Int?): LibraryMap {
|
||||||
if (catId == null) return map
|
if (catId == null) return map
|
||||||
val category = allCategories.find { it.id == catId } ?: return map
|
val category = db.getCategories().executeAsBlocking().find { it.id == catId } ?: return map
|
||||||
|
allCategories.find { it.id == catId }?.apply {
|
||||||
|
mangaOrder = category.mangaOrder
|
||||||
|
mangaSort = category.mangaSort
|
||||||
|
}
|
||||||
|
|
||||||
val lastReadManga by lazy {
|
val lastReadManga by lazy {
|
||||||
var counter = 0
|
var counter = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user