Closed Colonieves closed 6 years ago
Hi, I think the .initialColor(int i) is not working when used as a dialog box. It is working fine when used as a widget.
Here you have both codes using the same testColor <colorname="testColor">#34FF00
<color
Could you tell me please if I am doing anything wrong or if it is the component that is not working as expected?
Cheers!
pickColorButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final Context context = EditItemActivity.this; ColorPickerDialogBuilder .with(context) .setTitle("Choose color") .initialColor(R.color.testColor) .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER) .density(10) .setOnColorSelectedListener(new OnColorSelectedListener() { @Override public void onColorSelected(int selectedColor) { toast("onColorSelected: 0x" + Integer.toHexString(selectedColor)); } }) .setPositiveButton("ok", new ColorPickerClickListener() { @Override public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) { changeBackgroundColor(selectedColor); } }) .setNegativeButton("cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .build() .show(); } });
<com.flask.colorpicker.ColorPickerView android:id="@+id/color_picker_view" android:layout_width="match_parent" android:layout_height="wrap_content" app:alphaSlider="true" app:density="12" app:lightnessSlider="true" app:wheelType="FLOWER" app:lightnessSliderView="@+id/v_lightness_slider" app:alphaSliderView="@+id/v_alpha_slider" app:initialColor="@color/testColor" /> <com.flask.colorpicker.slider.LightnessSlider android:id="@+id/v_lightness_slider" android:layout_width="match_parent" android:layout_height="48dp" /> <com.flask.colorpicker.slider.AlphaSlider android:id="@+id/v_alpha_slider" android:layout_width="match_parent" android:layout_height="48dp" />
My mistake is that R.color.testColor should be in the shape of 0xffffffff Once I formatted it like that, it worked. I am closing this issue as it is not valid.
Hi, I think the .initialColor(int i) is not working when used as a dialog box. It is working fine when used as a widget.
Here you have both codes using the same testColor
<color
name="testColor">#34FF00Could you tell me please if I am doing anything wrong or if it is the component that is not working as expected?
Cheers!
AS A DIALOG BOX (displaying a gray-ish color)
AS A WIDGET (displaying the correct color)