Search in sources :

Example 1 with ThumbsUpUserAdapter

use of com.rideread.rideread.common.adapter.ThumbsUpUserAdapter in project ride-read-android by Ride-Read.

the class ThumbsUpUserActivity method initView.

@Override
public void initView() {
    mMid = getIntent().getIntExtra(MOMENT_ID, 0);
    new TitleBuilder(this).setTitleText(R.string.thumbs_up_user).IsBack(true).setRightImage(R.drawable.icon_search).build();
    mUserList = new ArrayList<>();
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        mPages = 0;
        loadUsers();
    });
    mRecycleView.setHasFixedSize(true);
    mUserAdapter = new ThumbsUpUserAdapter(this, mUserList);
    mRecycleView.setAdapter(mUserAdapter);
    mLayoutManager = new LinearLayoutManager(this);
    mRecycleView.setLayoutManager(mLayoutManager);
    mRecycleView.setOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
        }

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            int lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
            int totalItemCount = mLayoutManager.getItemCount();
            if (lastVisibleItem >= totalItemCount - 1 && dy > 0) {
                if (!isLoadingMore) {
                    loadUsers();
                }
            }
        }
    });
    loadUsers();
}
Also used : TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) ThumbsUpUserAdapter(com.rideread.rideread.common.adapter.ThumbsUpUserAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 ThumbsUpUserAdapter (com.rideread.rideread.common.adapter.ThumbsUpUserAdapter)1 TitleBuilder (com.rideread.rideread.common.util.TitleBuilder)1