Multi-ColorPicker


Source link: https://github.com/skydoves/Multi-ColorPicker

Multi-ColorPicker

You can get colors from your gallery pictures or custom images just using touch with multi-selectors.

Examples

Including in your project

build.gradle

repositories {

mavenCentral() // or jcenter() works as well 
}
  dependencies {

compile 'com.github.skydoves:multicolorpicker:1.0.5' 
}

or Maven

<dependency>
<groupId>com.github.skydoves</groupId>
<artifactId>multicolorpicker</artifactId>
<version>1.0.5</version> </dependency>

How to use

You can use like using just ImageView and you can get colors from any images.

Add XML Namespace

First add below XML Namespace inside your XML layout file.

xmlns:app="http://schemas.android.com/apk/res-auto"

ColorPickerView in layout

<com.skydoves.multicolorpicker.MultiColorPickerView

android:id="@+id/multiColorPickerView"

android:layout_width="300dp"

android:layout_height="300dp"

app:palette="@drawable/palette"/>

Attribute in xml

app:palette="@drawable/palette" // set palette image 

get Colors from Listener

multiColorPickerView.addSelector(selectorDrawable, new ColorListener() {

 @Override

 public void onColorSelected(ColorEnvelope envelope) {

  int color = envelope.getColor();

  int[] rgb = envelope.getRgb();

  String htmlCode = envelope.getHtmlCode();

// TODO

 
}

}
);

MultiColorPickerView Methods

Methods Return Description
addSelector(Drawable drawable, ColorListener listener) Selector adds a Selector and returning it
setPaletteDrawable(Drawable drawable) void changes palette's drawable
getMixedColor(Float ratio(0~1)) void returns mixed color from selectors seleted color
setSelectedAlpha(Float ratio(0~1) void sets active selector's alpha
getSelectorsSize() int returns selectors size
setFlagView(FlagView flagView) void sets a FlagView on colorpicker
setFlagMode(FlagMode flagmode) void sets FlagMode(Always, Last, None)
setFlagFlipable(boolean flipable) void sets flag's flip-able when flag go over top boundary

Selector Methods

Methods Return Description
getX() int returns selector's X axis
getY() int returns selector's Y axis
getColor() int returns the selector's selected color
getColorHtml() String returns the selector's selected color html code
getColorRGB() int[3] returns the selector's selected color rgb array
onMove(int x, int y) void moves the selector's point
onMoveCenter() void moves the selector's point to center
onSelect() void selects point at selector's position (used with onMove())
onSelect(int x, int y) void moves and selects point

License

Copyright 2017 skydoves  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.

Resources

Lightweight thrift client code generator and runtime library for Android and Java.

ListView with a sticky header.

Simple tool which help you to implement A/B Test.

A Gradle plugin that allows you to use Facebook's Redex tool as part of your build process.

Live Audio Equalizer with wave effect.

Awesome Audio Widget for any Android Music App.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes