RubberPicker
RubberPicker library contains the RubberSeekBar
and RubberRangePicker
, inspired by Cuberto's rubber-range-picker.
Getting started
Setting up the dependency
- Add the JitPack repository to your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the RubberPicker dependency in the build.gradle:
implementation 'com.github.Chrisvin:RubberPicker:v1.1'
Demo app
To run the demo project, clone the repository and run it via Android Studio.
Usage
Adding directly in layout.xml
<com.jem.rubberpicker.RubberSeekBar
...
app:minValue="20"
app:maxValue="80"
app:elasticBehavior="cubic"
app:dampingRatio="0.3"
app:stiffness="300"
app:stretchRange="24dp"
app:defaultThumbRadius="16dp"
app:normalTrackWidth="4dp"
app:highlightTrackWidth="8dp"
app:normalTrackColor="#AAAAAA"
app:highlightTrackColor="#BA1F33"
app:highlightDefaultThumbOnTouchColor="#CD5D67"/>
<!-- Similar attributes can be applied for RubberRangePicker as well-->
<com.jem.rubberpicker.RubberRangePicker
...
app:minValue="0"
app:maxValue="100"
app:elasticBehavior="linear"
app:dampingRatio="0.4"
app:stiffness="400"
app:stretchRange="36dp"
app:defaultThumbRadius="16dp"
app:normalTrackWidth="4dp"
app:highlightTrackWidth="8dp"
app:normalTrackColor="#AAAAAA"
app:highlightTrackColor="#BA1F33"
app:highlightDefaultThumbOnTouchColor="#CD5D67"/>
Adding/Modifying programmatically
Todo
- [ ] Refactor code to remove redundant code between RubberSeekBar & RubberRangePicker.
- [ ] Add step attribute, make necessary UI adjustments for step based value increments.
- [ ] Current library overcomes view clipping by setting the parent layout's clipChildren & clipToPadding as false. Find a better alternative to overcome view clipping.