mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 02:18:24 +01:00
Category update can only be triggered when the list is at the top
This commit is contained in:
parent
7ca99f749b
commit
c20d86e5c0
@ -2,6 +2,8 @@ package eu.kanade.tachiyomi.ui.library
|
|||||||
|
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
|
import android.support.v7.widget.RecyclerView
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -102,6 +104,15 @@ class LibraryCategoryFragment : BaseFragment(), FlexibleViewHolder.OnListItemCli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||||
|
override fun onScrollStateChanged(recycler: RecyclerView, newState: Int) {
|
||||||
|
// Disable swipe refresh when view is not at the top
|
||||||
|
val firstPos = (recycler.layoutManager as LinearLayoutManager)
|
||||||
|
.findFirstCompletelyVisibleItemPosition()
|
||||||
|
swipe_refresh.isEnabled = firstPos == 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
swipe_refresh.setOnRefreshListener {
|
swipe_refresh.setOnRefreshListener {
|
||||||
if (!LibraryUpdateService.isRunning(activity)) {
|
if (!LibraryUpdateService.isRunning(activity)) {
|
||||||
libraryPresenter.categories.getOrNull(position)?.let {
|
libraryPresenter.categories.getOrNull(position)?.let {
|
||||||
|
Loading…
Reference in New Issue
Block a user