本文整理汇总了Java中com.jude.easyrecyclerview.decoration.DividerDecoration类的典型用法代码示例。如果您正苦于以下问题:Java DividerDecoration类的具体用法?Java DividerDecoration怎么用?Java DividerDecoration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DividerDecoration类属于com.jude.easyrecyclerview.decoration包,在下文中一共展示了DividerDecoration类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViews
import com.jude.easyrecyclerview.decoration.DividerDecoration; //导入依赖的package包/类
@Override
protected void initViews() {
mTrendAdapter = new TrendAdapter(getActivity());
mTrendAdapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
TrendsRes.Trends trend = mTrendAdapter.getAllData().get(position);
Bundle bundle = new Bundle();
bundle.putString(TrendStatusesActivity.BUNDLE_SEARCH_KEYWORD, trend.getName());
Router.build(Constants.Router.TREND_STATUSES).extras(bundle).go(getActivity());
}
});
DividerDecoration itemDecoration =
new DividerDecoration(getResources().getColor(R.color.divider_line_color),
Math.round(getResources().getDimension(R.dimen.divider_line_size)), 0, 0);
itemDecoration.setDrawLastItem(true);
itemDecoration.setDrawHeaderFooter(false);
mRecyclerView.addItemDecoration(itemDecoration);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.setAdapterWithProgress(mTrendAdapter);
mRecyclerView.setRefreshListener(this);
mRecyclerView.setRefreshingColor(getResources().getIntArray(R.array.refreshing_color));
}
示例2: initView
import com.jude.easyrecyclerview.decoration.DividerDecoration; //导入依赖的package包/类
private void initView() {
setRefreshingColor(
ContextCompat.getColor(getContext(), R.color.colorPrimary),
ContextCompat.getColor(getContext(), android.R.color.holo_blue_light),
ContextCompat.getColor(getContext(), android.R.color.holo_green_light)
);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
setLayoutManager(layoutManager);
DividerDecoration dividerDecoration = new DividerDecoration(getResources().getColor(R.color.gray_e0), 20, 20, 0);
dividerDecoration.setDrawLastItem(true);
addItemDecoration(dividerDecoration);
mAdapter = new NewsListAdapter(getContext());
mAdapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
}
});
setAdapterWithProgress(mAdapter);
setRefreshListener(this);
new NewsListPresenter(this);
isActive = true;
}
示例3: initViews
import com.jude.easyrecyclerview.decoration.DividerDecoration; //导入依赖的package包/类
@Override
protected void initViews() {
if (TYPE_GET_FOLLOWER.equals(mType)) {
mToolbar.setTitle(getString(R.string.title_follower));
getFollowers();
} else {
mToolbar.setTitle(getString(R.string.title_following));
getFriends();
}
mToolbar.setElevation(getResources().getDimension(R.dimen.elevation));
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mFollowingAdapter = new FollowingAdapter(this);
mFollowingAdapter.setMore(R.layout.view_load_more,
new RecyclerArrayAdapter.OnMoreListener() {
@Override
public void onMoreShow() {
getFriends();
}
@Override
public void onMoreClick() {
}
});
mFollowingAdapter.setError(R.layout.view_load_more_error,
new RecyclerArrayAdapter.OnErrorListener() {
@Override
public void onErrorShow() {
}
@Override
public void onErrorClick() {
mFollowingAdapter.resumeMore();
}
});
mFollowingAdapter.setNoMore(R.layout.view_no_more);
mFollowingAdapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
UserRes userRes = mFollowingAdapter.getItem(position);
if (TYPE_GET_AT_FOLLOWING.equals(mType)) {
Intent intent = new Intent();
intent.putExtra(EXTRAS_USER_NAME, userRes.getName());
setResult(RESULT_OK, intent);
} else {
Bundle bundle = new Bundle();
bundle.putParcelable(ProfileActivity.BUNDLE_USER, userRes);
Router.build(Constants.Router.PROFILE).extras(bundle).go(UserListActivity.this);
}
finish();
}
});
DividerDecoration itemDecoration =
new DividerDecoration(getResources().getColor(R.color.divider_line_color),
Math.round(getResources().getDimension(R.dimen.divider_line_size)),
Math.round(getResources().getDimension(R.dimen.margin_huge)), 0);
itemDecoration.setDrawLastItem(true);
itemDecoration.setDrawHeaderFooter(false);
mRecyclerView.addItemDecoration(itemDecoration);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapterWithProgress(mFollowingAdapter);
}