MCPcopy Index your code
hub / github.com/dgreenhalgh/simple-item-decoration

github.com/dgreenhalgh/simple-item-decoration @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
79 symbols 167 edges 16 files 26 documented · 33%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SimpleItemDecoration

Currently in active development

SimpleItemDecoration is a simple library for adding dividers and offsets to Android's RecyclerView using RecyclerView.ItemDecoration.

It can be used to add both interior dividers and start/end offsets to RecyclerViews using LinearLayoutManager or GridLayoutManager.

Usage

All of the ItemDecorations included can be added to your RecyclerView by calling RecyclerView#addItemDecoration(), passing in your desired ItemDecoration as a parameter.

DividerItemDecoration

DividerItemDecoration is used to add interior dividers to a RecyclerView using a LinearLayoutManager.

Its constructor takes in your preferred divider as a Drawable.

Drawable dividerDrawable = ContextCompat.getDrawable(this, R.drawable.divider_sample);

recyclerView.addItemDecoration(new DividerItemDecoration(dividerDrawable));

StartOffsetItemDecoration

StartOffsetItemDecoration is used to add an offset to the start of a RecyclerView using a LinearLayoutManager. If the RecyclerView is oriented vertically, the offset will be added to the top of the RecyclerView. If the RecyclerView is oriented horizontally, the offset will be added to the lefthand side of the RecyclerView.

Its constructor takes in your preferred offset in pixels.

int offsetPx = 10;

recyclerView.addItemDecoration(new StartOffsetItemDecoration(offsetPx));

EndOffsetItemDecoration

EndOffsetItemDecoration is used to add an offset to the end of a RecyclerView using a LinearLayoutManager. If the RecyclerView is oriented vertically, the offset will be added to the bottom of the RecyclerView. If the RecyclerView is oriented horizontally, the offset will be added to the righthand side of the RecyclerView.

Its constructor takes in your preferred offset in pixels.

int offsetPx = 10;

recyclerView.addItemDecoration(new EndOffsetItemDecoration(offsetPx));

GridDividerItemDecoration

GridDividerItemDecoration is used to add interior dividers to a RecyclerView using a GridLayoutManager.

Its constructor takes in your preferred horizontal and vertical dividers, along with the number of columns in the grid.

Drawable horizontalDividerDrawable = ContextCompat.getDrawable(this, R.drawable.divider_horizontal);
Drawable verticalDividerDrawable = ContextCompat.getDrawable(this, R.drawable.divider_vertical);
int numColumns = 2;

recyclerView.addItemDecoration(new GridDividerItemDecoration(horizontalDividerDrawable, verticalDividerDrawable, numColumns));

GridTopOffsetItemDecoration

GridTopOffsetItemDecoration is used to add an offset to the top of a RecyclerView using a GridLayoutManager.

Its constructor takes in your preferred offset in pixels and the number of columns in the grid.

int offsetPx = 10;
int numColumns = 2;

recyclerView.addItemDecoration(new GridTopOffsetItemDecoration(offsetPx, numColumns));

GridBottomOffsetItemDecoration

GridBottomOffsetItemDecoration is used to add an offset to the bottom of a RecyclerView using a GridLayoutManager.

Its constructor takes in your preferred offset in pixels and the number of columns in the grid.

int offsetPx = 10;
int numColumns = 2;

recyclerView.addItemDecoration(new GridBottomOffsetItemDecoration(offsetPx, numColumns));

Project Setup

The latest release can be used by adding the following to your app's build.gradle:

compile 'com.bignerdranch.android:simple-item-decoration:1.0.0'

You can also clone the project and add it as a module to your project.

Contribute

Improvements/additions are encouraged. Clone the project with:

git clone https://github.com/bignerdranch/simple-item-decoration.git

License

The MIT License

Copyright (c) 2015 Big Nerd Ranch

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Extension points exported contracts — how you extend this code

OnVisibilityChangeListener (Interface)
(no doc) [3 implementers]
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/view/DividerControlsView.java

Core symbols most depended-on inside this repo

getSampleData
called by 3
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/model/SampleDataBank.java
setOnVisibilityChangeListener
called by 3
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/view/DividerControlsView.java
getItemCount
called by 2
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/SimpleItemDecorationSampleListAdapter.java
newIntent
called by 1
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java
initRecyclerView
called by 1
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java
toggleDividerVisibility
called by 1
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java
toggleStartOffsetVisibility
called by 1
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java
toggleEndOffsetVisibility
called by 1
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java

Shape

Method 62
Class 16
Interface 1

Languages

Java100%

Modules by API surface

sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/VerticalLinearLayoutManagerSampleActivity.java10 symbols
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/HorizontalLinearLayoutManagerSampleActivity.java10 symbols
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/GridLayoutManagerSampleActivity.java10 symbols
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/view/DividerControlsView.java8 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/DividerItemDecoration.java6 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridDividerItemDecoration.java6 symbols
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/SimpleItemDecorationSampleListAdapter.java5 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/StartOffsetItemDecoration.java3 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/linear/EndOffsetItemDecoration.java3 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridTopOffsetItemDecoration.java3 symbols
simpleitemdecoration/src/main/java/com/dgreenhalgh/android/simpleitemdecoration/grid/GridBottomOffsetItemDecoration.java3 symbols
sample/src/main/java/com/dgreenhalgh/android/simpleitemdecorationsample/controller/SimpleListItemDecorationSampleListHolder.java3 symbols

For agents

$ claude mcp add simple-item-decoration \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page