项目作者: syslogic

项目描述 :
A color-picker library for Android.
高级语言: Java
项目地址: git://github.com/syslogic/androidx-colorpicker.git
创建时间: 2021-05-12T03:57:56Z
项目社区:https://github.com/syslogic/androidx-colorpicker

开源协议:MIT License

下载


androidx-colorpicker

Release
MIT License

A modern color-picker library for Android, which is compatible with Jetpack Navigation and Jetpack Compose.


The library is generally available on JitPack; either by version tag or master-SNAPSHOT.

The JitPack repository URL would be: maven { url 'https://jitpack.io' }

  1. dependencies {
  2. implementation "io.syslogic:androidx-colorpicker:1.2.9"
  3. }

The :mobile application module provides these usage examples:

a) Use ColorPickerDialogFragmentImpl extends ColorPickerDialogFragment:

  1. class ColorPickerDialogFragmentImpl extends ColorPickerDialogFragment {
  2. public ColorPickerDialogFragmentImpl() {
  3. super();
  4. }
  5. }

Then define ColorPickerDialogFragmentImpl as navigation destination in nav_graph.xml:

  1. <dialog
  2. android:id="@+id/colorPickerDialogFragment"
  3. android:name="io.syslogic.demo.colorpicker.fragment.ColorPickerDialogFragmentImpl">
  4. <argument app:argType="integer" android:name="initialColor" android:defaultValue="-16777216"></argument>
  5. <argument app:argType="boolean" android:name="alphaSlider" android:defaultValue="false"></argument>
  6. <argument app:argType="boolean" android:name="hexValue" android:defaultValue="false"></argument>
  7. </dialog>

Screenshot ColorPickerDialogFragment:

DialogFragment

b) ColorPickerPreference
can be added as XML node; into eg. preferences.xml:

  1. <io.syslogic.colorpicker.ColorPickerPreference
  2. android:title="@string/text_select_color"
  3. android:icon="@drawable/ic_baseline_invert_colors"
  4. android:defaultValue="@string/value_default_color"
  5. android:key="color_code_01"></io.syslogic.colorpicker.ColorPickerPreference>

c) Preview: @Composable fun ColorPickerComponent

Composable

d) Preview: @Composable fun ColorPickerDialog

Composable