Git Product home page Git Product logo

colorseekbar's Introduction

ColorSeekbar

ScreenShot:

ColorSeekbar Attrs

<declare-styleable name="ColorSeekBar">
    <attr name="colorSeekBarColorSeeds" format="reference" />
    <attr name="colorSeekBarBarHeight" format="dimension" />
    <attr name="colorSeekBarProgress" format="integer" />
    <attr name="colorSeekBarRadius" format="dimension" />
    <attr name="colorSeekBarMaxProgress" format="integer" />
    <attr name="colorSeekBarVertical" format="boolean" />
    <attr name="colorSeekBarShowThumb" format="boolean" />
    <attr name="colorSeekBarBorderColor" format="color" />
    <attr name="colorSeekBarBorderSize" format="dimension" />
</declare-styleable>

AlphaSeekbar Attrs

<declare-styleable name="AlphaSeekBar">
    <attr name="alphaSeekBarHeight" format="dimension" />
    <attr name="alphaSeekBarRadius" format="dimension" />
    <attr name="alphaSeekBarShowGrid" format="boolean" />
    <attr name="alphaSeekBarShowThumb" format="boolean" />
    <attr name="alphaSeekBarSizeGrid" format="dimension" />
    <attr name="alphaSeekBarProgress" format="integer" />
    <attr name="alphaSeekBarVertical" format="boolean" />
    <attr name="alphaSeekBarMaxProgress" format="integer" />
    <attr name="alphaSeekBarBorderColor" format="color" />
    <attr name="alphaSeekBarBorderSize" format="dimension" />
    <attr name="alphaSeekBarDirection" format="enum">
        <enum name="LEFT_TO_RIGHT" value="0"/>
        <enum name="RIGHT_TO_LEFT" value="1"/>
        <enum name="TOP_TO_BOTTOM" value="2"/>
        <enum name="BOTTOM_TO_TOP" value="3"/>
    </attr>
</declare-styleable>

Gradle:

Release API Android Arsenal

Step 1. Add the JitPack repository in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. Add the dependency

implementation 'com.github.rtugeek:colorseekbar:2.0.3'

Usage

XML

<com.rtugeek.android.colorseekbar.ColorSeekBar 
    android:id="@+id/colorSeekBar"
    android:layout_width="match_parent"
    app:colorSeeds="@array/material_colors"
    android:layout_height="wrap_content" />

<com.rtugeek.android.colorseekbar.AlphaSeekBar 
    android:id="@+id/alphaSeekBar"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" />

Kotlin

colorSeekBar.maxProgress = 1000
colorSeekBar.progress = 50
colorSeekBar.borderColor = Color.BLACK
colorSeekBar.borderRadius = 10
colorSeekBar.borderSize = 10
colorSeekBar.thumbDrawer = DefaultThumbDrawer(30,Color.WHITE,Color.BLUE)
colorSeekBar.isVertical = false
colorSeekBar.barHeight = 10
colorSeekBar.color = Color.BLACK // or colorSeekBar.progress = 100
//lock thumb
colorSeekBar.isEnabled =false


alphaSeekBar.maxProgress = 1000
alphaSeekBar.borderColor = Color.BLACK
alphaSeekBar.borderRadius = 10
alphaSeekBar.borderSize = 10
alphaSeekBar.thumbDrawer = DefaultThumbDrawer(30,Color.WHITE,Color.BLUE)
alphaSeekBar.isVertical = false
alphaSeekBar.barHeight = 10
alphaSeekBar.alphaValue = 255 // or alphaSeekBar.progress = 100

Listener

colorSeekBar.setOnColorChangeListener { progress, color ->
    Log.i("TAG", "===progress:$progress-color:$color===")
}

alphaSeekBar.setOnAlphaChangeListener { progress, alpha ->
    Log.i("AlphaSeekBarFragment", "===progress:$progress-alpha:$alpha===")
}

Thumb Drawer

  • com.rtugeek.android.colorseekbar.thumb.DefaultThumbDrawer
  • com.rtugeek.android.colorseekbar.thumb.DrawableThumbDrawer - Load thumb from drawable resource
  • com.rtugeek.android.colorseekbar.thumb.ThumbDrawer - Implement this interface if you want to customize thumb

Vertical Bar

<com.rtugeek.android.colorseekbar.ColorSeekBar 
    android:id="@+id/colorSlider"
    android:layout_width="match_parent" 
    app:colorSeeds="@array/material_colors"
    app:colorSeekBarVertical="true" 
    android:layout_height="wrap_content" />

Spread the word

License

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                Version 2, December 2004

Copyright (C) 2004 Leon Fu <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.

colorseekbar's People

Contributors

bryant1410 avatar lemaneh avatar rtugeek avatar subhamtyagi avatar tobaloidee 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

colorseekbar's Issues

colorBarPosition doesn't work since v1.1.2

Hey. I've been using the library since the v.1.0.2 update. My XML was looking like this one, and it was working as expected:

<com.rtugeek.android.colorseekbar.ColorSeekBar
        android:id="@+id/colorSeekbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        app:color="@array/wheel_colors_7"
        app:maxValue="6"
        app:barHeight="8dp"
        app:colorBarValue="3"/>

However, after updating to the v1.1.2, I changed the XML to works with the latest changes:

<com.rtugeek.android.colorseekbar.ColorSeekBar
        android:id="@+id/colorSeekbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        app:colorSeeds="@array/wheel_colors_7"
        app:maxPosition="6"
        app:barHeight="8dp"
        app:colorBarPosition="3"/>

Then I see that app:colorBarPosition is not working properly, showing "0" as the initial position when a ColorSeekBar is displayed.

Custom Colours

How to create our own colours to the colour seek bar?

Won't link... "failed to resolve 'com.rtugeek.android:colorseekbar:1.0.0'"

Realizing this is a new repo/release...

I just ran across this control, which was exactly what I'm looking for (a very low-profile slider for picking colors I can use in a list). I'm just getting my feet wet with Android, so maybe I'm missing something, but it looks like you are referencing release '1.0.0' in the gradle dependencies, but jitpack.io requires that be an existing release in your github repo... There isn't a release 1.0.0 yet. I tried the "short hash" that jitpack mentions as well, but couldn't get that to work either (I probably am misunderstanding what that is)...

Here is the gradle output.

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.rtugeek.android:colorseekbar:1.0.0.
Searched in the following locations:
https://jitpack.io/com/rtugeek/android/colorseekbar/1.0.0/colorseekbar-1.0.0.pom
https://jitpack.io/com/rtugeek/android/colorseekbar/1.0.0/colorseekbar-1.0.0.jar
Required by:
SampleApplication:app:unspecified

Thoughts? Thanks!!

How to get color by progress value?

Hi ,
I use your library for calculation of color by average of between min value and max value.
I don't know how to get color by progress value.

colorSeekBar.setMaxProgress(8); // app crush when setMaxProgress programitcally

int color = colorSeekBar.getColorByProgressvalue(5) ?????

setColorSeeds(int[] colors) not working?

In version 1.0.2 i used to set seekbar color by setColors(int[] colors), but in version 1.4.3 setColorSeeds() not working anymore.. It change just thumb color of seek bar.
Any reason for that?

width and height must be > 0

relevant xml:

                <com.rtugeek.android.colorseekbar.ColorSeekBar
                    android:id="@+id/colorSlider"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:colors="@array/material_colors"
                    />

java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:830) at android.graphics.Bitmap.createBitmap(Bitmap.java:809) at android.graphics.Bitmap.createBitmap(Bitmap.java:776) at com.rtugeek.android.colorseekbar.ColorSeekBar.onSizeChanged(ColorSeekBar.java:174) at android.view.View.sizeChange(View.java:16757) at android.view.View.setFrame(View.java:16719) at android.view.View.layout(View.java:16636) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)

Enable\Disable ColorSeekBar

I want to disable the colorseekbar when there is some method calls and enable after that work done how can i prevent user to seek colorseekbar?

i tried the setEnabled(boolean enable); but it not works in colorseekbar.

getColorIndexPosition always returns -1

Set up ColorSeekBar like so.

private void setUpColorPicker() {
        colorSlider.setMaxPosition(100);
        colorSlider.setColorSeeds(R.array.material_colors);
        colorSlider.setColorBarPosition(0);
        colorSlider.setBarHeight(5);
        colorSlider.setThumbHeight(30);
        this.color = colorSlider.getColor();

        colorSlider.setOnColorChangeListener(new ColorSeekBar.OnColorChangeListener() {
            @Override
            public void onColorChangeListener(int colorBarPosition, int alphaBarPosition, int color) {
                CourseManageFragment.this.color = color;
            }
        });
    }

// Starts another activity then returns.
// Call the following methods

// Where color is a valid color from above ColorSeekBar
int pos = colorSlider.getColorIndexPosition(course.getColor()); // Always returns -1
colorSlider.setColorBarPosition(pos);

Color Black

There is no option to get the black color !!!?

Custom slider

Add a method to customize the slider setDrawable(int drawable) and setDrawable(Drawable drawable)

java.lang.IllegalArgumentException: width and height must be > 0 - vers.1.4.2

I tried using version 1.4.3, but not resolving it. More recent version I can compile against is 1.4.2, that gives me this error. Switching back to 1.2.2, everything is fine. I make plain usage in XML:

<com.rtugeek.android.colorseekbar.ColorSeekBar
android:id="@+id/colorSliderStop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/stopLabel"
app:colorSeeds="@array/t16_color_slider"
/>

Logo design proposal

Greetings @rtugeek Sir, I am a graphic designer and an open source contributor. I would like to contribute to your good project by designing a logo for it which will add more visibility and interest from the users. I will be doing it for free as my gift to your project. If you permit me i will start immediately and show you my output here. Thanks and best regards!

-Tobaloidee

about the setOnColorChangeListener callback

Is it possible to return a value to the listener callback method to determine whether it is the value of the user's manual sliding, or the value of the callback through setColorSeeds()

Set thumb at particular color

I have a color (rgb) and I need to set the thumb at that color?

I have tried to loop over until I find the thumb at that color, like:

mRgbSeekbar.setMaxValue(100);
 private void findSeekBarRgb(int rgb) {
            int current = 0;
            while(current <= 100){
                mRgbSeekBar.setColorBarValue(current);
                int color = mRgbSeekBar.getColor();
                if(rgb == color) return;
                current++;
            }
        }

Is there any convenient method?

Alpha Seekbar Issue

If alpha seekbar is seeked to above max value and below min value , text attains full transparent and full visibility respectively

Add option to lock thumb

Hey!

Thanks for this nice library!!

I'm using it to display temperature values. Therefore it would be great to be able to lock the thumb at set position. Any chance to implement this?

Thanks,
Rob

AlphaBar minimum position

Hi, this is awesome library for color seekbar. i am using library in my project. every thing is working awesome but i am stuck on a point. the point is can we set alpha bar minimum position. i don't want to allow user to set alpha bar position below 70. Is there any way to set alphabar minimum thumb position to 70.

Thanks in advance

bar radius

very thanks for this library.
Control's bar rounded Angle Settings?

Add option to change ColorBar color on new colorSeeds

Hi there! I was trying to build an app with two ColorSeekBars - one to control the hue of my view and one to control the saturation. When I change my hue colorSeekBar, the colorSeeds of my saturation colorSeekBar change to (Color.WHITE, hueSeekBar.getColor()). This works well, but when I try dragging the saturationSeekBar, the color of the thumb remains unchanged (the original value). How would I go about doing this? Thank you!

App

How I can set the thumb to desired position without moving?

We are using this for ruler purpose and need to show thumb on desired position.
For example, I have set minimum value 300 and maximum value 800. Based on some calculation I get some random number between 300-800. So I want to set this value on seekbar.

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.