QuadFlask / colorpicker

🍭color picker for android
1.22k stars 219 forks source link

Color picker wheel not showing up #111

Open PasqualePuzio opened 4 years ago

PasqualePuzio commented 4 years ago

Hello,

in some cases (this affects very few users), the color picker wheel is not showing up (see the screenshot). This is weird as it only happens to a few users, although the initialization code is identical for everyone.

Here's the code AlertDialog colordialog = ColorPickerDialogBuilder .with(LeagueCustomizeShirtActivity.this) .setTitle("Seleziona Colore") .initialColor(0xffffffff) .wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE) .density(10) .showLightnessSlider(true) .showAlphaSlider(false)

and the screenshot

Screenshot_20190718-184816

What could be the reason?

Thanks

Lars3n95 commented 4 years ago

The same happened to a user of my app. He uses a Huawei P20 Pro. Unfortunately I can't reproduce that. I use .wheelType(ColorPickerView.WHEEL_TYPE.CIRCLE) as well.

PasqualePuzio commented 4 years ago

It would be nice to receive an answer from the maintainer of this project

Sahistaja commented 4 years ago

My app users have the same bug. So far was only Samsung devices and Android 9 related. Today a Huawei user complained about the same thing. I'm also interested in some solution on this issue.

Sahistaja commented 4 years ago

Latest info about this issue:

"What I discovered on the previous version, and probably explains why some having issue is that if you moved from landscape to portrait the bug appeared. This version works either way round and after switching orientation :)"

YvzDigitalLab commented 4 years ago

Latest info about this issue:

"What I discovered on the previous version, and probably explains why some having issue is that if you moved from landscape to portrait the bug appeared. This version works either way round and after switching orientation :)"

@Sahistaja what new version are you refering too ?

Sahistaja commented 4 years ago

@YvzDigitalLab, sorry. The "new version" is another library. It's not related to the QuadFlask colorpicker issue.

YvzDigitalLab commented 4 years ago

@Sahistaja thanks for your response!

Lars3n95 commented 4 years ago

Updating to 0.0.15 seems to fix this for me (at least one user says that the color wheel is showing up now). Thanks for the update!

ELIX1337 commented 3 years ago

Got this problem. Happens randomly. Any ideas?

Samsung A50. Android 10

eWIiUKL7JL0

UPD: FIXED. Found the cause of the problem. Occurs when trying to set the wrong color (some channel is missing)

ColorPicker code:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardElevation="12dp"
    app:cardCornerRadius="14dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:padding="10dp">

            <com.flask.colorpicker.ColorPickerView
                android:id="@+id/color_picker_diagram"
                android:layout_gravity="center"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:alphaSlider="false"
                app:lightnessSlider="true"
                app:lightnessSliderView="@+id/color_picker_brightness"
                app:density="20"
                app:wheelType="FLOWER"/>

        </LinearLayout>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/color_slider"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:orientation="horizontal"
            app:cardElevation="12dp"
            style="@style/CardAppearance.Corners.Bottom">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingHorizontal="8dp"
                android:paddingVertical="3dp">

                <com.flask.colorpicker.slider.LightnessSlider
                    android:id="@+id/color_picker_brightness"
                    android:nestedScrollingEnabled="false"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>

    </LinearLayout>

</com.google.android.material.card.MaterialCardView>

Including ColorPicker:

<include layout="@layout/ui_color_picker"/>

Java code:

private ColorPickerView colorPicker;
private LightnessSlider colorPickerSlider;

    @SuppressLint("ClickableViewAccessibility")
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tab_effects, container, false);

        colorPicker                         = view.findViewById(R.id.color_picker_diagram);
        colorPickerSlider                   = view.findViewById(R.id.color_picker_brightness);

        colorPicker.setColor(Color.WHITE, false);

        colorPicker.addOnColorChangedListener(selectedColor -> {
            String hexColor = String.format("#%06X", (0xFFFFFF & selectedColor));
            int red = Color.red(selectedColor);
            int green = Color.green(selectedColor);
            int blue = Color.blue(selectedColor);
            Log.d(TAG, "onColorChanged: " + hexColor + " R:" + red + " G:" + green + " B:" + blue);
            Bundle result = new Bundle();
            if (DeviceControlFragment.canWrite) {
                result.putInt("color", selectedColor);
                getParentFragmentManager().setFragmentResult("getColor", result);
            }
        });

        return view;
    }
Lars3n95 commented 3 years ago

And you are using version 0.0.15?

ELIX1337 commented 3 years ago

And you are using version 0.0.15?

Yep

ELIX1337 commented 3 years ago

Found the possible cause of the bug. It occurs after I try to set the color for wheel

ELIX1337 commented 3 years ago

Found the cause of the problem. Occurs when trying to set the wrong color (some channel is missing)