├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── demo ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-hdpi-v9 │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-mdpi-v9 │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-hdpi-v11 │ │ │ ├── ic_menu_color_palette.png │ │ │ └── ic_menu_color_palette_holo_light.png │ │ ├── drawable-mdpi-v11 │ │ │ ├── ic_menu_color_palette.png │ │ │ └── ic_menu_color_palette_holo_light.png │ │ ├── drawable-xhdpi-v11 │ │ │ ├── ic_menu_color_palette.png │ │ │ └── ic_menu_color_palette_holo_light.png │ │ ├── drawable-xhdpi-v21 │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-xxhdpi-v21 │ │ │ └── ic_menu_color_palette.png │ │ ├── drawable-xxxhdpi-v21 │ │ │ └── ic_menu_color_palette.png │ │ ├── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── menu │ │ │ └── main.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── layout │ │ │ ├── dialog_about.xml │ │ │ └── activity_color_picker.xml │ │ ├── xml │ │ │ └── main.xml │ │ ├── layout-v11 │ │ │ └── activity_color_picker.xml │ │ └── layout-v21 │ │ │ └── activity_color_picker.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── github │ │ └── danielnilsson9 │ │ └── colorpickerview │ │ └── demo │ │ ├── ColorPickerActivity.java │ │ ├── AboutDialog.java │ │ └── MainActivity.java ├── build.gradle ├── proguard-rules.pro └── demo.iml ├── color-picker-view ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values-sw400dp │ │ │ ├── dimen.xml │ │ │ └── styles.xml │ │ ├── values-sw360dp │ │ │ ├── dimen.xml │ │ │ └── styles.xml │ │ ├── values-sw600dp │ │ │ └── styles.xml │ │ ├── layout │ │ │ ├── colorpickerview__preference_preview_layout.xml │ │ │ └── colorpickerview__dialog_color_picker.xml │ │ ├── values │ │ │ ├── ids.xml │ │ │ ├── attrs.xml │ │ │ ├── dimen.xml │ │ │ └── styles.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ └── drawable │ │ │ ├── colorpickerview__btn_background_pressed.xml │ │ │ └── colorpickerview__btn_background.xml │ │ └── java │ │ └── com │ │ └── github │ │ └── danielnilsson9 │ │ └── colorpickerview │ │ ├── view │ │ ├── DrawingUtils.java │ │ ├── ColorPanelView.java │ │ └── ColorPickerView.java │ │ ├── preference │ │ └── ColorPreference.java │ │ ├── drawable │ │ └── AlphaPatternDrawable.java │ │ └── dialog │ │ └── ColorPickerDialogFragment.java ├── proguard-rules.pro ├── build.gradle ├── bintrayupl.gradle ├── library.iml └── color-picker-view.iml ├── settings.gradle ├── ic_menu_color_palette.zip ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── ColorPickerView.iml ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /.idea/.name: -------------------------------------------------------------------------------- 1 | ColorPickerView -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /color-picker-view/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':color-picker-view', ':demo' 2 | 3 | -------------------------------------------------------------------------------- /ic_menu_color_palette.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/ic_menu_color_palette.zip -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-hdpi/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-mdpi/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi-v9/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-hdpi-v9/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi-v9/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-mdpi-v9/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi-v11/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-hdpi-v11/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi-v11/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-mdpi-v11/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi-v11/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xhdpi-v11/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi-v21/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xhdpi-v21/ic_menu_color_palette.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxhdpi-v21/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xxhdpi-v21/ic_menu_color_palette.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xxxhdpi-v21/ic_menu_color_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xxxhdpi-v21/ic_menu_color_palette.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /color-picker-view/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable-hdpi-v11/ic_menu_color_palette_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-hdpi-v11/ic_menu_color_palette_holo_light.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-mdpi-v11/ic_menu_color_palette_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-mdpi-v11/ic_menu_color_palette_holo_light.png -------------------------------------------------------------------------------- /demo/src/main/res/drawable-xhdpi-v11/ic_menu_color_palette_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danielnilsson9/color-picker-view/HEAD/demo/src/main/res/drawable-xhdpi-v11/ic_menu_color_palette_holo_light.png -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ColorPickerView Demo 5 | Settings 6 | 7 | 8 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-sw400dp/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 70dp 5 | 40dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-sw400dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-sw360dp/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 65dp 5 | 40dp 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-sw600dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/layout/colorpickerview__preference_preview_layout.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-sw360dp/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6dp 5 | 6 | 65dp 7 | 32dp 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/drawable/colorpickerview__btn_background_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /demo/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/drawable/colorpickerview__btn_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "23.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.github.danielnilsson9.colorpickerview.demo" 9 | minSdkVersion 15 10 | targetSdkVersion 22 11 | versionCode 4 12 | versionName "1.4.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile project(':color-picker-view') 25 | } 26 | -------------------------------------------------------------------------------- /demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /color-picker-view/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /color-picker-view/src/main/java/com/github/danielnilsson9/colorpickerview/view/DrawingUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.danielnilsson9.colorpickerview.view; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | import android.util.TypedValue; 6 | 7 | public class DrawingUtils { 8 | 9 | public static int dpToPx(Context c, float dipValue) { 10 | DisplayMetrics metrics = c.getResources().getDisplayMetrics(); 11 | 12 | float val = TypedValue.applyDimension( 13 | TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics); 14 | 15 | // Round 16 | int res = (int)(val + 0.5); 17 | 18 | // Ensure at least 1 pixel if val was > 0 19 | if(res == 0 && val > 0) { 20 | res = 1; 21 | } 22 | 23 | return res; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /color-picker-view/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | 11 | 12 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ColorPickerView.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /color-picker-view/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | android { 5 | compileSdkVersion 22 6 | buildToolsVersion "23.0.0" 7 | resourcePrefix "colorpickerview__" 8 | 9 | defaultConfig { 10 | minSdkVersion 15 11 | targetSdkVersion 22 12 | versionCode 4 13 | versionName "1.4.0" 14 | } 15 | buildTypes { 16 | } 17 | } 18 | 19 | dependencies { 20 | compile fileTree(dir: 'libs', include: ['*.jar']) 21 | } 22 | 23 | ext { 24 | bintrayRepo = 'maven' 25 | bintrayName = 'color-picker-view' 26 | 27 | publishedGroupId = 'com.github.danielnilsson9' 28 | libraryName = 'ColorPickerView' 29 | artifact = 'color-picker-view' 30 | 31 | libraryDescription = 'A simple good looking color picker component for Android.' 32 | 33 | siteUrl = 'https://github.com/danielnilsson9/color-picker-view' 34 | gitUrl = 'https://github.com/danielnilsson9/color-picker-view.git' 35 | 36 | libraryVersion = '1.4.0' 37 | 38 | developerId = 'danielnilsson9' 39 | developerName = 'Daniel Nilsson' 40 | developerEmail = 'daniel.nilsson.9@gmail.com' 41 | 42 | licenseName = 'The Apache Software License, Version 2.0' 43 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 44 | allLicenses = ["Apache-2.0"] 45 | } 46 | 47 | apply from: 'bintrayupl.gradle' -------------------------------------------------------------------------------- /demo/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 25 | 26 | 30 | 31 | 32 | 38 | 39 | 45 | 46 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/dialog_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 18 | 19 | 30 | 31 | 39 | 40 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /demo/src/main/res/xml/main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 29 | 33 | 34 | 35 | 36 | 39 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /color-picker-view/bintrayupl.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.github.dcendents.android-maven' 2 | apply plugin: 'com.jfrog.bintray' 3 | 4 | version = libraryVersion 5 | group = publishedGroupId // Maven Group ID for the artifact 6 | 7 | 8 | install { 9 | repositories.mavenInstaller { 10 | // This generates POM.xml with proper parameters 11 | pom { 12 | project { 13 | packaging 'aar' 14 | groupId publishedGroupId 15 | artifactId artifact 16 | 17 | // Add your description here 18 | name libraryName 19 | description libraryDescription 20 | url siteUrl 21 | 22 | // Set your license 23 | licenses { 24 | license { 25 | name licenseName 26 | url licenseUrl 27 | } 28 | } 29 | developers { 30 | developer { 31 | id developerId 32 | name developerName 33 | email developerEmail 34 | } 35 | } 36 | scm { 37 | connection gitUrl 38 | developerConnection gitUrl 39 | url siteUrl 40 | 41 | } 42 | } 43 | } 44 | } 45 | } 46 | 47 | 48 | 49 | task sourcesJar(type: Jar) { 50 | from android.sourceSets.main.java.srcDirs 51 | classifier = 'sources' 52 | } 53 | 54 | task javadoc(type: Javadoc) { 55 | source = android.sourceSets.main.java.srcDirs 56 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 57 | } 58 | 59 | task javadocJar(type: Jar, dependsOn: javadoc) { 60 | classifier = 'javadoc' 61 | from javadoc.destinationDir 62 | } 63 | artifacts { 64 | archives javadocJar 65 | archives sourcesJar 66 | } 67 | 68 | // Bintray 69 | Properties properties = new Properties() 70 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 71 | 72 | bintray { 73 | user = properties.getProperty("bintray.user") 74 | key = properties.getProperty("bintray.apikey") 75 | 76 | configurations = ['archives'] 77 | pkg { 78 | repo = bintrayRepo 79 | name = bintrayName 80 | desc = libraryDescription 81 | websiteUrl = siteUrl 82 | vcsUrl = gitUrl 83 | licenses = allLicenses 84 | publish = true 85 | publicDownloadNumbers = true 86 | } 87 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ColorPickerView 2 | ##### A simple good looking color picker component for Android 3 | 4 | A color picker is something that has always been missing from the standard set of components which developers can build their user interface in Android with. This is a color picker which I wrote for one of my own project which I decided to release as open source. 5 | 6 | ### Screenshots 7 | Screenshot1 8 | Screenshot2 9 | 10 | ### How to use 11 | The library is on jcenter. If you are using Android studio (and gradle), just add this line to your module 12 | build.gradle file under dependencies: 13 | 14 | ````gradle 15 | dependencies { 16 | compile "com.github.danielnilsson9:color-picker-view:1.4.0@aar" 17 | } 18 | ```` 19 | 20 | For doumentation about how to use the library, check the demo app included in this project. 21 | 22 | There are basicly three different ways to use this color picker. You can add it to your preferences using the ColorPreference class. You can also use it as a DialogFragment using the ColorPickerDialogFragment. Or you can simply use the ColorPickerView to add the color picker anywhere you want in you application. All three cases are demonstrated in the demo app, please refer to the demo for more information. 23 | 24 | ### Changelog 25 | 26 | ##### Version 1.4.0 27 | - Change of package name due to problem with jcenter publish. New package name is: com.github.danielnilsson9.colorpickerview, sorry for the inconvenience. 28 | - Fix for project could not be built due to obsolet android build tool version used. 29 | 30 | ##### Version 1.3.0 31 | - Bugfix: Selected Hue value in hue panel did not perfectly match what was shown in in the Saturation/Value panel. 32 | - Bugfix: Layout issues on sw320dp displays. 33 | - Bugfix: Title could not be changed or removed in ColorPickerDialogFragment. 34 | 35 | ##### Version 1.2.0 36 | - Api level 13 (Android 3.2) is now required by the library. 37 | - The ColorPickerDialog which was based on an AlertDialog has been replaced by ColorPickerDialogFragment which is based on a DialogFragment. 38 | - New layout on the color picker dialog, should look good on all screen sizes and orientations. 39 | - ColorPickerPreferences was replaced by ColorPreference. The ColorPreference does NOT take care of showing the ColorPickerDialogFragment, you will have to do that yourself, see the demo app. This is due to the fact that we don't have access to the fragment manager from the Preference class. 40 | - ColorPickerView now automatically saves it state on orientation change etc. 41 | -------------------------------------------------------------------------------- /demo/src/main/java/com/github/danielnilsson9/colorpickerview/demo/ColorPickerActivity.java: -------------------------------------------------------------------------------- 1 | package com.github.danielnilsson9.colorpickerview.demo; 2 | 3 | import com.github.danielnilsson9.colorpickerview.view.ColorPanelView; 4 | import com.github.danielnilsson9.colorpickerview.view.ColorPickerView; 5 | import com.github.danielnilsson9.colorpickerview.view.ColorPickerView.OnColorChangedListener; 6 | import android.app.Activity; 7 | import android.content.SharedPreferences; 8 | import android.graphics.PixelFormat; 9 | import android.os.Bundle; 10 | import android.preference.PreferenceManager; 11 | import android.view.View; 12 | import android.widget.Button; 13 | import android.widget.LinearLayout; 14 | 15 | public class ColorPickerActivity extends Activity implements OnColorChangedListener, View.OnClickListener { 16 | 17 | private ColorPickerView mColorPickerView; 18 | private ColorPanelView mOldColorPanelView; 19 | private ColorPanelView mNewColorPanelView; 20 | 21 | private Button mOkButton; 22 | private Button mCancelButton; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | getWindow().setFormat(PixelFormat.RGBA_8888); 28 | 29 | setContentView(R.layout.activity_color_picker); 30 | 31 | init(); 32 | 33 | } 34 | 35 | private void init() { 36 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 37 | int initialColor = prefs.getInt("color_3", 0xFF000000); 38 | 39 | mColorPickerView = (ColorPickerView) findViewById(R.id.colorpickerview__color_picker_view); 40 | mOldColorPanelView = (ColorPanelView) findViewById(R.id.colorpickerview__color_panel_old); 41 | mNewColorPanelView = (ColorPanelView) findViewById(R.id.colorpickerview__color_panel_new); 42 | 43 | mOkButton = (Button) findViewById(R.id.okButton); 44 | mCancelButton = (Button) findViewById(R.id.cancelButton); 45 | 46 | 47 | ((LinearLayout) mOldColorPanelView.getParent()).setPadding( 48 | mColorPickerView.getPaddingLeft(), 0, 49 | mColorPickerView.getPaddingRight(), 0); 50 | 51 | 52 | mColorPickerView.setOnColorChangedListener(this); 53 | mColorPickerView.setColor(initialColor, true); 54 | mOldColorPanelView.setColor(initialColor); 55 | 56 | mOkButton.setOnClickListener(this); 57 | mCancelButton.setOnClickListener(this); 58 | 59 | } 60 | 61 | @Override 62 | public void onColorChanged(int newColor) { 63 | mNewColorPanelView.setColor(mColorPickerView.getColor()); 64 | } 65 | 66 | @Override 67 | public void onClick(View v) { 68 | 69 | switch(v.getId()) { 70 | case R.id.okButton: 71 | SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(this).edit(); 72 | edit.putInt("color_3", mColorPickerView.getColor()); 73 | edit.commit(); 74 | 75 | finish(); 76 | break; 77 | case R.id.cancelButton: 78 | finish(); 79 | break; 80 | } 81 | 82 | } 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /demo/src/main/java/com/github/danielnilsson9/colorpickerview/demo/AboutDialog.java: -------------------------------------------------------------------------------- 1 | package com.github.danielnilsson9.colorpickerview.demo; 2 | 3 | 4 | import android.app.AlertDialog; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.content.SharedPreferences; 8 | import android.content.pm.PackageInfo; 9 | import android.content.pm.PackageManager.NameNotFoundException; 10 | import android.preference.PreferenceManager; 11 | import android.text.Html; 12 | import android.view.LayoutInflater; 13 | import android.view.View; 14 | import android.widget.ImageView; 15 | import android.widget.TextView; 16 | import android.widget.Toast; 17 | 18 | 19 | public class AboutDialog extends AlertDialog { 20 | 21 | private ImageView mIconView; 22 | private TextView mAppNameText; 23 | private TextView mAboutText; 24 | private TextView mVersionText; 25 | 26 | 27 | public AboutDialog(Context context) { 28 | super(context); 29 | 30 | LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 31 | View layout = inflater.inflate(R.layout.dialog_about, null); 32 | 33 | mAboutText = (TextView) layout.findViewById(android.R.id.text2); 34 | mVersionText = (TextView) layout.findViewById(android.R.id.text1); 35 | mAppNameText = (TextView) layout.findViewById(android.R.id.title); 36 | mIconView = (ImageView) layout.findViewById(android.R.id.icon); 37 | 38 | setView(layout); 39 | 40 | loadAbout(); 41 | 42 | setTitle("About"); 43 | 44 | 45 | 46 | mIconView.setOnClickListener(new View.OnClickListener() { 47 | 48 | int mClickCount = 0; 49 | 50 | @Override 51 | public void onClick(View v) { 52 | mClickCount++; 53 | 54 | if(mClickCount == 5) { 55 | Toast.makeText(getContext(), "Upgraded to Pro Version!", Toast.LENGTH_SHORT).show(); 56 | 57 | new Thread(new Runnable() { 58 | 59 | @Override 60 | public void run() { 61 | SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(getContext()).edit(); 62 | edit.putBoolean("is_pro", true); 63 | edit.commit(); 64 | } 65 | 66 | }).start(); 67 | 68 | 69 | } 70 | 71 | } 72 | }); 73 | 74 | 75 | 76 | setButton(DialogInterface.BUTTON_POSITIVE, getContext().getString(android.R.string.ok), new DialogInterface.OnClickListener() { 77 | 78 | @Override 79 | public void onClick(DialogInterface dialog, int which) { 80 | dialog.dismiss(); 81 | } 82 | }); 83 | 84 | } 85 | 86 | private void loadAbout(){ 87 | 88 | PackageInfo pi = null; 89 | try { 90 | pi = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0); 91 | } catch (NameNotFoundException e) { 92 | e.printStackTrace(); 93 | } 94 | 95 | mAppNameText.setText("ColorPickerView"); 96 | mVersionText.setText("Version" + " " + (pi != null ? pi.versionName : "null")); 97 | 98 | String s = "Developed By:
Daniel Nilsson
"; 99 | mAboutText.setText(Html.fromHtml(s)); 100 | 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_color_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 15 | 16 | 21 | 22 | 30 | 31 | 36 | 37 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 62 | 63 |