Search in sources :

Example 6 with RecyclerViewItemDecoration

use of com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration in project BBS-Android by bdpqchen.

the class LatestPostFragment method initFragment.

@Override
protected void initFragment() {
    latestPostAdapter = new LatestPostAdapter(getActivity());
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    recyclerview.setLayoutManager(linearLayoutManager);
    mPresenter.refreshAnnounce();
    recyclerview.setAdapter(latestPostAdapter);
    recyclerview.addItemDecoration(new RecyclerViewItemDecoration(5));
    layoutSwipeRefresh.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
    layoutSwipeRefresh.setOnRefreshListener(() -> {
        mPresenter.refreshAnnounce();
        layoutSwipeRefresh.setRefreshing(false);
    });
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerViewItemDecoration(com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration)

Example 7 with RecyclerViewItemDecoration

use of com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration in project BBS-Android by bdpqchen.

the class MessageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSlideBackLayout.lock(!PrefUtil.isSlideBackMode());
    mAdapter = new MessageAdapter(this);
    rvMessageList.setAdapter(mAdapter);
    rvMessageList.setLayoutManager(new LinearLayoutManager(this));
    rvMessageList.addItemDecoration(new RecyclerViewItemDecoration(10));
    mPresenter.getMessageList(0);
    setRefreshing(true);
    mSrlMessage.setOnRefreshListener(() -> {
        mPresenter.getMessageList(0);
        mRefreshing = true;
    });
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerViewItemDecoration(com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration)

Example 8 with RecyclerViewItemDecoration

use of com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration in project BBS-Android by bdpqchen.

the class BoardsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    mForumId = getIntent().getIntExtra(INTENT_FORUM_ID, 0);
    mForumTitle = getIntent().getStringExtra(INTENT_FORUM_TITLE);
    super.onCreate(savedInstanceState);
    mContext = this;
    mAdapter = new BoardsAdapter(mContext);
    mLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
    mRvBoardList.addItemDecoration(new RecyclerViewItemDecoration(16));
    mRvBoardList.setLayoutManager(mLayoutManager);
    mRvBoardList.setAdapter(mAdapter);
    mSrlBoardList.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
    mSrlBoardList.setOnRefreshListener(() -> {
        mRefreshing = true;
        mPresenter.getBoardList(mForumId);
    });
    mFab.setOnClickListener(v -> {
        Intent intent = new Intent(this, CreateThreadActivity.class);
        intent.putStringArrayListExtra(INTENT_BOARD_NAMES, getBoardNames());
        intent.putIntegerArrayListExtra(INTENT_BOARD_IDS, getBoardIds());
        startActivity(intent);
    });
    mBoardIds.add(0);
    mBoardNames.add(".....");
    mPresenter.getBoardList(mForumId);
}
Also used : Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerViewItemDecoration(com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration)

Example 9 with RecyclerViewItemDecoration

use of com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration in project BBS-Android by bdpqchen.

the class MyReleaseFragment method initFragment.

@Override
protected void initFragment() {
    myRecyclerAdapter = new MyRecyclerAdapter(getActivity(), data);
    layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    rv.setHasFixedSize(true);
    rv.setLayoutManager(layoutManager);
    rv.setAdapter(myRecyclerAdapter);
    srl.setOnRefreshListener(this);
    srl.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors));
    eros = new EndlessRecyclerOnScrollListener(layoutManager) {

        @Override
        public void onLoadMore() {
            mPresenter.getMyReleaseList();
        }
    };
    rv.addOnScrollListener(eros);
    mPresenter.initMyReleaseList();
    rv.addItemDecoration(new RecyclerViewItemDecoration(5));
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerViewItemDecoration(com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 RecyclerViewItemDecoration (com.twtstudio.bbs.bdpqchen.bbs.commons.helper.RecyclerViewItemDecoration)9 Intent (android.content.Intent)3 RecyclerView (android.support.v7.widget.RecyclerView)2 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 EndlessRecyclerOnScrollListener (com.twtstudio.bbs.bdpqchen.bbs.individual.my_release.EndlessRecyclerOnScrollListener)1