Add a color picker.

This commit is contained in:
Alex Ning
2020-03-20 17:03:49 +08:00
parent 9e4dec362d
commit 587dfccd32
5 changed files with 333 additions and 3 deletions

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:text="@string/color_picker"
style="@style/MaterialAlertDialogTitleTextStyle" />
<View
android:id="@+id/color_view_color_picker"
android:layout_width="match_parent"
android:layout_height="200dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#"
android:textColor="?attr/primaryTextColor"/>
<EditText
android:id="@+id/color_edit_text_color_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLength="8"
android:inputType="textCapCharacters|textNoSuggestions"
android:textColor="?attr/primaryTextColor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingBottom="8dp"
android:paddingStart="32dp"
android:paddingEnd="32dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="A"
android:textColor="?attr/primaryTextColor" />
<SeekBar
android:id="@+id/a_seek_bar_color_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="32dp"
android:paddingEnd="32dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="R"
android:textColor="?attr/primaryTextColor" />
<SeekBar
android:id="@+id/r_seek_bar_color_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="32dp"
android:paddingEnd="32dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="G"
android:textColor="?attr/primaryTextColor" />
<SeekBar
android:id="@+id/g_seek_bar_color_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="32dp"
android:paddingStart="32dp"
android:paddingEnd="32dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="B"
android:textColor="?attr/primaryTextColor" />
<SeekBar
android:id="@+id/b_seek_bar_color_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255" />
</LinearLayout>
<LinearLayout
android:layout_gravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<Button
android:id="@+id/cancel_button_color_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cancel"
style="@style/MaterialAlertDialogNegativeButtonStyle" />
<Button
android:id="@+id/ok_button_color_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ok"
style="@style/MaterialAlertDialogPositiveButtonStyle" />
</LinearLayout>
</LinearLayout>

View File

@@ -602,4 +602,7 @@
<string name="theme_name_indigo_dark">Indigo Dark</string>
<string name="theme_name_indigo_amoled">Indigo Amoled</string>
<string name="color_picker">Color Picker</string>
<string name="invalid_color">Invalid Color</string>
</resources>