项目: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));
}
}
项目:Jockey
文件:PlaylistViewModel.java
@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)
};
}
项目:Jockey
文件:ArtistViewModel.java
@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())
};
}
项目:Jockey
文件:GenreViewModel.java
@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);
}