Code Monkey home page Code Monkey logo

circularseekbar's Introduction

CircularSeekBar

A framework used to create circular seek bar


Screenshots

| |


Setup

Gradle

implementation 'com.github.stefanodp91.android:circularseekbar:0.2'

Maven

<dependency>
  <groupId>com.github.stefanodp91.android</groupId>
  <artifactId>circularseekbar</artifactId>
  <version>0.2</version>
  <type>pom</type>
</dependency>

Usage

  ...
  <com.github.stefanodp91.android.circularseekbar.CircularSeekBar
      android:id="@+id/seek"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:cs_arcRadius="150dp"/>
  ...

Subscribe to progress changes with OnCircularSeekBarChangeListener:

  ...
CircularSeekBar seekBar = findViewById(R.id.seek);
seekBar.setOnRoundedSeekChangeListener(new OnCircularSeekBarChangeListener() {
    /**
     * Progress change
     * @param CircularSeekBar
     * @param progress the progress
     */
    @Override
    public void onProgressChange(CircularSeekBar CircularSeekBar, float progress) {
        Log.d("progress", "" + progress);
    }

    /**
     * Indicator touched
     * @param CircularSeekBar
     */
    @Override
    public void onStartTrackingTouch(CircularSeekBar CircularSeekBar) {

    }

    /**
     * Indicator released
     * @param CircularSeekBar
     */
    @Override
    public void onStopTrackingTouch(CircularSeekBar CircularSeekBar) {

    }
});
  ...

Customization

  • app:cs_arcRadius : The radius of the circle. It is a mandatory field and must be chosen wisely. It must be less than the screen size
  • app:cs_step : The increment of the percentual. Default is set to 1
  • app:cs_progressWidth : The width of progress
  • app:cs_arcWidth : The width of base cicle
  • app:cs_indicatorRadius : The radius of the draggable indicator
  • app:cs_enabled : Enable or disable the drag
  • app:cs_color_list : Integer vector used for gradient generation
  • app:cs_text : Text to display to the center of the base cicle
  • app:cs_text_size : Text size
  • app:cs_text_color : Text static color
  • app:cs_dynamic_text_color : Text color changes according to the indicator color
  • app:cs_text_progress : Display the current progress as text
  • app:cs_indicator_enabled : Show/Hide the indicator
  • app:cs_progress : Set the current progress

Common issues

java.lang.IllegalArgumentException: y must be >= 0

or

java.lang.IllegalArgumentException: x must be < bitmap.width()

Probably the cs_arcRadius is too large


Developed By

Author: Stefano de Pascalis

Google+ LinkedIn


License

Copyright 2019 stefanodp91.

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.

circularseekbar's People

Contributors

stefanodp91 avatar

Stargazers

Siva Nimmala avatar  avatar Kyle avatar  avatar Pranav Lathigara avatar Alessandro Cudazzo avatar

Watchers

James Cloos avatar

circularseekbar's Issues

how to change the min max value

my min range is 2000 and max is 7000 , if I change it from 0 to 2000 the progress is marked so in this case how to handle it

.

.

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.