From d8d14f8fa48f30479a92b0e7ac98865574950dfd Mon Sep 17 00:00:00 2001 From: Jimmy Tai Date: Mon, 27 Aug 2018 09:56:31 +0800 Subject: [PATCH] Update README.md --- README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5871f11..dd97cf4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# JColorPicker +# JColorPicker -API +API License >**iOS coming soon ...** @@ -12,6 +12,101 @@ JColorPicker provides two kind of picker, WhiteColorPicker and ColorPicker. >- **WhiteColorPicker** - choosing color temperature >- **ColorPicker** - choosing any color - + +## Usage +You can simply implement `ColorPicker` to your XML file and set a `OnColorSelectedListener`. +**WhiteColorPicker** + + Add the `WhiteColorPicker` to XML: + + ```xml + +``` + +You can add attributes to customize the `WhiteColorPicker`: + +| name | type | documentation | +|------|------|---------------| +| wcp_indicator_radius| dimension| indicator size| +| wcp_indicator_activate_scale| float| the radius scale when indicator be activated| +| wcp_indicator_thickness| dimension| indicator white part size| +| wcp_indicator_shadow_radius| dimension| indicator shadow size| +| wcp_indicator_shadow_color| color | the color of shadow| + +**ColorPicker** + + Add the `ColorPicker` to XML: + + ```xml + +``` + +You can add attributes to customize the `ColorPicker`: + +| name | type | documentation | +|------|------|---------------| +| cp_indicator_radius| dimension| indicator size| +| cp_indicator_activate_scale| float| the radius scale when indicator be activated| +| cp_indicator_thickness| dimension| indicator white part size| +| cp_indicator_shadow_radius| dimension| indicator shadow size| +| cp_indicator_shadow_color| color | the color of shadow| + +**OnColorSelectedListener** +Add the following code into your Activity to listener the color selected event. + + ```Java + private ColorPicker.OnColorSelectedListener colorSelectedListener = + new ColorPicker.OnColorSelectedListener() { + @Override + public void onColorSelected(int color) { + // add your code .... + } +}; + +ColorPicker view_colorPicker = (ColorPicker) findViewById(R.id.your_colorpicker_id); +view_colorPicker.setOnColorSelectedListener(colorSelectedListener); + ``` + +## Download +Download [the latest AAR](https://bintray.com/jimmytai/maven/download_file?file_path=com%2Fjimmytai%2Flibrary%2Fjcolorpicker%2F1.0.0%2Fjcolorpicker-1.0.0.aar) or grab via Gradle: + +**Gadle** +``` +implementation 'com.jimmytai.library:jcolorpicker:1.0.0' +``` +**Maven** +``` + + com.jimmytai.libraryjcolorpicker + 1.0.0 + pom + +``` +## License + + 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.