|
|
@@ -72,6 +72,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
|
|
|
protected SmartRefreshLayout refreshLayout;
|
|
|
@BindView(R.id.view_list)
|
|
|
protected RecyclerView view_list;
|
|
|
+ @BindView(R.id.tag_view)
|
|
|
+ View tag_view;
|
|
|
|
|
|
protected BaseMessage lastMessage;//最后一个网络获取的结果
|
|
|
protected int page = 1;//页数
|
|
|
@@ -92,6 +94,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
|
|
|
// refreshLayout.setFooterTriggerRate(1);
|
|
|
}
|
|
|
protected View bottomLine;
|
|
|
+ /* 记录滑动坐标的数组 */
|
|
|
+ int[] locate = new int[2];
|
|
|
public void initListener() {
|
|
|
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
|
|
|
@Override
|
|
|
@@ -136,8 +140,9 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
|
|
|
int lastVisibleItem = linearLayoutManager.findLastCompletelyVisibleItemPosition();
|
|
|
int totalCount = linearLayoutManager.getItemCount();
|
|
|
Log.e("lastvisi_item_-----", lastVisibleItem+","+totalCount);
|
|
|
+ Log.e("lastvisi_item_-----", locate[1]+"");
|
|
|
|
|
|
- if(newState == RecyclerView.SCROLL_STATE_IDLE && isSlidingToLast){//滑动到了底部
|
|
|
+ if(newState == RecyclerView.SCROLL_STATE_IDLE && isSlidingToLast && locate[1] > 0){//滑动到了底部
|
|
|
if(ListUtil.size(list) >= per_page*page){
|
|
|
|
|
|
refreshLayout.autoLoadMore();
|
|
|
@@ -150,6 +155,8 @@ public abstract class BaseListFragment2<T> extends BaseFragment {
|
|
|
@Override
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
super.onScrolled(recyclerView, dx, dy);
|
|
|
+ tag_view.getLocationInWindow(locate);
|
|
|
+ Log.e("locate-----", locate[0]+","+locate[1]);
|
|
|
Log.e("dx-----", dx+","+dy);
|
|
|
if (dy > 0) {
|
|
|
//大于0表示正在向下滚动
|