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

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

Thumbnail color doesn't update #17

Open versoworks opened 8 years ago

versoworks commented 8 years ago

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.

martin-stone commented 8 years ago

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

versoworks commented 8 years ago

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.

martin-stone commented 8 years ago

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 :-)

raffaeu commented 8 years ago

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.

martin-stone commented 8 years ago

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?

raffaeu commented 8 years ago

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" notifications@github.com 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 .

martin-stone commented 8 years ago

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.

raffaeu commented 8 years ago

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" notifications@github.com 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 .

martin-stone commented 8 years ago

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

raffaeu commented 8 years ago

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" notifications@github.com 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 .