本文整理汇总了Java中com.chad.library.adapter.base.BaseQuickAdapter类的典型用法代码示例。如果您正苦于以下问题:Java BaseQuickAdapter类的具体用法?Java BaseQuickAdapter怎么用?Java BaseQuickAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseQuickAdapter类属于com.chad.library.adapter.base包,在下文中一共展示了BaseQuickAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
final ListBean bean = (ListBean) adapter.getData().get(position);
int id = bean.getId();
switch (id) {
case 1:
delegate.getParentDelegate().getSupportDelegate().start(bean.getDelegate());
break;
case 2:
delegate.getParentDelegate().getSupportDelegate().start(bean.getDelegate());
break;
default:
break;
}
}
示例2: onCreate
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multiple_item_use);
setTitle("MultipleItem Use");
setBackBtn();
mRecyclerView = (RecyclerView) findViewById(R.id.rv_list);
final List<MultipleItem> data = DataServer.getMultipleItemData();
final MultipleItemQuickAdapter multipleItemAdapter = new MultipleItemQuickAdapter(this, data);
final GridLayoutManager manager = new GridLayoutManager(this, 4);
mRecyclerView.setLayoutManager(manager);
multipleItemAdapter.setSpanSizeLookup(new BaseQuickAdapter.SpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
return data.get(position).getSpanSize();
}
});
mRecyclerView.setAdapter(multipleItemAdapter);
}
示例3: initAdapter
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
private void initAdapter() {
switch (mType) {
case TYPE_HOT:
mAdapter = new OverseaMovieHotListAdapter();
break;
case TYPE_COMING:
mAdapter = new OverseaMovieComingListAdapter();
break;
}
mRvBaseRecyclerView.setAdapter(mAdapter);
mRvBaseRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRvBaseRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
getData();
}
}, mRvBaseRecyclerView);
getData();
}
示例4: initView
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void initView() {
mAdapter = new MovieTopAdapter(subjectsList);
easyLoadMoreView = new EasyLoadMoreView();
mAdapter.setLoadMoreView(easyLoadMoreView);
mAdapter.setOnLoadMoreListener(this, rcvActivity);
mAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
rcvActivity.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
rcvActivity.setAdapter(mAdapter);
((MovieTopAdapter) mAdapter).setOnItemClickListener(new MovieTopAdapter.OnItemClickListener() {
@Override
public void onItemClickListener(HotMovieBean.SubjectsBean positionData, View view) {
startZhiHuDetailActivity(positionData, view);
}
});
}
示例5: onItemClicked
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void onItemClicked(BaseQuickAdapter<TitleEntity, BaseViewHolder> adapter, View view, int position) {
super.onItemClicked(adapter, view, position);
TitleEntity entity = adapter.getItem(position);
if (entity.colorRes != 0) {
isWhite = entity.colorRes == android.R.color.white;
titleBar.setBgResource(entity.colorRes)
.setLeftTextDrawable(isWhite ? R.drawable.ic_arrow_left : R.drawable.ic_arrow_back_white)
.setRightTextDrawable(isWhite ? R.drawable.ic_menu : R.drawable.ic_menu_white)
.setTitleMainTextColor(isWhite ? getResources().getColor(R.color.colorTextBlack) : Color.WHITE)
.setTitleSubTextColor(isWhite ? getResources().getColor(R.color.colorTextBlack) : Color.WHITE);
if (type > 0 && isImmersible) {
if (isWhite) {
StatusBarUtil.setStatusBarLightMode(mContext);
} else {
StatusBarUtil.setStatusBarDarkMode(mContext);
}
}
} else if (entity.activity != null) {
startActivity(entity.activity);
}
}
示例6: initData
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
public void initData() {
mUserList.add(new User("潘恩依", ImgUrls.getAImgUrl(), 23, "王生安王生安王生安王生安王生安王生安王生安王生安"));
mUserList.add(new User("王施峪", ImgUrls.getAImgUrl(), 53, "夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜夏劲釜"));
mUserList.add(new User("郭磊留", ImgUrls.getAImgUrl(), 32, "汤丞昱"));
mUserList.add(new User("柯纤翊", ImgUrls.getAImgUrl(), 76, "欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界欧贡界"));
mUserList.add(new User("张昧谡", ImgUrls.getAImgUrl(), 12, "梁夜翊梁夜翊梁夜翊梁夜翊梁夜翊"));
tpgSuccess();
rvUser.setLayoutManager(new LinearLayoutManager(mActivity));
rvUser.setAdapter(new BaseQuickAdapter<User, BaseViewHolder>(R.layout.item_user_rv, mUserList) {
@Override
protected void convert(BaseViewHolder helper, User item) {
Glide.with(mContext).load(item.avatar).into((ImageView) helper.getView(R.id.iv_avatar));
helper.setText(R.id.tv_name, item.name);
helper.setText(R.id.tv_introduction, item.introduction);
}
});
}
示例7: initAdapter
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
private void initAdapter() {
mMovieAdapter = new TopHundredMovieAdapter();
mRvBaseRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRvBaseRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
mRvBaseRecyclerView.setAdapter(mMovieAdapter);
View headerView = getLayoutInflater().inflate(R.layout.layout_fixboard_header, mRvBaseRecyclerView, false);
mTvContent = (TextView) headerView.findViewById(R.id.tv_content);
mTvCreate = (TextView) headerView.findViewById(R.id.tv_createDate);
mMovieAdapter.addHeaderView(headerView);
mMovieAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
getTopHundredMovie();
}
}, mRvBaseRecyclerView);
}
示例8: initAdapter
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
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);
homeAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
Intent intent = new Intent(HomeActivity.this, ACTIVITY[position]);
startActivity(intent);
}
});
mRecyclerView.setAdapter(homeAdapter);
}
示例9: initView
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void initView() {
mPresenter = new MovieCommentPresenterImpl(this, id);
mAdapter = new BaseQuickAdapter<MovieComment,BaseViewHolder>(R.layout.item_comment_list) {
@Override
protected void convert(BaseViewHolder helper, MovieComment item) {
ImageLoadUtil.displayCircle((ImageView) helper.getView(R.id.iv_author_icon),item.getAuthor().getAvatar());
helper.setText(R.id.tv_author_name,item.getAuthor().getName());
((RatingBar)helper.getView(R.id.rb_movie_rating)).setRating((float) item.getRating().getValue());
helper.setText(R.id.tv_useful_count, item.getUseful_count()+"");
helper.setText(R.id.tv_comment_content, item.getContent());
helper.setText(R.id.tv_comment_date, item.getCreated_at());
}
};
mAdapter.setEnableLoadMore(true);
mAdapter.setOnLoadMoreListener(this,mRvComments);
mAdapter.openLoadAnimation();
mRvComments.setLayoutManager(new LinearLayoutManager(getActivity()));
mRvComments.setAdapter(mAdapter);
}
示例10: initEvents
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void initEvents() {
mRefreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {
@Override
public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refreshLayout.finishRefreshing();
}
}, 2000);
}
});
mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (position < mHeaderList.size()) {
mRefreshLayout.setHeaderView(mHeaderList.get(position));
mRefreshLayout.startRefresh();
}
}
});
}
示例11: initData
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void initData() {
List<ItemModel> items = new ArrayList<>();
fillData(items);
adapter = new MainAdapter(items);
adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
adapter.isFirstOnly(false);
adapter.setOnLoadMoreListener(this);
refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
refreshLayout.setOnRefreshListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new DividerItemDecoration(context, LinearLayoutManager.VERTICAL));
recyclerView.setAdapter(adapter);
}
示例12: initData
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void initData() {
url = Urls.URL_GANK_BASE + fragmentTitle + "/" + PAGE_SIZE + "/";
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setLayoutManager(new LinearLayoutManager(context));
newsAdapter = new NewsAdapter(null);
newsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
newsAdapter.isFirstOnly(false);
recyclerView.setAdapter(newsAdapter);
refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
refreshLayout.setOnRefreshListener(this);
newsAdapter.setOnLoadMoreListener(this);
//开启loading,获取数据
setRefreshing(true);
onRefresh();
}
示例13: onCreateView
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup,
Bundle savedInstanceState) {
RecyclerView recyclerView = new RecyclerView(getActivity());
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
mAdapter.bindToRecyclerView(recyclerView);
mAdapter.setEmptyView(R.layout.layout_empty);
recyclerView.addOnItemTouchListener(new OnItemClickListener() {
@Override
public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
MultiItemEntity entity = mAdapter.getItem(position);
switch (entity.getItemType()) {
case RuleItem.TYPE_RULE :
RuleItem item = (RuleItem) entity;
RuleDetailFragment.newInstance(item)
.show(getChildFragmentManager(), "Detail");
break;
}
}
});
return recyclerView;
}
示例14: onItemClicked
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected void onItemClicked(BaseQuickAdapter<TitleEntity, BaseViewHolder> adapter, View view, int position) {
super.onItemClicked(adapter, view, position);
TitleEntity entity = adapter.getItem(position);
if (entity.colorRes != 0) {
isWhite = entity.colorRes == android.R.color.white;
titleBar.setBackgroundResource(entity.colorRes);
titleBar.setLeftTextDrawable(isWhite ? R.drawable.ic_arrow_left : R.drawable.ic_arrow_back_white);
titleBar.setRightTextDrawable(isWhite ? R.drawable.ic_menu : R.drawable.ic_menu_white);
titleBar.setTitleMainTextColor(isWhite ? getResources().getColor(R.color.colorTextBlack) : Color.WHITE);
titleBar.setTitleSubTextColor(isWhite ? getResources().getColor(R.color.colorTextBlack) : Color.WHITE);
if (type > 0 && isImmersible) {
if (isWhite) {
StatusBarUtil.setStatusBarLightMode(mContext);
} else {
StatusBarUtil.setStatusBarDarkMode(mContext);
}
}
} else if (entity.activity != null) {
startActivity(entity.activity);
}
}
示例15: createAdapter
import com.chad.library.adapter.base.BaseQuickAdapter; //导入依赖的package包/类
@Override
protected BaseQuickAdapter createAdapter(List<BookTb> data) {
mAdapter = new BookcaseAdapter(data);
mAdapter.setOnItemChildLongClickListener(new BaseQuickAdapter.OnItemChildLongClickListener() {
@Override
public boolean onItemChildLongClick(BaseQuickAdapter adapter, View view, final int position) {
BookcaseAdapter bookcaseAdapter = (BookcaseAdapter) adapter;
view.postDelayed(new Runnable() {
@Override
public void run() {
getView().startDrag(position);
}
}, 200);
if (bookcaseAdapter.startEdit()) {
getView().showEditMode();
bookcaseAdapter.selectedItem(position);
}
return true;
}
});
return mAdapter;
}