mikifus / padland

Padland is a tool to manage, share, remember and read collaborative documents based on the Etherpad technology in Android.
Apache License 2.0
62 stars 15 forks source link

Offer color picker #11

Closed PanderMusubi closed 7 years ago

PanderMusubi commented 8 years ago

Please offer a color picker with colors from Material Design and a manual override. As intermediate goal, show the color for which the RGB value has been entered.

navaneethknair commented 8 years ago

Use the following code to add colour picker as in the form of widget <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" />

<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"
    />
navaneethknair commented 8 years ago

or if you want colour picker as in the form of dialog use the following code

ColorPickerDialogBuilder .with(context) .setTitle("Choose color") .initialColor(currentBackgroundColor) .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER) .density(12) .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();