Search in sources :

Example 6 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder 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)

Example 7 with TitleBuilder

use of com.rideread.rideread.common.util.TitleBuilder in project ride-read-android by Ride-Read.

the class CollectActivity method initView.

@Override
public void initView() {
    new TitleBuilder(this).setTitleText("ζˆ‘ηš„ζ”Άθ—").IsBack(true).setLeftOnClickListener(v -> finish()).build();
    mCollectList = new ArrayList<>();
    mSwipeRefreshLayout.setOnRefreshListener(() -> {
        mPages = 0;
        loadCollects();
    });
    mRecycleView.setHasFixedSize(true);
    mAdapter = new CollectAdapter(this, mCollectList);
    mRecycleView.setAdapter(mAdapter);
    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) {
                    loadCollects();
                }
            }
        }
    });
    loadCollects();
}
Also used : CollectAdapter(com.rideread.rideread.common.adapter.CollectAdapter) ListUtils(com.rideread.rideread.common.util.ListUtils) BaseCallback(com.rideread.rideread.function.net.retrofit.BaseCallback) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) R(com.rideread.rideread.R) BaseActivity(com.rideread.rideread.common.base.BaseActivity) NetworkUtils(com.rideread.rideread.common.util.NetworkUtils) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) CollectInfo(com.rideread.rideread.data.result.CollectInfo) List(java.util.List) ToastUtils(com.rideread.rideread.common.util.ToastUtils) BaseModel(com.rideread.rideread.function.net.retrofit.BaseModel) ApiUtils(com.rideread.rideread.function.net.retrofit.ApiUtils) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) TitleBuilder(com.rideread.rideread.common.util.TitleBuilder) CollectAdapter(com.rideread.rideread.common.adapter.CollectAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

TitleBuilder (com.rideread.rideread.common.util.TitleBuilder)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 RecyclerView (android.support.v7.widget.RecyclerView)5 BindView (butterknife.BindView)5 R (com.rideread.rideread.R)5 BaseActivity (com.rideread.rideread.common.base.BaseActivity)5 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)4 List (java.util.List)4 View (android.view.View)3 OnClick (butterknife.OnClick)3 UserUtils (com.rideread.rideread.common.util.UserUtils)3 ApiUtils (com.rideread.rideread.function.net.retrofit.ApiUtils)3 BaseCallback (com.rideread.rideread.function.net.retrofit.BaseCallback)3 BaseModel (com.rideread.rideread.function.net.retrofit.BaseModel)3 ArrayList (java.util.ArrayList)3 TextUtils (android.text.TextUtils)2 TextView (android.widget.TextView)2 ConfirmDialogFragment (com.rideread.rideread.common.dialog.ConfirmDialogFragment)2 MsgUtils (com.rideread.rideread.common.util.MsgUtils)2 DefJsonResult (com.rideread.rideread.data.result.DefJsonResult)2