Search in sources :

Example 16 with BaseQuickAdapter

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

the class SectionQuickUseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_section_uer);
    setBackBtn();
    setTitle("Quick Section Use");
    mRecyclerView = findViewById(R.id.rv_list);
    mRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
    mRecyclerView.addItemDecoration(new GridSectionAverageGapItemDecoration(10, 10, 20, 15));
    mData = DataServer.getSectionData();
    SectionQuickAdapter adapter = new SectionQuickAdapter(R.layout.item_section_content, R.layout.def_section_head, mData);
    adapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            MySection mySection = mData.get(position);
            if (mySection.isHeader()) {
                Tips.show((String) mySection.getObject());
            } else {
                Video video = (Video) mySection.getObject();
                Tips.show(video.getName());
            }
        }
    });
    adapter.setOnItemChildClickListener(new OnItemChildClickListener() {

        @Override
        public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            Tips.show("onItemChildClick: " + position);
        }
    });
    mRecyclerView.setAdapter(adapter);
}
Also used : MySection(com.chad.baserecyclerviewadapterhelper.entity.MySection) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) Video(com.chad.baserecyclerviewadapterhelper.entity.Video) GridSectionAverageGapItemDecoration(com.chad.baserecyclerviewadapterhelper.decoration.GridSectionAverageGapItemDecoration) SectionQuickAdapter(com.chad.baserecyclerviewadapterhelper.adapter.SectionQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 17 with BaseQuickAdapter

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

the class AnimationUseActivity method initAdapter.

private void initAdapter() {
    mAnimationAdapter = new AnimationAdapter();
    mAnimationAdapter.setAnimationEnable(true);
    int mFirstPageItemCount = 3;
    // mAnimationAdapter.setNotDoAnimationCount(mFirstPageItemCount);
    mAnimationAdapter.addChildClickViewIds(R.id.img, R.id.tweetName, R.id.tweetText);
    mAnimationAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {

        @Override
        public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
            String content = null;
            Status status = (Status) adapter.getItem(position);
            switch(view.getId()) {
                case R.id.img:
                    content = "img:" + status.getUserAvatar();
                    break;
                case R.id.tweetName:
                    content = "name:" + status.getUserName();
                    break;
                case R.id.tweetText:
                    content = "tweetText:" + status.getUserName();
                    break;
                default:
                    break;
            }
            Tips.show(content);
        }
    });
    mRecyclerView.setAdapter(mAnimationAdapter);
}
Also used : Status(com.chad.baserecyclerviewadapterhelper.entity.Status) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) AnimationAdapter(com.chad.baserecyclerviewadapterhelper.adapter.AnimationAdapter)

Example 18 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project SmartCampus by Vegen.

the class RecruitAndEmploymentMessageActivity method setupUI.

@Override
protected void setupUI() {
    type = getIntent().getIntExtra("type", Constant.MESSAGE_RECRUIT);
    if (type == Constant.MESSAGE_RECRUIT) {
        setTitle("招生信息");
    } else {
        setTitle("就业信息");
    }
    refreshLayout.setEnabled(false);
    recruitMessageAdapter = new RecruitMessageAdapter();
    // recruitMessageAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(recruitMessageAdapter);
    recyclerView.addItemDecoration(new ListItemDecoration(10, 0, 0));
    View emptyView = View.inflate(this, R.layout.app_view_empty, null);
    recruitMessageAdapter.setEmptyView(emptyView);
    recruitMessageAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            LogUtils.e(tag, "url:" + recruitAndEmploymentList.get(position).getUrl());
            if (type == Constant.MESSAGE_RECRUIT) {
                // 打开网页端
                TopFunArticleDetailActivity.start(RecruitAndEmploymentMessageActivity.this, recruitAndEmploymentList.get(position).getTitle(), recruitAndEmploymentList.get(position).getUrl());
            } else {
                // 跳转到招聘列表
                EmploymentListActivity.start(RecruitAndEmploymentMessageActivity.this, recruitAndEmploymentList.get(position).getTitle(), recruitAndEmploymentList.get(position).getUrl(), position);
            }
        }
    });
    final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_animation_slide_right);
    recyclerView.setLayoutAnimation(controller);
    recyclerView.scheduleLayoutAnimation();
}
Also used : ListItemDecoration(com.itculturalfestival.smartcampus.utils.ItemDecoration.ListItemDecoration) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) RecruitMessageAdapter(com.itculturalfestival.smartcampus.adapter.RecruitMessageAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 19 with BaseQuickAdapter

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

the class CalendarAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, MonthBean item) {
    helper.setText(R.id.textMonth, item.getYear() + "年" + item.getMonth() + "月");
    recyclerView = helper.getView(R.id.rvMonth);
    recyclerView.setLayoutManager(new MGridLayoutManager(context, 7));
    adapter = new MonthAdapter(context, R.layout.item_day, item.getDayList());
    adapter.setSpanSizeLookup(new SpanSizeLookup() {

        @Override
        public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
            return 1;
        }
    });
    recyclerView.setAdapter(adapter);
    helper.addOnClickListener(R.id.rvMonth);
    recyclerView.addOnItemTouchListener(new com.chad.library.adapter.base.listener.OnItemChildClickListener() {

        @Override
        public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            if (listener != null) {
                listener.onItemChildClick(adapter, view, position);
            }
        }
    });
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) MGridLayoutManager(com.muzi.library.manager.MGridLayoutManager) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) MGridLayoutManager(com.muzi.library.manager.MGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 20 with BaseQuickAdapter

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

the class HomeActivity method initAdapter.

private void initAdapter() {
    BaseQuickAdapter homeAdapter = new HomeAdapter(R.layout.home_item_view, mDataList);
    homeAdapter.openLoadAnimation();
    View top = getLayoutInflater().inflate(R.layout.top_view, (ViewGroup) mRecyclerView.getParent(), false);
    homeAdapter.addHeaderView(top);
    mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {

        @Override
        public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
            Intent intent = new Intent(HomeActivity.this, ACTIVITY[position]);
            startActivity(intent);
        }
    });
    mRecyclerView.setAdapter(homeAdapter);
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) HomeAdapter(com.chad.baserecyclerviewadapterhelper.adapter.HomeAdapter) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)49 View (android.view.View)47 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 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)6 ImageView (android.widget.ImageView)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