compile 'com.thedesigncycle.ui:views:0.3.1'
XML
<com.thedesigncycle.ui.CircleButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="100dp"
android:layout_height="100dp"
app:buttonColor="#ff0000"
app:icon="@drawable/ic_list"
/>| Attribute | Description | Example |
|---|---|---|
buttonColor |
Color of the button | #ff0000 or @color/myButtonColor |
icon |
Icon resource | @drawable/ic_call |
Java
Create at runtime
CircleButton myCircleButton = new CircleButton(context);or fetch from layout
CircleButton myCircleButton = (CircleButton) findViewById(R.id.my_circle_button);Customize
myCircleButton.setColor("#FF0000");
myCircleButton.setIcon(getResources().getDrawable(R.drawable.ic_list));Methods
| Method | Description |
|---|---|
setButtonColor(int Color) |
Set color of the button |
setIcon(Drawable icon) |
Set icon drawable |
CircleButton inherits all public methods from View, including setOnClickListener(...)
XML
<com.thedesigncycle.ui.CircleToggleButton
android:id="@+id/my_circle_toggle"
android:layout_width="100dp"
android:layout_height="100dp"
app:buttonColorChecked="#00cc00"
app:iconChecked="@drawable/ic_check"
app:buttonColorUnchecked="#ff0000"
app:iconUnchecked="@drawable/ic_wifi"
/>| Attribute | Description | Example |
|---|---|---|
buttonColorChecked |
Color of the button in checked state | #00ff00 or @color/myCheckedColor |
iconChecked |
Icon resource for checked state | @drawable/ic_check |
buttonColorUnchecked |
Color of the button in unchecked state | #ff0000 or @color/myUncheckedColor |
iconUnchecked |
Icon resource for unchecked state | @drawable/ic_close |
Java
Create at runtime
CircleToggleButton circleToggleButton = new CircleToggleButton(context);or fetch from layout
CircleToggleButton circleToggleButton = (CircleToggleButton) findViewById(R.id.my_circle_toggle);Customize
circleToggleButton.setButtonColorUnchecked(Color.RED);
circleToggleButton.setButtonColorChecked(Color.parseColor("#00cc00"));
circleToggleButton.setIconUnchecked(getResources().getDrawable(R.drawable.ic_wifi));
circleToggleButton.setIconChecked(getResources().getDrawable(R.drawable.ic_check));Methods
| Method | Description |
|---|---|
setButtonColorUnchecked(int Color) |
Set color of the button for unchecked state |
setIconUnchecked(Drawable icon) |
Set icon drawable for unchecked state |
setButtonColorChecked(int Color) |
Set color of the button for checked state |
setIconChecked(Drawable icon) |
Set icon drawable for checked state |
CircleToggleButton inherits all public methods from CompoundButton, including setOnCheckedChangeListener(...)
XML
<com.thedesigncycle.ui.RippleView
android:layout_width="200dp"
android:layout_height="200dp"
app:colorMode="gradient"
app:gradientColor1="#FA67BF"
app:gradientColor2="#E37F83"
app:rippleCount="5"
app:rippleDuration="3000"
app:smallCircleScale="0.2"
app:gravity="center"
/>| Attribute | Description | Example | Default |
|---|---|---|---|
colorMode |
Solid color or gradient | solid or gradient |
solid |
solidColor |
Color (if solid color mode) | #00ff00 or @color/myColor |
|
gradientColor1 |
Color 1 of gradient (if gradient color mode) | #00ff00 or @color/myColor1 |
|
gradientColor2 |
Color 2 of gradient (if gradient color mode) | #0000ff or @color/myColor2 |
|
rippleCount |
Number of visible ripples at any instance of time | Recommended between 2 and 10 |
5 |
rippleDuration |
Duration of animation of ripple in milliseconds | Recommended between 100 and 5000 |
1000 |
smallCircleScale |
The scale of the initial circle | Between 0.1 and 0.9 |
0.5 |
gravity |
The anchor of the ripples | center left top right bottom top|left bottom|right etc. |
center |
Java
Create at runtime
RippleView rippleView = new RippleView(context);or fetch from layout
RippleView rippleView = (RippleView) findViewById(R.id.my_ripple_view);
Customize
Anchor to an edge
rippleView.setGravity(Gravity.LEFT);Anchor a corner
rippleView.setGravity(Gravity.BOTTOM | Gravity.RIGHT);Gradient
rippleView.setGradient(color1, color2);Solid color
rippleView.setSolidColor(color);Ripple Count
rippleView.setRippleCount(5);Ripple Animation Duration (in milliseconds)
rippleView.setRippleDuration(1000);Scale of the starting ripple (relative to the view size)
rippleView.setSmallCircleScale(0.5f);

