Skip to content

Commit

Permalink
Merge pull request #1797 from guominfang/master
Browse files Browse the repository at this point in the history
优化数据是否满一屏判断
  • Loading branch information
AllenCoder authored May 8, 2018
2 parents fd5fc81 + c413222 commit a07fa14
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void disableLoadMoreIfNotFullPage(RecyclerView recyclerView) {
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
if ((linearLayoutManager.findLastCompletelyVisibleItemPosition() + 1) != getItemCount()) {
if (isFullScreen(linearLayoutManager)) {
setEnableLoadMore(true);
}
}
Expand All @@ -238,6 +238,11 @@ public void run() {
}
}

private boolean isFullScreen(LinearLayoutManager llm) {
return (llm.findLastCompletelyVisibleItemPosition() + 1) != getItemCount() ||
llm.findFirstCompletelyVisibleItemPosition() != 0;
}

private int getTheBiggestNumber(int[] numbers) {
int tmp = -1;
if (numbers == null || numbers.length == 0) {
Expand Down Expand Up @@ -976,6 +981,7 @@ public boolean onLongClick(View v) {

/**
* override this method if you want to override click event logic
*
* @param v
* @param position
*/
Expand All @@ -985,6 +991,7 @@ public void setOnItemClick(View v, int position) {

/**
* override this method if you want to override longClick event logic
*
* @param v
* @param position
* @return
Expand Down

0 comments on commit a07fa14

Please sign in to comment.