All Projects → kevalpatel2106 → Android Ruler Picker

kevalpatel2106 / Android Ruler Picker

Licence: apache-2.0
Android custom view that uses ruler for picking the number from given range.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Ruler Picker

SuperBadge
🚀 📛 SuperBadge Android Library 🔥
Stars: ✭ 34 (-89.85%)
Mutual labels:  custom-view
Circle
你没有看错,全是纯手工打造!
Stars: ✭ 269 (-19.7%)
Mutual labels:  custom-view
Swagpoints
An Android custom circular SeekBar that supports max/min range and step settings.
Stars: ✭ 300 (-10.45%)
Mutual labels:  custom-view
CustomViewStudy
This repository is used to learn CustomView(Text、Image、Progress、ViewGroup、ViewGragHelper).
Stars: ✭ 76 (-77.31%)
Mutual labels:  custom-view
Rxanime
Visualizer to understand RxJava operators
Stars: ✭ 261 (-22.09%)
Mutual labels:  custom-view
Linkedideas
A macOS/iOS apps to treat ideas as links of concepts.
Stars: ✭ 286 (-14.63%)
Mutual labels:  custom-view
WaveView
Simple Android library to draw sinusoidal waves.
Stars: ✭ 43 (-87.16%)
Mutual labels:  custom-view
Android Week View
Android Week View is an android library to display calendars (week view or day view) within the app. It supports custom styling.
Stars: ✭ 3,347 (+899.1%)
Mutual labels:  custom-view
Funnyviews
💘A lot of funny & custom views for android, will continue to update.
Stars: ✭ 267 (-20.3%)
Mutual labels:  custom-view
Rotatable
Helper class to make any view rotatable
Stars: ✭ 295 (-11.94%)
Mutual labels:  custom-view
DraggableTreeView
TreeView with drag and drop (n-th level)
Stars: ✭ 95 (-71.64%)
Mutual labels:  custom-view
Uilibrary
平时项目开发中写的自定义Drawable、View和Shape
Stars: ✭ 260 (-22.39%)
Mutual labels:  custom-view
Sparklinelayout
Simple and lightweight library for drawing sparklines / graphs. Support markers and gradients.
Stars: ✭ 291 (-13.13%)
Mutual labels:  custom-view
auto-fill-edit-text
This custom EditText can suggest and fill text defined before.
Stars: ✭ 26 (-92.24%)
Mutual labels:  custom-view
Curvegraphview
A highly customizable and performant custom view to render curved line graph.
Stars: ✭ 321 (-4.18%)
Mutual labels:  custom-view
signal-strength-view
📶 Material design signal strength view for Android
Stars: ✭ 30 (-91.04%)
Mutual labels:  custom-view
Tickview
一个精致带感的打钩小动画
Stars: ✭ 284 (-15.22%)
Mutual labels:  custom-view
Superlike
今日头条点赞动画 连击动画
Stars: ✭ 329 (-1.79%)
Mutual labels:  custom-view
Percentagechartview
An Android percentage chart that displays the progress of any single given task or information.
Stars: ✭ 324 (-3.28%)
Mutual labels:  custom-view
Effectiveshapeview
android custom imageview, effective shape view
Stars: ✭ 291 (-13.13%)
Mutual labels:  custom-view

Android Ruler Picker

Build Status API Javadoc

Android custom view that uses ruler for picking the number from given range.

Features:

  • Easy to integrate. All you have to do is add the view into your XML and listen for the value changes.
  • Highly customizable. Change width, height, color, distance between indicators. Change the color and sze of the texts in the ruler in XML or dynamically from your java or kotlin code.
  • Extremely lightweight 🏋.

How to use this library?

  • Gradle dependency:

    • Add below dependency into your build.gradle file.
      compile 'com.kevalpatel2106:ruler-picker:1.1'
      
    • For other build systems see Import.md.
  • Add RulerValuePicker inside your XML layout.

<com.kevalpatel2106.rulerpicker.RulerValuePicker
    android:id="@+id/ruler_picker"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:background="@android:color/holo_orange_dark"
    app:indicator_color="@android:color/white"
    app:indicator_interval="14dp"
    app:indicator_width="2dp"
    app:max_value="120"
    app:min_value="35"
    app:notch_color="@android:color/white"
    app:ruler_text_size="6sp"/>

  • Library provides XML attributes to customize the RulerValuePicker or you can customize it dynamically using Java/Kotlin code.
Attribute Type Java/Kotlin Description
indicator_color Color setIndicatorColor() Change the color of the indicator in the ruler.
indicator_interval Dimensions setIndicatorIntervalDistance() Change the distance between two indicators in the ruler.
indicator_width Dimensions setIndicatorWidth() Change the width (thickness) of the indicator.
notch_color Color setNotchColor() Change the color off the notch at the top of the ruler.
ruler_text_size Dimensions setTextSize() Change the size of the text that displays the values in the ruler.
ruler_text_color Color setTextColor() Change the color of the text that displays the values in the ruler.
long_height_height_ratio Fraction setIndicatorHeight() Change the height of the long indicator. The value is between 0 to 1 where 1 indicates the height of the ruler. This value must be greater than or equal to long_height_height_ratio.
short_height_height_ratio Fraction setIndicatorHeight() Change the height of the short indicator. The value is between 0 to 1 where 1 indicates the height of the ruler. This value must be less than or equal to short_height_height_ratio.
max_value Integer setMinMaxValue() Maximum possible value to display in the ruler. This value must be greater than min_value.
min_value Integer setMinMaxValue() Minimum possible value to display in the ruler. This value must be greater than max_value.
  • Set the initially selected value.
rulerValuePicker.selectValue(55 /* Initial value */);
  • Set up a RulerValuePickerListener callback listener to get notify when the selected value changes. Application will receive the final selected value in onValueChange() callback.

Java:

rulerValuePicker.setValuePickerListener(new RulerValuePickerListener() {
    @Override
    public void onValueChange(final int selectedValue) {
        //Value changed and the user stopped scrolling the ruler.
        //Application can consider this value as final selected value.
    }

    @Override
    public void onIntermediateValueChange(final int selectedValue) {
        //Value changed but the user is still scrolling the ruler.
        //This value is not final value. Application can utilize this value to display the current selected value.
    }
});

Kotlin:

rulerValuePicker.setValuePickerListener(object : RulerValuePickerListener {
    override fun onValueChange(value: Int) {
        //Value changed and the user stopped scrolling the ruler.
        //You can consider this value as final selected value.
    }

    override fun onIntermediateValueChange(selectedValue: Int) {
        //Value changed but the user is still scrolling the ruler.
        //This value is not final value. You can utilize this value to display the current selected value.
    }
})

Screenshots:

Sample 1 Sample 2
profile-demo.gif ruler-view-demo.gif

What to try this out?

  • You can download the sample apk from here and play with it.

Want to contribute?

Every small or large contribution to this project is appreciated. Make sure you read the contribution guide before generating the pull request.

Questions?🤔

Hit me on twitter Twitter

Acknowledgements:

License

Copyright 2018 Keval Patel

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].