From 156864b83d8eb0732d3e110da949affd50d7c9bd Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 17 Dec 2020 20:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/adapter/InfiniteScrollListener.kt | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt diff --git a/app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt b/app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt deleted file mode 100644 index 65aa03496..000000000 --- a/app/src/main/java/io/legado/app/base/adapter/InfiniteScrollListener.kt +++ /dev/null @@ -1,33 +0,0 @@ -package io.legado.app.base.adapter - -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView - -/** - * Created by Invincible on 2017/12/15. - * - * 上拉加载更多 - */ -@Suppress("unused") -abstract class InfiniteScrollListener : RecyclerView.OnScrollListener() { - private val loadMoreRunnable = Runnable { onLoadMore() } - - override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { -// if (dy < 0 || dataLoading.isDataLoading()) return - - val layoutManager: LinearLayoutManager = recyclerView.layoutManager as LinearLayoutManager - val visibleItemCount = recyclerView.childCount - val totalItemCount = layoutManager.itemCount - val firstVisibleItem = layoutManager.findFirstVisibleItemPosition() - - if (totalItemCount - visibleItemCount <= firstVisibleItem + VISIBLE_THRESHOLD) { - recyclerView.post(loadMoreRunnable) - } - } - - abstract fun onLoadMore() - - companion object { - private const val VISIBLE_THRESHOLD = 5 - } -}