项目:Jockey
文件:QueueFragment.java
private void setupRecyclerView() {
Drawable shadow = ContextCompat.getDrawable(getContext(),R.drawable.list_drag_shadow);
Itemdecoration background = new DragBackgrounddecoration(R.id.song_drag_root);
Itemdecoration divider = new DragDividerdecoration(getContext(),true,R.id.instance_blank);
Itemdecoration dragShadow = new DragDropdecoration((NinePatchDrawable) shadow);
mRecyclerView.addItemdecoration(background);
mRecyclerView.addItemdecoration(divider);
mRecyclerView.addItemdecoration(dragShadow);
mRecyclerView.setLayoutManager(new linearlayoutmanager(getContext()));
boolean portrait = getResources().getConfiguration().orientation != ORIENTATION_LANDSCAPE;
boolean tablet = getResources().getConfiguration().smallestScreenWidthDp >= 600;
if (portrait || !tablet) {
// Add an inner shadow at the top of the list
mRecyclerView.addItemdecoration(new Insetdecoration(
ContextCompat.getDrawable(getContext(),R.drawable.inset_top_shadow),(int) getResources().getDimension(R.dimen.inset_top_shadow_height),Gravity.TOP));
} else {
// Add an inner shadow at the bottom of the list
mRecyclerView.addItemdecoration(new Insetdecoration(
ContextCompat.getDrawable(getContext(),R.drawable.inset_bottom_shadow),getResources().getDimensionPixelSize(R.dimen.inset_bottom_shadow_height),Gravity.BottOM));
}
}
@Bindable
public Itemdecoration[] getItemdecorations() {
NinePatchDrawable dragShadow = (NinePatchDrawable) ContextCompat.getDrawable(
getContext(),R.drawable.list_drag_shadow);
return new Itemdecoration[] {
new DragBackgrounddecoration(R.id.song_drag_root),new DragDividerdecoration(R.id.song_drag_root,getContext(),R.id.empty_layout),new DragDropdecoration(dragShadow)
};
}
@Bindable
public Itemdecoration[] getItemdecorations() {
return new Itemdecoration[] {
new Backgrounddecoration(R.id.loading_frame,R.id.artist_bio_card,R.id.relatedCard),new Dividerdecoration(getContext(),R.id.album_view,R.id.subheader_frame,R.id.relatedCard,new GridSpacingdecoration(
(int) getResources().getDimension(R.dimen.grid_margin),mAlbumColumnCount,mAlbumSection.getTypeId()),new GridSpacingdecoration(
(int) getResources().getDimension(R.dimen.card_margin),mRelatedColumnCount,mRelatedArtistSection.getTypeId())
};
}
@Bindable
public Itemdecoration[] getItemdecorations() {
return new Itemdecoration[] {
new Backgrounddecoration(),R.id.empty_layout)
};
}
项目:Jockey
文件:RecyclerViewBindingAdapters.java
@BindingAdapter("itemdecorations")
public static void setItemdecorations(RecyclerView recyclerView,Itemdecoration... decor) {
for (Itemdecoration decoration : decor) {
recyclerView.addItemdecoration(decoration);
}
}
项目:FloodInfo
文件:BaseListActivity.java
/**
* Implement this with the Itemdecoration of your choice.
*
* if you don't want decoration,@return null
* else @return Itemdecoration
*/
protected abstract Itemdecoration getItemdecoration();
项目:FloodInfo
文件:NewsActivity.java
/**
* Implement this with the Itemdecoration of your choice.
*
* if you don't want decoration,@return null
* else @return Itemdecoration
*/
@Override protected Itemdecoration getItemdecoration() {
return new Dividerdecoration(this,Dividerdecoration.VERTICAL_LIST);
}
项目:FloodInfo
文件:ContactsActivity.java
/**
* Implement this with the Itemdecoration of your choice.
*
* if you don't want decoration,Dividerdecoration.VERTICAL_LIST);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。