Android Rubber Picker Library

Overview

RubberPicker

License: MIT API Android Arsenal

RubberPicker library contains the RubberSeekBar and RubberRangePicker, inspired by Cuberto's rubber-range-picker.

Getting started

Setting up the dependency

  1. Add the JitPack repository to your root build.gradle at the end of repositories:
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. Add the RubberPicker dependency in the build.gradle:
implementation 'com.github.Chrisvin:RubberPicker:v1.5'

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:defaultThumbInsideColor="#FFF"
  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:defaultThumbInsideColor="#CFCD5D67"
  app:highlightDefaultThumbOnTouchColor="#CD5D67"/>

Adding/Modifying programmatically

val rubberSeekBar = RubberSeekBar(this)
rubberSeekBar.setMin(20)
rubberSeekBar.setMax(80)
rubberSeekBar.setElasticBehavior(ElasticBehavior.CUBIC)
rubberSeekBar.setDampingRatio(0.4F)
rubberSeekBar.setStiffness(1000F)
rubberSeekBar.setStretchRange(50f)
rubberSeekBar.setThumbRadius(32f)
rubberSeekBar.setNormalTrackWidth(2f)
rubberSeekBar.setHighlightTrackWidth(4f)
rubberSeekBar.setNormalTrackColor(Color.GRAY)
rubberSeekBar.setHighlightTrackColor(Color.BLUE)
rubberSeekBar.setHighlightThumbOnTouchColor(Color.CYAN)
rubberSeekBar.setDefaultThumbInsideColor(Color.WHITE)

val currentValue = rubberSeekBar.getCurrentValue()
rubberSeekBar.setCurrentValue(currentValue + 10)
rubberSeekBar.setOnRubberSeekBarChangeListener(object : RubberSeekBar.OnRubberSeekBarChangeListener {
    override fun onProgressChanged(seekBar: RubberSeekBar, value: Int, fromUser: Boolean) {}
    override fun onStartTrackingTouch(seekBar: RubberSeekBar) {}
    override fun onStopTrackingTouch(seekBar: RubberSeekBar) {}
})


//Similarly for RubberRangePicker
val rubberRangePicker = RubberRangePicker(this)
rubberRangePicker.setMin(20)
...
rubberRangePicker.setHighlightThumbOnTouchColor(Color.CYAN)

val startThumbValue = rubberRangePicker.getCurrentStartValue()
rubberRangePicker.setCurrentStartValue(startThumbValue + 10)
val endThumbValue = rubberRangePicker.getCurrentEndValue()
rubberRangePicker.setCurrentEndValue(endThumbValue + 10)
rubberRangePicker.setOnRubberRangePickerChangeListener(object: RubberRangePicker.OnRubberRangePickerChangeListener{
    override fun onProgressChanged(rangePicker: RubberRangePicker, startValue: Int, endValue: Int, fromUser: Boolean) {}
    override fun onStartTrackingTouch(rangePicker: RubberRangePicker, isStartThumb: Boolean) {}
    override fun onStopTrackingTouch(rangePicker: RubberRangePicker, isStartThumb: Boolean) {}
})

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.

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

License

MIT License

Copyright (c) 2019 Jem

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.
You might also like...
Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa
Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa

FabulousFilter Show some ❤️ and star the repo to support the project This library is the implementation of filter-concept posted on MaterialUp.com. It

Android library to control Transition animates. A simple way to create a interactive animation.
Android library to control Transition animates. A simple way to create a interactive animation.

TransitionPlayer Android library to control Transition animates. A simple way to create a interactive animation. Demo1 SimpleTransition Code: ....

Road Runner is a library for android which allow you to make your own loading animation using a SVG image
Road Runner is a library for android which allow you to make your own loading animation using a SVG image

Road Runner Road Runner is a library for android which allow you to make your own loading animation using a SVG image Sample video View in Youtube Dem

FPSAnimator is very easy animation library for Android TextureView and SurfaceView.
FPSAnimator is very easy animation library for Android TextureView and SurfaceView.

FPSAnimator A simple but powerful Tween / SpriteSheet / ParabolicMotion / animation library for Android TextureView and SurfaceView. Features The cont

Android library for material scrolling techniques.
Android library for material scrolling techniques.

material-scrolling Android library for material scrolling techniques. Features Easily implement material scrolling techniques with RecyclerView. Custo

Android LiquidSwipe Library
Android LiquidSwipe Library

LiquidSwipe Android LiquidSwipe Library Default Touch Interactive LiquidSwipe is a viewpager library that can be used to make awesome onboarding desig

Android library to display a few images in one ImageView like avatar of group chat. Made by Stfalcon
Android library to display a few images in one ImageView like avatar of group chat. Made by Stfalcon

MultiImageView Library for display a few images in one MultiImageView like avatar of group chat Who we are Need iOS and Android apps, MVP development

Android library to create complex multi-state animations.
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Fast marker clustering library for Google Maps Android API.
Fast marker clustering library for Google Maps Android API.

Google Maps Clustering for Android A fast marker clustering library for Google Maps Android API. Motivation Why not use Google Maps Android API Utilit

Comments
  • MIN SDK VERSION 19?

    MIN SDK VERSION 19?

    While the minimum sdk version is mentioned as 15+, the inner library uses 19? Is this in error or has the min sdk version increased? Thank you, love the effort btw!

    opened by TheAnimatrix 3
  • Default value set error!

    Default value set error!

    Hello @Chrisvin Jem! RubberPicker, Your library is beautiful, but when I use the starting values, the trackers will stay at the starting point, please clarify! I want to do something like that:

    Снимок экрана 2019-12-23 в 7 33 15 PM
    opened by GulmirzaNorboyev 1
Releases(v1.5)
Owner
Chrisvin Jem
Programmer
Chrisvin Jem
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
Postman is a reactive One-tap SMS verification library. This library allows the usage of RxJava with The SMS User Consent API

What is Postman? Postman is a reactive One-tap SMS verification library. This library allows the usage of RxJava with The SMS User Consent API Usage P

Cafer Mert Ceyhan 129 Dec 24, 2022
Android library for swipable gestures

Swipper Android Library for custom views to control brightness , volume and seek through swipable gestures . These views could easily replace the conv

Mobile Development Group 105 Dec 30, 2022
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

TakuSemba 3.4k Jan 4, 2023
[] An Android library which allows developers to easily add animations to ListView items

DEPRECATED ListViewAnimations is deprecated in favor of new RecyclerView solutions. No new development will be taking place, but the existing versions

Niek Haarman 5.6k Dec 30, 2022
EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the Etsy app.

EtsyBlur EtsyBlur is an Android library that allows developers to easily add a glass-like blur effect implemented in the past Etsy app. Try out the sa

Manabu S. 755 Dec 29, 2022
[] Android library for using the Honeycomb animation API on all versions of the platform back to 1.0!

DEPRECATED NineOldAndroids is deprecated. No new development will be taking place. Existing versions will (of course) continue to function. New applic

Jake Wharton 4.5k Jan 9, 2023
Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon

ChatKit for Android ChatKit is a library designed to simplify the development of UI for such a trivial task as chat. It has flexible possibilities for

Stfalcon LLC 3.6k Jan 5, 2023
An Android library which provides simple Item animations to RecyclerView items

RecyclerViewItemAnimators Library Travis master: This repo provides: Appearance animations Simple animators for the item views Quick start You can now

Gabriele Mariotti 3.1k Dec 16, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 29, 2022