Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propouse to refactoring #2

Open
eGorets opened this issue Sep 17, 2014 · 2 comments
Open

propouse to refactoring #2

eGorets opened this issue Sep 17, 2014 · 2 comments

Comments

@eGorets
Copy link

eGorets commented Sep 17, 2014

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

@JoeDailey
Copy link
Owner

make a pull request.

@eGorets
Copy link
Author

eGorets commented Sep 18, 2014

ok, i will do some refactoring i push it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants