Android-Simple-Pull-to-Refresh
Android-Simple-Pull-to-Refresh copied to clipboard
propouse to refactoring
I think better way to call LoadMore method is
private boolean loadingMore = false; private boolean loadingAfterStop = false;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if(firstVisibleItem == 0)
HittingTop = true;
else{
HittingTop = false;
startY = 100000.0;
if(!refreshing){
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) progress.getLayoutParams();
params.weight = 2;
progress.setLayoutParams(params);
}
}
if(!loadingMore)
if(this.getAdapter()!=null)
if(!this.getAdapter().isEmpty())
if(totalItemCount - (firstVisibleItem+visibleItemCount) <= itemsFromBottom) {
loadingAfterStop = true;
} else loadingAfterStop = false;
/*if(ListrefreshLister!=null) {
ListLoadMoreListener.LoadMore(RefreshableListView.this);
Log.i("test", " totalItemCount - (firstVisibleItem+visibleItemCount) <= itemsFromBottom " +
totalItemCount + " " +
firstVisibleItem + " " +visibleItemCount + " " + itemsFromBottom);
}*/
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == SCROLL_STATE_IDLE && loadingAfterStop) {
if(ListrefreshLister!=null) {
ListLoadMoreListener.LoadMore(RefreshableListView.this);
}
}
}
when we scroll list, its call onScroll all time and method in LoadMore too
make a pull request.
ok, i will do some refactoring i push it