@NonNull private DividerItemDecoration getDivider() { Drawable dividerBackground = ContextCompat.getDrawable(getActivity(), R.drawable.dark_blue_divider); Collection<Layer> layers = LayersBuilder.with( new Layer(DividerBuilder.from(dividerBackground).erase(Direction.getVertical()).build()), new Layer(new HeaderSelector(), DividerBuilder.fromEmpty().with(dividerBackground, Direction.SOUTH).build())).build(); return new DividerItemDecoration(layers); }
@NonNull private DividerItemDecoration getDivider() { Drawable dividerBackground = ContextCompat.getDrawable(getActivity(), R.drawable.dark_blue_divider); Collection<Layer> layers = LayersBuilder.with( new Layer(DividerBuilder.from(dividerBackground).erase(Direction.getVertical()).build()), new Layer(new HeaderSelector(), DividerBuilder.fromEmpty().with(dividerBackground, Direction.SOUTH).build())).build(); return new DividerItemDecoration(layers); }
/** * Adds the eraser drawable to all the directions provided for the divider. */ public DividerBuilder erase(EnumSet<Direction> directions) { return with(Divider.ERASER, directions); }
/** * Adds the eraser drawable to the specific direction. */ public DividerBuilder erase(Direction direction) { return with(Divider.ERASER, direction); }
/** * Adds the eraser drawable to all the sides of the divider. */ public DividerBuilder erase() { return with(Divider.ERASER); }
/** * Returns a new builder with the drawable applied to all the sides of the divider. */ public static DividerBuilder from(Drawable drawable) { DividerBuilder builder = new DividerBuilder(); builder.with(drawable); return builder; }
private RecyclerView.ItemDecoration getItemDecoration() { Drawable blackDrawable = getResources().getDrawable(R.drawable.black_divider); Drawable greyDrawable = getResources().getDrawable(R.drawable.grey_divider); Collection<Layer> layers = LayersBuilder.with( new Layer(new AllItemsSelector(), DividerBuilder.get().with(greyDrawable).build()), new Layer(new EvenCellRowSelector(), DividerBuilder.get().with(blackDrawable).build())) .build(); return new DividerItemDecoration(layers); } }
private List<Layer> getSingleCornerDrawableLayer(Drawable drawable) { List<Layer> layers = new ArrayList<>(); layers.add(new Layer(new AllItemsSelector(), DividerBuilder.get().with(drawable, Direction.NORTH_EAST).build())); return layers; }
private List<Layer> getSingleDrawableLayer(Drawable drawable) { List<Layer> layers = new ArrayList<>(); layers.add(new Layer(new AllItemsSelector(), DividerBuilder.get().with(drawable).build())); return layers; }