mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 21:21:51 +01:00
Fixed long press not working after switching from list to grid
This commit is contained in:
parent
715507be2a
commit
21d7f342e6
@ -596,6 +596,7 @@ class LibraryController(
|
||||
val position = (recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
|
||||
if (recycler is AutofitRecyclerView && preferences.libraryLayout().getOrDefault() == 0 ||
|
||||
recycler !is AutofitRecyclerView && preferences.libraryLayout().getOrDefault() > 0) {
|
||||
destroyActionModeIfNeeded()
|
||||
recycler_layout.removeView(recycler)
|
||||
recycler = if (preferences.libraryLayout().getOrDefault() == 0) {
|
||||
(recycler_layout.inflate(R.layout.library_list_recycler) as RecyclerView).apply {
|
||||
@ -614,10 +615,16 @@ class LibraryController(
|
||||
}
|
||||
}
|
||||
recycler.setHasFixedSize(true)
|
||||
adapter = LibraryCategoryAdapter(this)
|
||||
recycler.adapter = adapter
|
||||
recycler.addOnScrollListener(scrollListener)
|
||||
adapter.isLongPressDragEnabled = canDrag()
|
||||
recycler_layout.addView(recycler)
|
||||
adapter.setItems(presenter.getList())
|
||||
} else {
|
||||
recycler.adapter = adapter
|
||||
}
|
||||
recycler.adapter = adapter
|
||||
|
||||
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(position, 0)
|
||||
//val adapter = adapter ?: return
|
||||
|
||||
|
@ -503,6 +503,16 @@ class LibraryPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
fun getList(): List<LibraryItem> {
|
||||
val list = mutableListOf<LibraryItem>()
|
||||
for (element in currentMangaMap!!.toSortedMap(compareBy { entry ->
|
||||
categories.find { it.id == entry }?.order ?: -1
|
||||
})) {
|
||||
list.addAll(element.value)
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
fun updateViewBlocking() {
|
||||
/* val list = withContext(Dispatchers.IO) {
|
||||
val showCategories = !preferences.hideCategories().getOrDefault()
|
||||
|
Loading…
Reference in New Issue
Block a user