-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onColorChangedListener triggers way to often (and first values are not valid) #60
Comments
This is a major issue that I'm also experiencing. |
I've looked into the suggestion buttairfly gave, but that just delegates the event triggering to the bars (0 bars = 0 events, 1 bar = 1 event, 2 bars = 2 events). A better way to approach the problem would be for the colorpicker to ask the bars for their values, and use that to calculate the new color, and then only the colorpicker should be allowed to trigger the event. I'm working on a pull request for this. |
…, circle touch change with color manipulation through bars) to "int" (containing the color value). With a few additional tweaks the listener does not get notified about the intermediate steps when bars are attached to ColorPicker. Fixes LarsWerkman#60 of the original repository.
I can't get this color picker to work in Android IDE 1.5. I'm stuck on a duplicate class in the build: Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
and I can't find it. I've been looking all day - I think I have to try another color picker. |
Using the 1.5 version I also noticd that when using a SVBar the onColorChanged is triggered twice, and the 1st event actually contains the wrong color. In ColorPicker.onTouchEvent() 2nd event on line 646: |
Hey Lars Werkman,
thank you for your great work with this colorPicker!
I use your colorPicker (with SV- and Opacitybars) to send an ip frame with the selected color to another device. I noticed, you trigger the onColorChangedListener on every ColorPicker.setNewCenterColor(.) call. This is wrong, if there are some bars (which update the actual color value with setNewCenterColor).
with this function update in ColorPicker it is solved:
/**
* Puts an ColorChanged Event on the listener.
*
*/
public void ColorChangedEvent(){
if (onColorChangedListener != null && mCenterNewColor != oldChangedListenerColor) {
onColorChangedListener.onColorChanged(mCenterNewColor);
oldChangedListenerColor = mCenterNewColor;
}
}
/**
* Change the color of the center which indicates the new color.
*
* @param color int of the color.
*/
public void setNewCenterColor(int color) {
mCenterNewColor = color;
mCenterNewPaint.setColor(color);
if (mCenterOldColor == 0) {
mCenterOldColor = color;
mCenterOldPaint.setColor(color);
}
invalidate();
}
and put
ColorPicker.ColorChangedEvent();
after every call of setNewCenterColor(.) in functions of the bars instead of .setColor(color).
in ColorPicker Functions, ColorChangedEvent() needs to be called after correct value is set to setNewCenterColor(.) function calls. (if a bar changes the value later on, a wrong value will be put on listener.
By the way... you dont see, how many listener Function calls you get, whith the old version by just using the colorpicker on an android device.
Best Regards!
Buttairfly
The text was updated successfully, but these errors were encountered: