hsv-alpha-color-picker-android icon indicating copy to clipboard operation
hsv-alpha-color-picker-android copied to clipboard

Thumbnail color doesn't update

Open versoworks opened this issue 9 years ago • 10 comments

We're using a couple of ColorPreference in a PreferenceFragment, the XMLfor the fragment is as follows;

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.rarepebble.colorpicker.ColorPreference
        android:key="text_color"
        android:title="@string/text_color_title"
        app:colorpicker_showHex="false" />

    <com.rarepebble.colorpicker.ColorPreference
        android:key="background_color"
        android:title="@string/background_color_title"
        app:colorpicker_showHex="false" />

</PreferenceScreen>

When changing the text_color preference, the onPreferenceChange listener is fired, however, the thumbnail does not update, regardless of whether setColor() is called or not on the changing preference within the listener.

When changing the background_color preference, the thumbnail updates correctly.

versoworks avatar Jan 19 '16 06:01 versoworks

Are you returning false from your onPreferenceChange() function? That (correctly) causes the color not to update for me.

martin-stone avatar Jan 20 '16 08:01 martin-stone

It's returning true always. I resolved the issue by adding a PreferenceCategory. It appears if the ColorPreference is the first item, the thumbnail does not update.

versoworks avatar Jan 20 '16 08:01 versoworks

I pasted your XML into the demo app and everything works correctly for me. If you want a proper fix, I'll need more information and/or code. (Or even better, a pull request :-)

martin-stone avatar Jan 20 '16 19:01 martin-stone

I have the same exact issue. This is how I declare the Color Picker

        <com.rarepebble.colorpicker.ColorPreference
            android:icon="@drawable/ic_format_color_fill_white_24dp"
            android:key="racer.accent"
            android:title="Accent Color"
            android:summary="Set the Watchface accent color."
            app:colorpicker_defaultColor="#f00"/>

With or without a Category the Thumbnail does not update but I can confirm that the preference is changed.

raffaeu avatar Jan 25 '16 15:01 raffaeu

Can you confirm that you're using the latest version of the library (1.6.0)? Also, what Android version(s) do you see it on? Does it happen on the emulator?

martin-stone avatar Jan 25 '16 19:01 martin-stone

Yes I am using the latest version on android 5.1.1 and 6.0 It happens on Nexus 6, Samsung s5 and virtual devices On 25 Jan 2016 21:23, "Martin Stone" [email protected] wrote:

Can you confirm that you're using the latest version of the library (1.6.0)? Also, what Android version(s) do you see it on? Does it happen on the emulator?

— Reply to this email directly or view it on GitHub https://github.com/martin-stone/hsv-alpha-color-picker-android/issues/17#issuecomment-174628180 .

raffaeu avatar Jan 25 '16 19:01 raffaeu

Hmm. Working for me on 5.1.1 emulator (and all my other devices). Are you building the library locally or using the jcenter version? What are your target version and min sdk version? Any other relevant setup you can think of?

Maybe you could debug the library locally and put a breakpoint in ColorPreference.showColor() and see what's going on.

martin-stone avatar Jan 25 '16 19:01 martin-stone

I am using jcenter but I was considering to fork git and debug it. Min sdk is 16 On 25 Jan 2016 9:58 pm, "Martin Stone" [email protected] wrote:

Hmm. Working for me on 5.1.1 emulator (and all my other devices). Are you building the library locally or using the jcenter version? What are your target version and min sdk version? Any other relevant setup you can think of?

Maybe you could debug the library locally and put a breakpoint in ColorPreference.showColor() and see what's going on.

— Reply to this email directly or view it on GitHub https://github.com/martin-stone/hsv-alpha-color-picker-android/issues/17#issuecomment-174640589 .

raffaeu avatar Jan 25 '16 20:01 raffaeu

Well, I'm out of ideas here. If you could investigate with a debugger, that would be helpful.

martin-stone avatar Jan 25 '16 20:01 martin-stone

I'll give it a shot and try to understand why it does not update the activity On 25 Jan 2016 10:04 pm, "Martin Stone" [email protected] wrote:

Well, I'm out of ideas here. If you could investigate with a debugger, that would be helpful.

— Reply to this email directly or view it on GitHub https://github.com/martin-stone/hsv-alpha-color-picker-android/issues/17#issuecomment-174642443 .

raffaeu avatar Jan 25 '16 20:01 raffaeu