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);
}
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);
}
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();
}
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);
}
}
});
}
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);
}
Aggregations