Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
slaviboy committed Aug 16, 2020
1 parent 50e8a39 commit 3075cb2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<h1 align="center">ColorPicker for Android</h1>

<p align="center">
<img src="screens/image1_medium.png" alt="Image" />
<img src="screens/home.png" alt="Image" />
</p>

## About
Kotlin Library used for creating custom color pickers by creating separate components that combined all together form color picker.
Kotlin Library used for creating custom color pickers by adding different modules that combined all together form color picker.
To learn more about the library you can check the [Wiki](https://github.com/slaviboy/ColorPickerKotlin/wiki) page

Top 3 most popular color pickers are pre-made and included (kotlin classes together with the layout files) as [example](https://github.com/slaviboy/ColorPickerKotlin/tree/master/app/src/main):
Expand All @@ -32,10 +32,10 @@ dependencies {

## How to use
Follow the next few easy steps on how to include color pickers components in your own project.
If you want to create custom color picker with your own custom components- TextViews and ColorWindows combined in separate xml file, you can check the [Wiki](https://github.com/slaviboy/ColorPickerKotlin/wiki#Creating-Color-Picker) page.
If you want to create custom color picker with your own custom components- TextViews and Color Windows combined in separate xml file, you can check the tutorial section on the [Wiki](https://github.com/slaviboy/ColorPickerKotlin/wiki#tutorial-creating-custom-color-picker) page.

### Add Components
Here is example on how to include color picker components in your layout, in this particular example rectangular color window RectangularSV is used together with simple EditText that holds information about the RGB(Red, Green, Blue) values, for the selected color.
Here is example on how to include color picker components in your layout, in this particular example rectangular color window **RectangularSV** is used together with simple EditText that holds information about the RGB(Red, Green, Blue) values, for the selected color.
```xml
<com.slaviboy.colorpicker.windows.rectangular.RectangularSV
android:id="@+id/rectangularSV"
Expand Down Expand Up @@ -70,29 +70,29 @@ Here is example on how to include color picker components in your layout, in thi
### Set Updater and ColorConverter
In your activity you need to associate the color components with certain [ColorConverter](https://github.com/slaviboy/ColorPickerKotlin/wiki#ColorConverter) and [Updater](https://github.com/slaviboy/ColorPickerKotlin/wiki#Updater).

ColorConverter class is used for conversion of the current selected color into different color models. Those color model values can be used by the text views to display current selected color value.The class has methods that lets you get the current selected color in different color model formats.
ColorConverter class is used for conversion of the current selected color into different color models. Those color model values can be used by text views to display the currently selected color.The class has methods that lets you get the current selected color in different color model formats.

Update class is responsible for updating the content of all attached color pickers and text views responsively, so the change in one view will trigger change in the other color picker components. That way you can attach multiple color picker and components.
Update class is responsible for updating the content of all attached color pickers and text views responsively, so the change in one view will trigger change in the other color picker components. That way you can attach multiple color pickers and separate components without the need of manually changing each one.

```kotlin

// get color picker components by id
val rectangularSV:RectangularSV = findViewById(R.id.rectangularSV)
val editText:EditText = findViewById(R.id.text);
val rectangularSV: RectangularSV = findViewById(R.id.rectangularSV)
val editText: EditText = findViewById(R.id.text);

// create color converter with selected color: RGBA(160, 73, 184, 50)
val colorConverter:ColorConverter = ColorConverter(160, 73, 184, 50)
val colorConverter: ColorConverter = ColorConverter(160, 73, 184, 50)

// create updater, that will update all components
val updater:Updater = Updater(colorConverter)
val updater: Updater = Updater(colorConverter)

// attach the components
updater.attachColorWindows(rectangularSV)
updater.attachTextView(editText, Updater.TYPE_RGB)
```

### Listen for changes
You can attach listener that will trigger two methods when the user selects new color, from a certain component. The first event is for detecting TextViews value changes, and the other is for ColorWindows.
You can attach listener that will trigger two methods when the user selects new color, from a certain component. The first event is for detecting TextViews value changes, and the other one is for detecting changes in Color Windows.
```java
updater.setOnUpdateListener(object : OnUpdateListener {

Expand Down

0 comments on commit 3075cb2

Please sign in to comment.