Search in sources :

Example 46 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project BaseRecyclerViewAdapterHelper by CymChad.

the class ItemClickActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_universal_recycler);
    setBackBtn();
    setTitle("ItemClickActivity Activity");
    mRecyclerView = findViewById(R.id.rv);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    initAdapter();
    adapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
            Tips.show("onItemClick " + position);
        }
    });
    adapter.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            Tips.show("onItemLongClick " + position);
            return true;
        }
    });
    adapter.setOnItemChildClickListener(new OnItemChildClickListener() {

        @Override
        public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            Tips.show("onItemChildClick " + position);
        }
    });
    adapter.setOnItemChildLongClickListener(new OnItemChildLongClickListener() {

        @Override
        public boolean onItemChildLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            Tips.show("onItemChildLongClick " + position);
            return true;
        }
    });
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) OnItemChildLongClickListener(com.chad.library.adapter.base.listener.OnItemChildLongClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) OnItemLongClickListener(com.chad.library.adapter.base.listener.OnItemLongClickListener)

Example 47 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project VerticalCalendar by mzyq.

the class CalendarView method initRecyclerView.

/**
 * 初始化RecyclerView
 */
private void initRecyclerView() {
    recyclerView.setLayoutManager(new MLinearLayoutManager(getContext()));
    calendarAdapter = new CalendarAdapter(getContext(), R.layout.item_month, monthList);
    recyclerView.setAdapter(calendarAdapter);
    recyclerView.addOnItemTouchListener(new OnItemChildClickListener() {

        @Override
        public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            if (view.getId() == R.id.rvMonth) {
                rvPosition = position;
            }
        }
    });
    calendarAdapter.setListener(new CalendarAdapter.OnItemChildClickListener() {

        @Override
        public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            if (rvPosition > -1) {
                handleClick(rvPosition, position);
                // 刷新adapter
                calendarAdapter.notifyDataSetChanged();
                rvPosition = -1;
            }
        }
    });
}
Also used : CalendarAdapter(com.muzi.library.adapter.CalendarAdapter) MLinearLayoutManager(com.muzi.library.manager.MLinearLayoutManager) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 48 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter 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

BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)48 View (android.view.View)46 RecyclerView (android.support.v7.widget.RecyclerView)38 BindView (butterknife.BindView)27 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)26 OnItemClickListener (com.chad.library.adapter.base.listener.OnItemClickListener)15 Intent (android.content.Intent)12 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)8 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)6 ImageView (android.widget.ImageView)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 OnItemChildClickListener (com.chad.library.adapter.base.listener.OnItemChildClickListener)6 OnLoadViewListener (com.helper.loadviewhelper.help.OnLoadViewListener)6 LoadViewHelper (com.helper.loadviewhelper.load.LoadViewHelper)6 ArrayList (java.util.ArrayList)6 TextView (android.widget.TextView)4 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)3 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)3 BaseViewHolder (com.chad.library.adapter.base.BaseViewHolder)3 DialogInterface (android.content.DialogInterface)2