colorpicker icon indicating copy to clipboard operation
colorpicker copied to clipboard

LightnessSlider not updated when setInitialColor() called

Open gitdefllo opened this issue 7 years ago • 2 comments

By setting an initial value with setInitialColor(int, boolean), the lightness slider is not updating. It stays at position 0, whereas the alpha slider is updated correctly.

For example, if I do this:

int mColor = -154296; // yellow, full light, full opacity
colorPickerView.setInitialColor(mColor, false);

I got the below result on the left:

screenshot_wheel

However, if I select another color directly in the wheel, the sliders are both updating properly, like the right screenshot above (full light, full opacity).

context: used in fragment with widgets in xml (no dialog)

gitdefllo avatar Mar 05 '17 05:03 gitdefllo

Weirdly I have to set (again) the lightness color in a runnable as:

colorPickerView.setInitialColor(mColor, false);
// assuming that mBarLightness is the LightnessSlider view
mBarLightness.post(new Runnable() {
    @Override
    public void run() {
        mBarLightness.setColor(mColor);
    }
});

I said again because in the ColorPickerVIew you already did it in onLayout(...) which call setLightnessSlider(...) and set the color into it... that's why it seems weird.

gitdefllo avatar May 18 '17 18:05 gitdefllo

I have met same issue

frog1014 avatar Aug 18 '17 07:08 frog1014