Git Product home page Git Product logo

circular-slider-android's Introduction

Circular Slider

Android Weekly Android Arsenal

What is this?

Circular Slider is a custom-built Android View used for choosing numbers. It works similarly to the regular slider control (SeekBar), just goes around in a circular fashion - simple enough. Note that the thumb scroller (the thing you drag around) can be either a solid-color circle or a custom drawable (like a PNG image).

Requirements

  • Android 3.0 or later (Minimum SDK level 11)
  • Android Studio (to compile and use)
  • Eclipse is not supported

Getting Started

  1. Download Android Studio
  2. Launch Android Studio
  3. Start your new project
  4. Open your project's main Gradle file, in root directory (/build.gradle)
  5. Make sure you are using jcenter() in the repository block (mavenCentral() should work too)
  6. Open your app module Gradle file, for example /app/build.gradle
  7. In dependencies block, add the following line: compile 'me.angrybyte.slider:slider:1.4.2'
  8. Click Tools/Android/Sync Project with Gradle Files or click on the Sync icon in the top toolbar
  9. Click Run/Run 'app' to see if it's resolved correctly

This will run the app on your device. You may need to download a newer version of Gradle, which will be available in the Android Studio UI if compile fails.

What does it look like?

screenshot_1

A dark variant

Sample usage

<me.angrybyte.circularslider.CircularSlider
    android:id="@+id/circular"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="30dp"
    circular:angle="3.14"
    circular:border_color="#505090"
    circular:border_thickness="14dp"
    circular:border_gradient_colors="#f05151;#4a90e2;#4a90e2"
    circular:thumb_color="#30AEFF"
    circular:thumb_size="24dp" />

Explanation of attributes

Here are some short explanations for the attributes provided by the view. You can leave out any of them, values will get set to default ones.

  • angle: (float) The current position of the slider thumb, a pi-based value of the angle (radians).
  • start_angle: (float) The starting position of the slider thumb, a pi-based valued of the angle (radians).
  • border_thickness: (dimension) How thick should the slider border be (this can be a 0-dimension).
  • border_color: (color) Recolors the slider border to the specified color.
  • border_gradient_colors: (string) Creates a gradient on the slider's circular edge. Format: "#f05151;#4a90e2;#4a90e2"
  • thumb_size: (dimension) Radius of the slider thumb (thumb is the slider's movable part).
  • thumb_image: (reference) Set this to use an image instead of a colored circle for the slider thumb.
  • thumb_color: (color) Set this to use a colored circle instead of an image for the slider thumb.

Note that thumb color and thumb image are mutually exclusive, you can't use both.

Support

If you've found an error while using the library, please file an issue. All patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub. Some more help can be found here:

circular-slider-android's People

Contributors

bkoruznjak avatar jonathan-caryl avatar milosmns avatar nshaposhnik avatar ravidsrk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circular-slider-android's Issues

The slider is sometimes missing an angle

Hi,

I am using the circular slider to make an element active when the slider angle matches with the angle of the element. Most of the time it works. But sometimes I have seen the slider misses the angle when the slider is moved fast.

Consider a less restrictive License?

Hi Milos,

This is a great project!

I would like to ask if you would consider changing the license from GPL to something less restrictive? I would really like to use your project in my app, but I'm unable to open source it.

Thanks!

making the slider continuous.

The slider does not seem to have the capability of being a slider which keeps adding value or keeps removing the value. can someone help me with that?

Negative Pos

Hello, I can't understand why Im getting negative values of pos.
Actually I see that the pos, moves on the range -0,5...0.5.

How do I retrieve the angle?

Hey,

I've implemented the slider and it works so far, but I cannot see how I can retrieve the angle of the slider. I can see a lot of setters, such as setAngle, but no getters.

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.