martin-stone / hsv-alpha-color-picker-android

A color picker and a color preference for use in Android applications.
Apache License 2.0
290 stars 60 forks source link

Set selected color #5

Closed MFlisar closed 9 years ago

MFlisar commented 9 years ago

Is that somehow possible? I don't want to set the start color but rather the manually selected color. So I can combine this view with a handful of fix colors, that update the selected color of the view if I click them so that the user can afterwards adjust that color (mainly the alpha).

I want to combine this color picker with the default palette colors...

martin-stone commented 9 years ago

I'll add a function for that in the next version.

If you're in a hurry, you might be able to cheat by accessing the hex edit field and setting the value for the color you want (untested):

EditText hexEdit = (EditText)colorPickerView.findViewById(com.rarepebble.colorpicker.R.id.hexEdit);
hexEdit.setText(Integer.toHexString(color));

Alternatively, compile the library locally and add a function similar to setColor() that omits the call to swatchView.setOldColor().

martin-stone commented 9 years ago

In version 1.3 you can call setCurrentColor() to do what you need.