├── demo ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── colors.xml │ │ ├── drawable │ │ │ ├── ic_github_white_24dp.xml │ │ │ └── ic_palette_white_24dp.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── menu │ │ │ └── main.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── xml │ │ │ └── main.xml │ │ ├── layout │ │ │ └── activity_color_picker.xml │ │ └── layout-v21 │ │ │ └── activity_color_picker.xml │ │ ├── java │ │ └── com │ │ │ └── jaredrummler │ │ │ └── android │ │ │ └── colorpicker │ │ │ └── demo │ │ │ ├── DemoFragment.java │ │ │ ├── BasePreferenceFragment.java │ │ │ ├── ColorPickerActivity.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── jitpack.yml ├── library ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── cpv_alpha.png │ │ ├── drawable-xhdpi │ │ │ └── cpv_alpha.png │ │ ├── drawable-xxhdpi │ │ │ └── cpv_alpha.png │ │ ├── values │ │ │ ├── ids.xml │ │ │ ├── dimen.xml │ │ │ ├── styles.xml │ │ │ ├── strings.xml │ │ │ └── attrs.xml │ │ ├── drawable │ │ │ ├── cpv_ic_arrow_right_black_24dp.xml │ │ │ ├── cpv_preset_checked.xml │ │ │ ├── cpv_btn_background_pressed.xml │ │ │ └── cpv_btn_background.xml │ │ ├── layout │ │ │ ├── cpv_preference_circle.xml │ │ │ ├── cpv_preference_square.xml │ │ │ ├── cpv_preference_circle_large.xml │ │ │ ├── cpv_preference_square_large.xml │ │ │ ├── cpv_color_item_circle.xml │ │ │ ├── cpv_color_item_square.xml │ │ │ ├── cpv_dialog_presets.xml │ │ │ └── cpv_dialog_color_picker.xml │ │ ├── values-pt │ │ │ └── strings.xml │ │ ├── values-es │ │ │ └── strings.xml │ │ ├── values-ja │ │ │ └── strings.xml │ │ ├── values-zh │ │ │ └── strings.xml │ │ ├── values-it-rIT │ │ │ └── strings.xml │ │ ├── values-tr │ │ │ └── strings.xml │ │ ├── values-ar │ │ │ └── strings.xml │ │ ├── values-cs │ │ │ └── strings.xml │ │ ├── values-nl-rNL │ │ │ └── strings.xml │ │ ├── values-sk │ │ │ └── strings.xml │ │ ├── values-ru │ │ │ └── strings.xml │ │ ├── values-pl │ │ │ └── strings.xml │ │ ├── values-fr-rFR │ │ │ └── strings.xml │ │ └── values-de │ │ │ └── strings.xml │ │ └── java │ │ └── com │ │ └── jaredrummler │ │ └── android │ │ └── colorpicker │ │ ├── ColorShape.java │ │ ├── DrawingUtils.java │ │ ├── NestedGridView.java │ │ ├── ColorPickerDialogListener.java │ │ ├── AlphaPatternDrawable.java │ │ ├── ColorPaletteAdapter.java │ │ ├── ColorPreferenceCompat.java │ │ ├── ColorPreference.java │ │ ├── ColorPanelView.java │ │ └── ColorPickerView.java ├── proguard-rules.pro ├── gradle.properties └── build.gradle ├── settings.gradle ├── gradle.properties ├── art ├── demo.gif ├── screenshot1.png ├── screenshot2.png └── screenshot3.png ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── maven-push.gradle ├── .travis.yml ├── .gitignore ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':demo', ':library' 2 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true -------------------------------------------------------------------------------- /art/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/art/demo.gif -------------------------------------------------------------------------------- /art/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/art/screenshot1.png -------------------------------------------------------------------------------- /art/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/art/screenshot2.png -------------------------------------------------------------------------------- /art/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/art/screenshot3.png -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/library/src/main/res/drawable-hdpi/cpv_alpha.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/library/src/main/res/drawable-xhdpi/cpv_alpha.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/cpv_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zacharee/colorpicker/master/library/src/main/res/drawable-xxhdpi/cpv_alpha.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat May 21 15:54:16 EDT 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /library/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/cpv_ic_arrow_right_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/cpv_preset_checked.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/cpv_btn_background_pressed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_preference_circle.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_preference_square.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/res/values-pt/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Selecionar uma cor 5 | Predefinidos 6 | Personalizar 7 | Selecionar 8 | Transparência 9 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_preference_circle_large.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_preference_square_large.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Selecciona un color 5 | Predeterminados 6 | Personalizar 7 | Seleccionar 8 | Transparencia 9 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/cpv_btn_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6dp 4 | 66dp 5 | 34dp 6 | 58dp 7 | 50dp 8 | 8dp 9 | 28dp 10 | 40dp 11 | 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | android: 4 | components: 5 | - tools # Tools 6 | - platform-tools # Platform tools 7 | - build-tools-28.0.3 # Build tools version 8 | - android-28 # Target SDK version 9 | - extra-android-m2repository # Support repo 10 | - sys-img-armeabi-v7a-android-18 # Emulator 11 | 12 | jdk: 13 | - oraclejdk8 14 | 15 | script: 16 | - ./gradlew build 17 | 18 | branches: 19 | except: 20 | - gh-pages 21 | 22 | notifications: 23 | email: false 24 | 25 | sudo: false 26 | 27 | cache: 28 | directories: 29 | - $HOME/.gradle -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /library/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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ########### Specifies intentionally untracked files to ignore ########### 2 | 3 | ### Gradle 4 | .gradle/ 5 | build/ 6 | 7 | ### IntelliJ IDEA 8 | /.idea 9 | *.iml 10 | *.iws 11 | captures/ 12 | .navigation/ 13 | local.properties 14 | bin/ 15 | gen/ 16 | out/ 17 | *.apk 18 | *.ap_ 19 | 20 | ### Android 21 | *.jks 22 | *.dex 23 | 24 | ### Java 25 | *.class 26 | hs_err_pid* 27 | 28 | ### Windows 29 | Desktop.ini 30 | Thumbs.db 31 | ehthumbs.db 32 | 33 | ### OSX 34 | .DS_Store 35 | 36 | ### Linux 37 | *~ 38 | .fuse_hidden* 39 | .directory 40 | .Trash-* 41 | 42 | ### Logs 43 | *.log 44 | 45 | ### Crashlytics 46 | com_crashlytics_export_strings.xml 47 | crashlytics.properties 48 | crashlytics-build.properties 49 | fabric.properties 50 | -------------------------------------------------------------------------------- /library/gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.1.0 2 | VERSION_CODE=110 3 | GROUP=com.github.zacharee.colorpicker 4 | ARTIFACT_ID=library 5 | POM_NAME=library 6 | POM_ARTIFACT_ID=library 7 | POM_PACKAGING=aar 8 | POM_DESCRIPTION=A simple good looking color picker component for Android 9 | POM_URL=https://github.com/jaredrummler/ColorPicker 10 | POM_SCM_URL=https://github.com/jaredrummler/ColorPicker 11 | POM_SCM_CONNECTION=scm:git@github.com:jaredrummler/ColorPicker.git 12 | POM_SCM_DEV_CONNECTION=scm:git@github.com:jaredrummler/ColorPicker.git 13 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 14 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 15 | POM_LICENCE_DIST=repo 16 | POM_DEVELOPER_ID=jaredrummler 17 | POM_DEVELOPER_NAME=Jared Rummler 18 | SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots 19 | RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2 -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'maven-publish' 4 | 5 | group = 'com.github.zacharee.colorpicker' 6 | 7 | android { 8 | compileSdkVersion buildConfig.compileSdk 9 | defaultConfig { 10 | applicationId "com.jaredrummler.android.colorpicker.demo" 11 | minSdkVersion buildConfig.minSdk 12 | targetSdkVersion buildConfig.targetSdk 13 | versionCode 1 14 | versionName "1.0" 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | lintOptions { 23 | checkReleaseBuilds false 24 | abortOnError false 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation deps.androidx.appCompat 30 | implementation deps.androidx.preferences 31 | implementation project(':library') 32 | } 33 | -------------------------------------------------------------------------------- /demo/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 16dp 21 | 16dp 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_color_item_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 26 | 27 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_color_item_square.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 26 | 27 | -------------------------------------------------------------------------------- /demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | Color Picker 20 | Settings 21 | Color Picker Dialog 22 | GitHub 23 | 24 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | apply plugin: 'maven-publish' 4 | 5 | group = 'com.github.zacharee.colorpicker' 6 | 7 | android { 8 | compileSdkVersion buildConfig.compileSdk 9 | resourcePrefix "cpv_" 10 | defaultConfig { 11 | minSdkVersion buildConfig.minSdk 12 | targetSdkVersion buildConfig.targetSdk 13 | } 14 | lintOptions { 15 | abortOnError false 16 | } 17 | } 18 | 19 | afterEvaluate { 20 | publishing { 21 | publications { 22 | release(MavenPublication) { 23 | from components.release 24 | 25 | groupId = 'com.github.zacharee.colorpicker' 26 | artifactId = 'library' 27 | } 28 | } 29 | } 30 | } 31 | 32 | dependencies { 33 | implementation deps.androidx.appCompat 34 | implementation deps.androidx.preferences 35 | implementation deps.androidx.material 36 | } 37 | 38 | apply from: rootProject.file('gradle/maven-push.gradle') 39 | -------------------------------------------------------------------------------- /library/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaredrummler/android/colorpicker/ColorShape.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker; 18 | 19 | import androidx.annotation.IntDef; 20 | 21 | /** 22 | * The shape of the color preview 23 | */ 24 | @IntDef({ ColorShape.SQUARE, ColorShape.CIRCLE }) public @interface ColorShape { 25 | 26 | int SQUARE = 0; 27 | 28 | int CIRCLE = 1; 29 | } 30 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/ic_github_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | -------------------------------------------------------------------------------- /library/src/main/res/values-ja/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 色を選択 19 | プリセット 20 | カスタム 21 | 選択 22 | 透明度 23 | 24 | -------------------------------------------------------------------------------- /demo/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 22 | 64dp 23 | 24 | -------------------------------------------------------------------------------- /library/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 选择颜色 19 | 预置颜色 20 | 自定义颜色 21 | 确认 22 | 透明度 23 | 確認 24 | "重啟 " 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-it-rIT/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | Personalizzato 18 | Seleziona un Colore 19 | Predefiniti 20 | Seleziona 21 | Trasparenza 22 | Confermare 23 | Resettare 24 | 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-tr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | Renk Seçin 16 | Ön Ayarlar 17 | Özel 18 | Seç 19 | Şeffaflık 20 | Onaylamak 21 | Sıfırlamak 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | Select a Color 19 | Presets 20 | Custom 21 | Select 22 | Transparency 23 | Reset 24 | Confirm 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-ar/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | اختر لونًا 19 | ألوان جاهزة 20 | ألوان معدلة 21 | اختر 22 | الشفافية 23 | إعادة تعيين 24 | تؤكد 25 | 26 | -------------------------------------------------------------------------------- /library/src/main/res/values-cs/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | Vyberte barvu 19 | Přednastavené 20 | Vlastní 21 | Vybrat 22 | Průhlednost 23 | Resetovat 24 | Potvrdit 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-nl-rNL/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | Selecteer een kleur 16 | Vooraf ingesteld 17 | Aangepast 18 | Kiezen 19 | Transparantie 20 | Reset 21 | Bevestigen 22 | 23 | -------------------------------------------------------------------------------- /library/src/main/res/values-sk/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | Vyberte farbu 19 | Prednastavené 20 | Vlastné 21 | Vybrať 22 | Priehľadnosť 23 | Obnoviť 24 | Birmovať 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | Выберите цвет 19 | Предустановки 20 | Особый 21 | Выбрать 22 | Прозрачность 23 | Сброс 24 | Подтвердить 25 | 26 | -------------------------------------------------------------------------------- /library/src/main/res/values-pl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | Wybierz kolor 19 | Kolory domyślne 20 | Dostosuj 21 | Wybierz 22 | Przezroczystość 23 | Zresetować 24 | Potwierdzać 25 | -------------------------------------------------------------------------------- /library/src/main/res/values-fr-rFR/strings.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | Sélectionner une couleur 15 | Présélections 16 | Personnalisée 17 | Valider 18 | Transparence 19 | Confirmer 20 | Réinitialiser 21 | 22 | -------------------------------------------------------------------------------- /library/src/main/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | Farbe auswählen 18 | Voreinstellungen 19 | Benutzerdefiniert 20 | Auswählen 21 | Transparenz 22 | Zurücksetzen 23 | Bestätigen 24 | 25 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaredrummler/android/colorpicker/DrawingUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker; 18 | 19 | import android.content.Context; 20 | import android.util.DisplayMetrics; 21 | import android.util.TypedValue; 22 | 23 | final class DrawingUtils { 24 | 25 | static int dpToPx(Context c, float dipValue) { 26 | DisplayMetrics metrics = c.getResources().getDisplayMetrics(); 27 | float val = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics); 28 | int res = (int) (val + 0.5); // Round 29 | // Ensure at least 1 pixel if val was > 0 30 | return res == 0 && val > 0 ? 1 : res; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /demo/src/main/java/com/jaredrummler/android/colorpicker/demo/DemoFragment.java: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.android.colorpicker.demo; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | import androidx.preference.Preference; 6 | 7 | import com.jaredrummler.android.colorpicker.ColorPreferenceCompat; 8 | 9 | public class DemoFragment extends BasePreferenceFragment { 10 | 11 | private static final String TAG = "DemoFragment"; 12 | 13 | private static final String KEY_DEFAULT_COLOR = "default_color"; 14 | 15 | @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 16 | setPreferencesFromResource(R.xml.main, rootKey); 17 | 18 | // Example showing how we can get the new color when it is changed: 19 | ColorPreferenceCompat colorPreference = (ColorPreferenceCompat) findPreference(KEY_DEFAULT_COLOR); 20 | colorPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { 21 | @Override public boolean onPreferenceChange(Preference preference, Object newValue) { 22 | if (KEY_DEFAULT_COLOR.equals(preference.getKey())) { 23 | String newDefaultColor = Integer.toHexString((int) newValue); 24 | Log.d(TAG, "New default color is: #" + newDefaultColor); 25 | } 26 | return true; 27 | } 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /demo/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 23 | 24 | 30 | 35 | 36 | -------------------------------------------------------------------------------- /demo/src/main/res/drawable/ic_palette_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 32 | 33 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaredrummler/android/colorpicker/NestedGridView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.widget.GridView; 22 | import androidx.annotation.RestrictTo; 23 | 24 | @RestrictTo(RestrictTo.Scope.LIBRARY) public class NestedGridView extends GridView { 25 | 26 | public NestedGridView(Context context) { 27 | super(context); 28 | } 29 | 30 | public NestedGridView(Context context, AttributeSet attrs) { 31 | super(context, attrs); 32 | } 33 | 34 | public NestedGridView(Context context, AttributeSet attrs, int defStyle) { 35 | super(context, attrs, defStyle); 36 | } 37 | 38 | @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 39 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); 40 | super.onMeasure(widthMeasureSpec, expandSpec); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialogListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker; 18 | 19 | import androidx.annotation.ColorInt; 20 | 21 | /** 22 | * Callback used for getting the selected color from a color picker dialog. 23 | */ 24 | public interface ColorPickerDialogListener { 25 | 26 | /** 27 | * Callback that is invoked when a color is selected from the color picker dialog. 28 | * 29 | * @param dialogId The dialog id used to create the dialog instance. 30 | * @param color The selected color 31 | */ 32 | void onColorSelected(int dialogId, @ColorInt int color); 33 | 34 | /** 35 | * Callback that is invoked when the color picker dialog was dismissed. 36 | * 37 | * @param dialogId The dialog id used to create the dialog instance. 38 | */ 39 | void onDialogDismissed(int dialogId); 40 | 41 | /** 42 | * Callback that is invoked when the color of the dialog is reset. 43 | * @param dialogId 44 | * The dialog id used the create the dialog instance. 45 | */ 46 | void onColorReset(int dialogId); 47 | } 48 | -------------------------------------------------------------------------------- /demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /demo/src/main/java/com/jaredrummler/android/colorpicker/demo/BasePreferenceFragment.java: -------------------------------------------------------------------------------- 1 | package com.jaredrummler.android.colorpicker.demo; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Build; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import androidx.preference.Preference; 8 | import androidx.preference.PreferenceCategory; 9 | import androidx.preference.PreferenceFragmentCompat; 10 | import androidx.preference.PreferenceGroupAdapter; 11 | import androidx.preference.PreferenceScreen; 12 | import androidx.preference.PreferenceViewHolder; 13 | import androidx.recyclerview.widget.RecyclerView; 14 | 15 | // Fix for PreferenceFragmentCompat spacing. 16 | // 17 | // https://stackoverflow.com/questions/18509369 18 | // https://issuetracker.google.com/issues/111907042 19 | // https://issuetracker.google.com/issues/116170936 20 | // 21 | // I never wanted to support the preference fragment compat library. It sucks! 22 | // Give the developers what they want.. yeah.. your welcome. :P 23 | 24 | public abstract class BasePreferenceFragment extends PreferenceFragmentCompat { 25 | 26 | @Override protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { 27 | return new PreferenceGroupAdapter(preferenceScreen) { 28 | @SuppressLint("RestrictedApi") @Override public void onBindViewHolder(PreferenceViewHolder holder, int position) { 29 | super.onBindViewHolder(holder, position); 30 | Preference preference = getItem(position); 31 | if (preference instanceof PreferenceCategory) { 32 | setZeroPaddingToLayoutChildren(holder.itemView); 33 | } else { 34 | View iconFrame = holder.itemView.findViewById(R.id.icon_frame); 35 | if (iconFrame != null) { 36 | iconFrame.setVisibility(preference.getIcon() == null ? View.GONE : View.VISIBLE); 37 | } 38 | } 39 | } 40 | }; 41 | } 42 | 43 | private void setZeroPaddingToLayoutChildren(View view) { 44 | if (!(view instanceof ViewGroup)) return; 45 | ViewGroup viewGroup = (ViewGroup) view; 46 | int childCount = viewGroup.getChildCount(); 47 | for (int i = 0; i < childCount; i++) { 48 | setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); 49 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 50 | viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), 51 | viewGroup.getPaddingBottom()); 52 | } else { 53 | viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /demo/src/main/java/com/jaredrummler/android/colorpicker/demo/ColorPickerActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker.demo; 18 | 19 | import android.content.SharedPreferences; 20 | import android.graphics.PixelFormat; 21 | import android.os.Bundle; 22 | import android.preference.PreferenceManager; 23 | import android.view.View; 24 | import android.widget.Button; 25 | import android.widget.LinearLayout; 26 | import androidx.appcompat.app.AppCompatActivity; 27 | import com.jaredrummler.android.colorpicker.ColorPanelView; 28 | import com.jaredrummler.android.colorpicker.ColorPickerView; 29 | import com.jaredrummler.android.colorpicker.ColorPickerView.OnColorChangedListener; 30 | 31 | public class ColorPickerActivity extends AppCompatActivity implements OnColorChangedListener, View.OnClickListener { 32 | 33 | private ColorPickerView colorPickerView; 34 | private ColorPanelView newColorPanelView; 35 | 36 | @Override protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | getWindow().setFormat(PixelFormat.RGBA_8888); 39 | 40 | setContentView(R.layout.activity_color_picker); 41 | 42 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 43 | int initialColor = prefs.getInt("color_3", 0xFF000000); 44 | 45 | colorPickerView = (ColorPickerView) findViewById(R.id.cpv_color_picker_view); 46 | ColorPanelView colorPanelView = (ColorPanelView) findViewById(R.id.cpv_color_panel_old); 47 | newColorPanelView = (ColorPanelView) findViewById(R.id.cpv_color_panel_new); 48 | 49 | Button btnOK = (Button) findViewById(R.id.okButton); 50 | Button btnCancel = (Button) findViewById(R.id.cancelButton); 51 | 52 | ((LinearLayout) colorPanelView.getParent()).setPadding(colorPickerView.getPaddingLeft(), 0, 53 | colorPickerView.getPaddingRight(), 0); 54 | 55 | colorPickerView.setOnColorChangedListener(this); 56 | colorPickerView.setColor(initialColor, true); 57 | colorPanelView.setColor(initialColor); 58 | 59 | btnOK.setOnClickListener(this); 60 | btnCancel.setOnClickListener(this); 61 | } 62 | 63 | @Override public void onColorChanged(int newColor) { 64 | newColorPanelView.setColor(colorPickerView.getColor()); 65 | } 66 | 67 | @Override public void onClick(View v) { 68 | switch (v.getId()) { 69 | case R.id.okButton: 70 | SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(this).edit(); 71 | edit.putInt("color_3", colorPickerView.getColor()); 72 | edit.apply(); 73 | finish(); 74 | break; 75 | case R.id.cancelButton: 76 | finish(); 77 | break; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_dialog_presets.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 29 | 30 | 38 | 39 | 45 | 46 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 68 | 69 | 76 | 77 | 85 | 86 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /demo/src/main/java/com/jaredrummler/android/colorpicker/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Jared Rummler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jaredrummler.android.colorpicker.demo; 18 | 19 | import android.content.ActivityNotFoundException; 20 | import android.content.Intent; 21 | import android.graphics.Color; 22 | import android.net.Uri; 23 | import android.os.Bundle; 24 | import android.util.Log; 25 | import android.view.Menu; 26 | import android.view.MenuItem; 27 | import android.widget.Toast; 28 | import androidx.appcompat.app.AppCompatActivity; 29 | import com.jaredrummler.android.colorpicker.ColorPickerDialog; 30 | import com.jaredrummler.android.colorpicker.ColorPickerDialogListener; 31 | 32 | public class MainActivity extends AppCompatActivity implements ColorPickerDialogListener { 33 | 34 | private static final String TAG = "MainActivity"; 35 | 36 | // Give your color picker dialog unique IDs if you have multiple dialogs. 37 | private static final int DIALOG_ID = 0; 38 | 39 | 40 | @Override protected void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | if (savedInstanceState == null) { 43 | getSupportFragmentManager().beginTransaction().add(android.R.id.content, new DemoFragment()).commit(); 44 | } 45 | } 46 | 47 | @Override public boolean onCreateOptionsMenu(Menu menu) { 48 | getMenuInflater().inflate(R.menu.main, menu); 49 | return true; 50 | } 51 | 52 | @Override public boolean onOptionsItemSelected(MenuItem item) { 53 | switch (item.getItemId()) { 54 | case R.id.menu_color_picker_dialog: 55 | ColorPickerDialog.newBuilder() 56 | .setDialogType(ColorPickerDialog.TYPE_CUSTOM) 57 | .setAllowPresets(false) 58 | .setDialogId(DIALOG_ID) 59 | .setColor(Color.BLACK) 60 | .setShowAlphaSlider(true) 61 | .show(this); 62 | return true; 63 | case R.id.menu_github: 64 | try { 65 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/ColorPicker"))); 66 | } catch (ActivityNotFoundException ignored) { 67 | } 68 | return true; 69 | } 70 | return super.onOptionsItemSelected(item); 71 | } 72 | 73 | @Override public void onColorSelected(int dialogId, int color) { 74 | Log.d(TAG, "onColorSelected() called with: dialogId = [" + dialogId + "], color = [" + color + "]"); 75 | switch (dialogId) { 76 | case DIALOG_ID: 77 | // We got result from the dialog that is shown when clicking on the icon in the action bar. 78 | Toast.makeText(MainActivity.this, "Selected Color: #" + Integer.toHexString(color), Toast.LENGTH_SHORT).show(); 79 | break; 80 | } 81 | } 82 | 83 | @Override public void onDialogDismissed(int dialogId) { 84 | Log.d(TAG, "onDialogDismissed() called with: dialogId = [" + dialogId + "]"); 85 | } 86 | 87 | @Override 88 | public void onColorReset(int dialogId) { 89 | 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /demo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | #3F51B5 21 | #303F9F 22 | #FF4081 23 | 24 | 25 | @color/md_red_500 26 | @color/md_pink_500 27 | @color/md_purple_500 28 | @color/md_deep_purple_500 29 | @color/md_indigo_500 30 | @color/md_blue_500 31 | @color/md_light_blue_500 32 | @color/md_cyan_500 33 | @color/md_teal_500 34 | @color/md_green_500 35 | @color/md_light_green_500 36 | @color/md_lime_500 37 | @color/md_yellow_500 38 | @color/md_amber_500 39 | @color/md_orange_500 40 | @color/md_deep_orange_500 41 | @color/md_brown_500 42 | @color/md_grey_500 43 | @color/md_blue_grey_500 44 | @color/md_white 45 | 46 | 47 | 48 | #f44336 49 | 50 | 51 | #e91e63 52 | 53 | 54 | #9c27b0 55 | 56 | 57 | #673ab7 58 | 59 | 60 | #3f51b5 61 | 62 | 63 | #2196f3 64 | 65 | 66 | #03a9f4 67 | 68 | 69 | #00bcd4 70 | 71 | 72 | #009688 73 | 74 | 75 | #4caf50 76 | 77 | 78 | #8bc34a 79 | 80 | 81 | #cddc39 82 | 83 | 84 | #ffeb3b 85 | 86 | 87 | #ffc107 88 | 89 | 90 | #ff9800 91 | 92 | 93 | #ff5722 94 | 95 | 96 | #795548 97 | 98 | 99 | #9e9e9e 100 | 101 | #000000 102 | 103 | #ffffff 104 | 105 | 106 | #607d8b 107 | 108 | 109 | -------------------------------------------------------------------------------- /library/src/main/res/layout/cpv_dialog_color_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 23 | 24 | 30 | 31 | 37 | 38 | 48 | 49 | 55 | 56 | 61 | 62 | 72 | 73 | 80 | 81 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /demo/src/main/res/xml/main.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 27 | 33 | 34 | 41 | 42 | 51 | 52 | 61 | 62 | 72 | 73 | 77 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /gradle/maven-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven-publish' 18 | apply plugin: 'signing' 19 | 20 | def isReleaseBuild() { 21 | return VERSION_NAME.contains("SNAPSHOT") == false 22 | } 23 | 24 | def getReleaseRepositoryUrl() { 25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 27 | } 28 | 29 | def getSnapshotRepositoryUrl() { 30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 31 | : "https://oss.sonatype.org/content/repositories/snapshots/" 32 | } 33 | 34 | def getRepositoryUsername() { 35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" 36 | } 37 | 38 | def getRepositoryPassword() { 39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" 40 | } 41 | 42 | afterEvaluate { project -> 43 | // uploadArchives { 44 | // repositories { 45 | // mavenDeployer { 46 | //// beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 47 | // 48 | // pom.groupId = GROUP 49 | // pom.artifactId = POM_ARTIFACT_ID 50 | // pom.version = VERSION_NAME 51 | // 52 | // repository(url: getReleaseRepositoryUrl()) { 53 | // authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 54 | // } 55 | // snapshotRepository(url: getSnapshotRepositoryUrl()) { 56 | // authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 57 | // } 58 | // 59 | // pom.project { 60 | // name POM_NAME 61 | // packaging POM_PACKAGING 62 | // description POM_DESCRIPTION 63 | // url POM_URL 64 | // 65 | // scm { 66 | // url POM_SCM_URL 67 | // connection POM_SCM_CONNECTION 68 | // developerConnection POM_SCM_DEV_CONNECTION 69 | // } 70 | // 71 | // licenses { 72 | // license { 73 | // name POM_LICENCE_NAME 74 | // url POM_LICENCE_URL 75 | // distribution POM_LICENCE_DIST 76 | // } 77 | // } 78 | // 79 | // developers { 80 | // developer { 81 | // id POM_DEVELOPER_ID 82 | // name POM_DEVELOPER_NAME 83 | // } 84 | // } 85 | // } 86 | // } 87 | // } 88 | // } 89 | 90 | // signing { 91 | // required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 92 | // sign configurations.archives 93 | // } 94 | 95 | task androidJavadocs(type: Javadoc) { 96 | source = android.sourceSets.main.java.srcDirs 97 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 98 | if (JavaVersion.current().isJava8Compatible()) { 99 | options.addStringOption('Xdoclint:none', '-quiet') 100 | } 101 | failOnError false 102 | } 103 | 104 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 105 | classifier = 'javadoc' 106 | from androidJavadocs.destinationDir 107 | } 108 | 109 | task androidSourcesJar(type: Jar) { 110 | classifier = 'sources' 111 | from android.sourceSets.main.java.sourceFiles 112 | } 113 | 114 | artifacts { 115 | archives androidSourcesJar 116 | archives androidJavadocsJar 117 | } 118 | } -------------------------------------------------------------------------------- /demo/src/main/res/layout/activity_color_picker.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 28 | 29 | 35 | 36 | 42 | 43 | 52 | 53 | 61 | 62 | 71 | 72 | 79 | 80 | 81 | 82 | 89 | 90 |