Giter VIP home page Giter VIP logo

androidphotoshopcolorpicker's Introduction

AndroidPhotoshopColorPicker

Android Arsenal

A full featured Color picker Library for Android! Just like the one in Photoshop!

Features

  • Hue bar - Adjust hue using a slider
  • Saturation & Value Box - Select the color from the Saturation & Value Box (like in Photoshop)
  • Alpha bar - Adjust the alpha using a slider
  • Preview - You can see the current selected and previously picked colors side-by-side
  • Edit each component individually - You can edit Hue, Saturation, Value, Red, Green and Blue components individually
  • Fully customizable - By default, there are two themes(Light and Dark). But you can define your own theme to customize the whole ColorPicker
  • Easy to use - All the hardwork is done by us. Just a few lines of code is all you have to do

Requirements

Tested with APIv11, but will most probably work with earlier versions as well.

Installation (Adding to your project)

The library is posted on jcenter. So, just the following code should be enough to get you started:

Place this in your app module's build.gradle file:

    dependencies {
      compile 'com.azeesoft.lib.colorpicker:colorpicker:1.0.8@aar'
    }

If there is any error while building the project using the above mentioned step, add the following code in that build.gradle file and build again:

    repositories {
        maven {
            url 'https://dl.bintray.com/azeesoft/maven'
        }
    }

After successful build, you can use ColorPickerDialog as a part of your project.

Usage

  1. Create a new ColorPickerDialog object using the static method createColorPickerDialog()

To create a default ColorPickerDialog with Light theme, use

        ColorPickerDialog colorPickerDialog= ColorPickerDialog.createColorPickerDialog(this);

To create a ColorPickerDialog with Dark theme, use

        ColorPickerDialog colorPickerDialog= ColorPickerDialog.createColorPickerDialog(this,ColorPickerDialog.DARK_THEME);
  1. Set an OnColorPickedListener to call when the color is picked:
        colorPickerDialog.setOnColorPickedListener(new ColorPickerDialog.OnColorPickedListener() {
            @Override
            public void onColorPicked(int color, String hexVal) {
                //Your code here
            }
        });
  1. Customize the colorPickerDialog if needed using appropriate methods and show the dialog:
        colorPickerDialog.setHexaDecimalTextColor(Color.parse("#ffffff")); //There are many functions like this
        colorPickerDialog.show();
  1. To create a ColorPickerDialog with Custom theme, create a new style with any of the ColorPicker themes as parent and use the following attributes:
  • cp_showOpacityBar (boolean) : Show/Hide Opacity Bar
  • cp_showHexaDecimalValue (boolean) : Show/Hide Hexadecimal Value
  • cp_showColorComponentsInfo (boolean) : Show/Hide Color components information(HSV, RGB, Alpha)
  • cp_backgroundColor (color) : Background color for the dialog
  • cp_hexaDecimalTextColor (color) : Text color for the Hexadecimal value
  • cp_colorComponentsTextColor (color) : Text color for the Color components information(HSV, RGB, Alpha)
  • cp_positiveActionTextColor (color) : Text color for the Positive Action
  • cp_negativeActionTextColor (color) : Text color for the Negative Action
  • cp_sliderThumbColor (color) : Color for the thumb of the slider of Hue bar and Opacity bar

Use any of the following as parent:

  • ColorPicker
  • ColorPicker.Dark
  • ColorPicker.Light

For eg:

styles.xml:

    <style name="CustomColorPicker" parent="ColorPicker">
        <item name="cp_backgroundColor">#4745e5</item>
        <item name="cp_hexaDecimalTextColor">#000046</item>
        <item name="cp_colorComponentsTextColor">#fff</item>
        <item name="cp_positiveActionTextColor">@color/colorAccent</item>
        <item name="cp_negativeActionTextColor">@color/colorPrimaryDark</item>
        <item name="cp_sliderThumbColor">#accc</item>
    </style>

In Java:

    ColorPickerDialog colorPickerDialog = ColorPickerDialog.createColorPickerDialog(this,R.style.CustomColorPicker);
    colorPickerDialog.setOnColorPickedListener(new ColorPickerDialog.OnColorPickedListener() {
        @Override
        public void onColorPicked(int color, String hexVal) {
            System.out.println("Got color: " + color);
            System.out.println("Got color in hex form: " + hexVal);
            
            // Make use of the picked color here
        }
    });
    colorPickerDialog.show();

Screenshots

androidphotoshopcolorpicker's People

Contributors

aziztitu 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

androidphotoshopcolorpicker's Issues

JCenter is obsolete.

JCenter is obsolete. Can this be loaded into a different repository?

That would be much appreciated

Error retrieving parent for item: No resource found that matches the given name

when I add the library I receive this Errors:

`Information:Gradle tasks [:generateDebugSources, :generateDebugAndroidTestSources, :mockableAndroidJar, :prepareDebugUnitTestDependencies]
C:\Users\myname\Desktop\Games\KIDS\build\intermediates\res\merged\debug\values\values.xml
Error:(91) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Error:(95, 21) No resource found that matches the given name: attr 'colorAccent'.
Error:(93, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(94, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(97) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
Error:(99, 21) No resource found that matches the given name: attr 'windowActionBar'.
Error:(100, 21) No resource found that matches the given name: attr 'windowNoTitle'.
Error:(102) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
Error:(108) Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light.Dialog'.
Error:(116) Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light.Dialog'.
Error:(91) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Error:(95, 21) No resource found that matches the given name: attr 'colorAccent'.
Error:(93, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(94, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(97) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
Error:(99, 21) No resource found that matches the given name: attr 'windowActionBar'.
Error:(100, 21) No resource found that matches the given name: attr 'windowNoTitle'.
Error:(102) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
Error:(108) Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light.Dialog'.
Error:(116) Error retrieving parent for item: No resource found that matches the given name 'Base.Theme.AppCompat.Light.Dialog'.
Error:Execution failed for task ':processDebugResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt
Information:BUILD FAILED
Information:Total time: 1 mins 32.154 secs
Information:21 errors
Information:0 warnings
Information:See complete output in console`

com.azeesoft.lib.colorpicker.SatValPicker.refreshSatValPicker

Fatal Exception: java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3@c620e20 rejected from java.util.concurrent.ThreadPoolExecutor@32cdf3d9[Running, pool size = 9, active threads = 9, queued tasks = 128, completed tasks = 125]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:594)
at com.azeesoft.lib.colorpicker.SatValPicker.refreshSatValPicker(SourceFile:279)
at com.azeesoft.lib.colorpicker.ColorPickerDialog$3.onPicked(SourceFile:236)
at com.azeesoft.lib.colorpicker.HuePicker.setHue(SourceFile:85)
at com.azeesoft.lib.colorpicker.HuePicker$2.onProgressChanged(SourceFile:65)
at android.widget.SeekBar.onProgressRefresh(SeekBar.java:95)
at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:1353)
at android.widget.ProgressBar.refreshProgress(ProgressBar.java:1369)
at android.widget.ProgressBar.setProgress(ProgressBar.java:1416)
at android.widget.AbsSeekBar.setProgress(AbsSeekBar.java:1063)
at android.widget.AbsSeekBar.trackTouchEvent(AbsSeekBar.java:965)
at android.widget.AbsSeekBar.onTouchEvent(AbsSeekBar.java:865)
at com.azeesoft.lib.colorpicker.OrientedSeekBar.onTouchEvent(SourceFile:101)
at android.view.View.dispatchTouchEvent(View.java:9144)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at android.widget.ScrollView.dispatchTouchEvent(ScrollView.java:615)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2687)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2362)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2739)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1832)
at android.app.Dialog.dispatchTouchEvent(Dialog.java:956)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2700)
at android.view.View.dispatchPointerEvent(View.java:9354)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4976)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4737)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4269)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4322)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4288)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4414)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4296)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4471)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4269)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4322)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4288)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4296)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4269)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6866)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6747)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6718)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6956)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6927)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6979)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:558)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6862)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

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.