Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.u1aryz:ColorPickerPreferenceCompat:v0.1.0'
}
dependencies {
implementation("com.github.u1aryz:ColorPickerPreferenceCompat:v0.1.0")
}
<dependency>
<groupId>com.github.u1aryz</groupId>
<artifactId>ColorPickerPreferenceCompat</artifactId>
<version>v0.1.0</version>
</dependency>
libraryDependencies += "com.github.u1aryz" % "ColorPickerPreferenceCompat" % "v0.1.0"
:dependencies [[com.github.u1aryz/ColorPickerPreferenceCompat "v0.1.0"]]
This is color picker for v7 Preference Support Library.</br> The original ColorPickerView was written by Daniel Nilsson
<img src="art/preference.png" width="33%"/> <img src="art/dialog.png" width="33%"/>
dependencies {
compile 'com.u1aryz:colorpicker-preference-compat:0.1.0'
}
Add the ColorPreference
to your preference xml.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.preference.PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.u1aryz.android.colorpicker.ColorPreference
android:defaultValue="0xFF4183C4"
android:key="color1"
android:persistent="false"
android:title="Color 1"
app:alphaSlider="true"
/>
...
</android.support.v7.preference.PreferenceScreen>
You have to extend ColorPreferenceFragmentCompat
to your fragment.
public class MyPreferenceFragment extends ColorPreferenceFragmentCompat {
@Override public void onCreatePreferences(Bundle bundle, String s) {
addPreferencesFromResource(R.xml.my_pref);
}
}
Copyright 2017 Daniel Nilsson
Copyright 2017 u1aryz
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.