Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sbra0902 committed Aug 7, 2017
2 parents df55ad0 + 3b0b07e commit 86ae87e
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# andcircularselect
library for customisable circular picker

## Features

* Easy to use - define in xml configure with Builder

* highly customisable. Every part of the control can be configured


## Implementation


1. Add it in your root build.gradle at the end of repositories:

```
buildscript {
repositories {
maven { url 'https://jitpack.io' }
}
}
...
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
```

2. Add gradle dependency

```
compile 'com.github.Kaufland:andcircularselect:0.5.0'
```

3. Configure library

* XML

``` xml
<kaufland.com.andcircularselect.CircularSelect
android:layout_width="300dp"
android:id="@+id/select"
app:outer_circle_width="90dp"
app:indicator_size="40dp"
app:selector_circle_size="20dp"
android:layout_marginBottom="20dp"
android:layout_height="300dp"/>
```

* Configure Data

``` java
final List<DataView> mdata = new ArrayList<>();

mdata.add(new ColorDataView.Builder().withColor(Color.BLACK).build());
mdata.add(new ColorDataView.Builder().withColor(Color.GREEN).build());
mdata.add(new ColorDataView.Builder().withColor(Color.YELLOW).build());
mdata.add(new ColorDataView.Builder().withColor(Color.BLUE).build());
mdata.add(new ColorDataView.Builder().withColor(Color.MAGENTA).build());
mdata.add(new ColorDataView.Builder().withColor(Color.LTGRAY).build());

mCircularSelect.setData(mdata);
mCircularSelect.setIndicatorRenderer(new IndicatorRenderer() {

private CardView mCardView;
private TextView mTextView;

@Override
public void update(DataView selected, ViewGroup parent) {

if (mCardView == null) {
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View inflated = inflater.inflate(R.layout.indicator_renderer, parent);
mCardView = (CardView) inflated.findViewById(R.id.indicator_card);
mTextView = (TextView) inflated.findViewById(R.id.indicator_text);
}

mTextView.setText(mdata.indexOf(selected) + "");
mCardView.setRadius(getResources().getDimension(R.dimen.rounded));
mCardView.setCardBackgroundColor(((ColorDataView) selected).getColor());

}
});
```

0 comments on commit 86ae87e

Please sign in to comment.