Giter VIP home page Giter VIP logo

croller's Introduction


Platform API License: MIT

Usage

Just add the following dependency in your app's build.gradle

dependencies {
      compile 'com.sdsmdg.harjot:croller:1.0.7'
}

XML

<com.sdsmdg.harjot.crollerTest.Croller
        android:id="@+id/croller"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        app:back_circle_color="#EDEDED"
        app:indicator_color="#0B3C49"
        app:indicator_width="10"
        app:is_continuous="true"
        app:label_color="#000000"
        app:main_circle_color="#FFFFFF"
        app:max="1000"
        app:progress_primary_color="#0B3C49"
        app:progress_secondary_color="#EEEEEE"
        app:start_offset="45" />

Java

Croller croller = (Croller) findViewById(R.id.croller);
        croller.setIndicatorWidth(10);
        croller.setBackCircleColor(Color.parseColor("#EDEDED"));
        croller.setMainCircleColor(Color.WHITE);
        croller.setMax(50);
        croller.setStartOffset(45);
        croller.setIsContinuous(false);
        croller.setLabelColor(Color.BLACK);
        croller.setProgressPrimaryColor(Color.parseColor("#0B3C49"));
        croller.setIndicatorColor(Color.parseColor("#0B3C49"));
        croller.setProgressSecondaryColor(Color.parseColor("#EEEEEE"));

Listeners

Progress Change Listener (if you only want to use the progress)

Croller croller = (Croller) findViewById(R.id.croller);
        croller.setOnProgressChangedListener(new Croller.onProgressChangedListener() {
            @Override
            public void onProgressChanged(int progress) {
                // use the progress
            }
        });

Croller Change Listener (if want start and stop tracking as well, similar to seekbar)

Croller croller.setOnCrollerChangeListener(new OnCrollerChangeListener() {
            @Override
            public void onProgressChanged(Croller croller, int progress) {
            	// use the progress
            }

            @Override
            public void onStartTrackingTouch(Croller croller) {
                // tracking started
            }

            @Override
            public void onStopTrackingTouch(Croller croller) {
            	// tracking stopped
            }
        });

Attributes


XML Attribute Java set method Functionality
anticlockwise setAntiClockwise(boolean anticlockwise) Set the direction of rotation
progress setProgress(int progress) Set the current progress of the seekbar
label setLabel(String str) Set the label
label_size setLabelSize(int size) Set the label size
label_color setLabelColor(int color) Set the label color
is_continuous setIsContinuous(boolean bool) Set whether seekbar is conitnuous or discrete
max setMax(int max) Set the maximum value of the seekbar
min setMin(int min) Set the minimum value of the seekbar (Default is 1)
start_offset setStartOffset(int offset) Set the seekbar start offset angle from bottom horizontal center
sweep_angle setSweepAngle(int angle) Set the total angle covered by the seekbar
progress_primary_stroke_width setProgressPrimaryStrokeWidth(float width) Set the primary progress thickness for continuous type
progress_secondary_stroke_width setProgressSecondaryStrokeWidth(float width) Set the secondary progress thickness for continuous type
progress_primary_circle_size setProgressPrimaryCircleSize(float size) Set the primary progress circle size for discrete type
progress_secondary_circle_size setProgressSecondaryCircleSize(float size) Set the secondary progress circle size for discrete type
indicator_width setIndicatorWidth(float width) Set the progress indicator width
indicator_color setIndicatorColor(int color) Set the progress indicator color
progress_primary_color setProgressPrimaryColor(int color) Set the progress primary(active) color
progress_secondary_color setProgressSecondaryColor(int color) Set the progress secondary(inactive) color
progress_radius setProgressRadius(float radius) Set the radius of the progress arc
main_circle_radius setMainCircleRadius(float radius) Set the main(front) circle radius
back_circle_radius setBackCircleRadius(float radius) Set the back circle radius
main_circle_color setMainCircleColor(int color) Set the main(front) circle color
back_circle_color setBackCircleColor(int color) Set the back circle color

Examples

is_continuous = false

is_continuous = true

License

Croller is licensed under MIT license. View license.

croller's People

Contributors

broy98 avatar dev-ritik avatar harjot-oberai avatar joansanfeliu avatar ketanhwr avatar ligi avatar nikhilagrawal2000 avatar rounndel 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

croller's Issues

i set is_continuous to false but continuous again

<seek_bar.circolare.Croller
android:id="@+id/croller"
android:layout_width="@dimen/_150sdp"
android:layout_height="@dimen/_150sdp"
android:layout_centerInParent="true"
app:back_circle_color="#EDEDED"
app:indicator_color="@color/black"
app:indicator_width="10"
app:is_continuous="false"
app:label=""
app:label_color="#000000"
app:main_circle_color="#FFFFFF"
app:max="300"
app:progress_primary_color="#0B3C49"
app:progress_primary_circle_size="5"
app:progress_secondary_color="#EEEEEE"
app:start_offset="45"
android:layout_marginBottom="@dimen/_10sdp"
></seek_bar.circolare.Croller>

this is the code.
i want point progress, not line continous.

NullPointerException

java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2451)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2511)
at android.app.ActivityThread.access$900 (ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1375)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:150)
at android.app.ActivityThread.main (ActivityThread.java:5621)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:684)
Caused by: java.lang.NullPointerException:
at com.eno.nael.cooktimer.MainActivity.onCreate (MainActivity.java:85)
at android.app.Activity.performCreate (Activity.java:6367)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2404)

this is the code cause this exception

//croller.setIndicatorWidth(10);
        //croller.setBackCircleColor(Color.parseColor("#EDEDED"));
        //croller.setMainCircleColor(android.R.color.white);
        croller.setMax(900*2);
        croller.setProgress(300);
        //croller.setStartOffset(45);
        //croller.setIsContinuous(true);
        //croller.setLabelColor(Color.BLACK);
        //croller.setProgressPrimaryColor(Color.parseColor("#0B3C49"));
        //croller.setIndicatorColor(Color.parseColor("#0B3C49"));
        //croller.setProgressSecondaryColor(Color.parseColor("#f9b97a"));

now i disabled it

Anticlockwise rotation support

Hi,

Is it possible to add a variable to decide if the sens is clockwise or counterclockwise ?

Thanks in advance,

Benjamin

Gap between primary and secondary progress in anticlockwise

After some tests with anticlockwise, I have an issue the primary and the secondary progress doesn't start and doesn't at the same point :/

I attached a screenshot to help you. (The primary progress is the green one)
screenshot_20171012-072130

My xml :

<com.sdsmdg.harjot.crollerTest.Croller
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
app:back_circle_color="@android:color/white"
app:indicator_color="#019a6b"
app:indicator_width="20"
app:is_continuous="true"
app:anticlockwise="true"
app:label_color="@android:color/black"
app:label_size="0"
app:main_circle_color="@android:color/white"
app:max="25"
app:progress="0"
app:progress_primary_color="#019a6b"
app:progress_primary_stroke_width="50"
app:progress_secondary_color="#EEEEEE"
app:progress_secondary_stroke_width="45"
app:start_offset="215"

Prevent vertical scroll when interacting with custom view

After some experimental test, i found the following code will prevent vertical scroll when touching the Croller.
@Override public boolean dispatchTouchEvent(MotionEvent event) { if (getParent() != null && event.getAction() == MotionEvent.ACTION_DOWN) { getParent().requestDisallowInterceptTouchEvent(true); } return super.dispatchTouchEvent(event); }

Option to increment progress in steps

Any chance of adding the progress in steps?

Let's say I want to increment the progress in multiple of 10 rather than 1, with a max value of 100. Is it possible? This feature can be helpful in displaying levels ex., 1 to 10 or Beginner to Expert kind of scenarios

Sensitivity Request

Hey guys! I love the croller using it on a project ATM, but having some issues with sensitivity, I am using it only with 9 values, each one being a preset controlling 6 other parameters. But as I have been testing it, It seems was to sensitive for prime-time use. I currently have all my presets being adjusted based on overriding the onProgressChanged function. I have tried using on progress on onStartTrackingTouch, and onStopTrackingTouch but neither stopped the parameter being jittery. What I tried doing was adding points in the tracking and only adjusting for every 10 progress changed, but it looked weird going from 9 points to 90 to reduce sensitivity looked crazy on the screen. Next step if I want to keep using is to rewrite the entire widget from scratch and adding the sensitivity feature in. Any suggestions would be appreciated. Thanks Guys!

Add a license

Would be great if this lib had some license attached - would suggest MIT or Apache

Publish demo app

Would be nice if you could upload the compiled APK of the demo app either here or on Google Play.

error: duplicate value for resource 'attr/progress'

On using Croller v 1.0.7 and upgrading to the latest version on Constraint layout in Android i.e com.android.support.constraint:constraint-layout:2.0.0-alpha1/alpha2 (Motion Layout)

i get the following:

  • What went wrong:
    Execution failed for task ':app:mergeDebugResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1285: error: duplicate value for resource 'attr/progress' with config ''.
C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1285: error: resource previously defined here.

Command: C:\Users\Kumar.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\6c2d83a259d5cde1cbf25c4727b1a482\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy
-o
C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\res\merged\debug
C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
Output: C:\Users\Kumar.gradle\caches\transforms-1\files-1.1\croller-1.0.7.aar\ee1f5cfa4bf9e21b43d3c29c329df1d8\res\values\values.xml:3:5-1134: AAPT: error: duplicate value for resource 'attr/progress' with config ''.

C:\Users\Kumar.gradle\caches\transforms-1\files-1.1\croller-1.0.7.aar\ee1f5cfa4bf9e21b43d3c29c329df1d8\res\values\values.xml:3:5-1134: AAPT: error: resource previously defined here.

Command: C:\Users\Kumar.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\6c2d83a259d5cde1cbf25c4727b1a482\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy
-o
C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\res\merged\debug
C:\Users\Kumar\AndroidStudioProjects\Untitled\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

Can you please help with this if possible?

Croller Seekbar doesnt show

hello there,
am trying to use the croller seekbar but the problem i encountered is that when i set the layout_height="wrap_content" and layout_width="wrap_content".. so the croller seekbar wont displayed so if i set layout_height="match_parent" and layout_width="match_parent" it will displayed here is the code below
`

<com.sdsmdg.harjot.crollerTest.Croller
    android:id="@+id/croller"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    app:back_circle_color="#EDEDED"
    app:indicator_color="#0B3C49"
    app:indicator_width="12"

    app:label_color="@color/black"
    app:main_circle_color="#FFFFFF"
    app:max="1000"
    app:progress_primary_color="#0B3C49"
    app:progress_secondary_color="#EEEEEE"
    app:start_offset="45"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginLeft="20dp"
    android:layout_marginStart="20dp"/>

`

Create Circular Shape

is it possible to create the same view but completely in circle shape, i mean i know it's possible but don't know how??

New Release with all changes

Hello,

I see a fixed issue (#15) and I need to update your library to solve this problem. I tried to use Jitpack with your master branch but it doesn't work. Can you create a new release version with all new changes?

Thank you

label text cutoff

The widget seems to be cutting off the bottom edge of the label. The following screenshot, for example, shows "Sensivity" as "Sensitivitv". I used the same params used in the instructions. I tried adjusting the layout externally and failed to fix the issue. Your suggestions will be appreciated.

screen shot 2017-10-27 at 2 23 05 pm

Leave the method onDraw clean

Hi Harjot.

I would like to say to leave this method clean, try to move any instantiation of values or heavy operations to out of the scope of this element. You can reduce the CPU and battery usage doing this. This method was build just to read values and draw on canvas.

Of course, this is not a problem:

void onDraw(Canvas canvas) {
  canvas.draw(x + diff, y + diff, paint)
}

You can do it, the performance will be not affected when the calculation of values is not that heavy.
To create some values based on the bounds of its view, you can use the method onLayout(...).

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.