Search in sources :

Example 1 with RecyclerViewDecoration

use of com.qyh.myblog_android.widget.RecyclerViewDecoration in project Qblog_Android by qiaoyhh.

the class MyBlogActivity method initView.

@Override
protected void initView() {
    setToolBar(toolBar, "我的博客");
    mAdapter = new BlogContentAdapter(R.layout.item_blogcontent_view, null);
    mLayoutManger = new LinearLayoutManager(mContext);
    viewMain.setLayoutManager(mLayoutManger);
    viewMain.setHasFixedSize(true);
    viewMain.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
    viewMain.setAdapter(mAdapter);
    mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            Intent intent = new Intent(mContext, BlogDetailActivity.class);
            intent.putExtra(Constants.BLOGCONTENT_TYPE, mData.get(position));
            startActivity(intent);
        }
    });
}
Also used : BlogDetailActivity(com.qyh.myblog_android.ui.activity.blog.BlogDetailActivity) RecyclerViewDecoration(com.qyh.myblog_android.widget.RecyclerViewDecoration) BlogContentAdapter(com.qyh.myblog_android.ui.adapter.BlogContentAdapter) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 2 with RecyclerViewDecoration

use of com.qyh.myblog_android.widget.RecyclerViewDecoration in project Qblog_Android by qiaoyhh.

the class VideoContentFragment method initView.

@Override
protected void initView() {
    mAdapter = new VideoContentAdapter(R.layout.item_videocontent_view, null);
    mLayoutManger = new LinearLayoutManager(mContext);
    viewMain.setLayoutManager(mLayoutManger);
    viewMain.setHasFixedSize(true);
    viewMain.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
    viewMain.setAdapter(mAdapter);
    swipeRefresh.setColorSchemeColors(getResources().getColor(R.color.blue_light), getResources().getColor(R.color.green_light), getResources().getColor(R.color.orange_light), getResources().getColor(R.color.red_light));
    swipeRefresh.setOnRefreshListener(this);
    mAdapter.setEnableLoadMore(false);
    mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            page++;
            getVideoList(page, Constants.TYPE_LOADMORE);
        }
    });
}
Also used : RecyclerViewDecoration(com.qyh.myblog_android.widget.RecyclerViewDecoration) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) VideoContentAdapter(com.qyh.myblog_android.ui.adapter.VideoContentAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 3 with RecyclerViewDecoration

use of com.qyh.myblog_android.widget.RecyclerViewDecoration in project Qblog_Android by qiaoyhh.

the class BlogContentFragment method initView.

@Override
protected void initView() {
    if (getArguments() != null) {
        blogType = getArguments().getInt(Constants.BLOG_TYPE);
    }
    mAdapter = new BlogContentAdapter(R.layout.item_blogcontent_view, null);
    mLayoutManger = new LinearLayoutManager(mContext);
    viewMain.setLayoutManager(mLayoutManger);
    viewMain.setHasFixedSize(true);
    viewMain.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
    viewMain.setAdapter(mAdapter);
    refreshLayout.setColorSchemeColors(getResources().getColor(R.color.blue_light), getResources().getColor(R.color.green_light), getResources().getColor(R.color.orange_light), getResources().getColor(R.color.red_light));
    refreshLayout.setOnRefreshListener(this);
    mAdapter.setEnableLoadMore(false);
    mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            page++;
            getBlogListData(page, Constants.TYPE_LOADMORE);
        }
    });
    mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            Intent intent = new Intent(mContext, BlogDetailActivity.class);
            intent.putExtra(Constants.BLOGCONTENT_TYPE, mData.get(position));
            startActivity(intent);
        }
    });
}
Also used : BlogDetailActivity(com.qyh.myblog_android.ui.activity.blog.BlogDetailActivity) RecyclerViewDecoration(com.qyh.myblog_android.widget.RecyclerViewDecoration) BlogContentAdapter(com.qyh.myblog_android.ui.adapter.BlogContentAdapter) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)3 RecyclerViewDecoration (com.qyh.myblog_android.widget.RecyclerViewDecoration)3 Intent (android.content.Intent)2 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 BindView (butterknife.BindView)2 BlogDetailActivity (com.qyh.myblog_android.ui.activity.blog.BlogDetailActivity)2 BlogContentAdapter (com.qyh.myblog_android.ui.adapter.BlogContentAdapter)2 VideoContentAdapter (com.qyh.myblog_android.ui.adapter.VideoContentAdapter)1