Cherish: Add ColorSelectPreference

pulled from Omnilib repo from omnirom for history/authors check
https://github.com/omnirom/android_packages_apps_OmniLib/commits/android-10

Change-Id: I5999c551ce0273f5c3b25ff45179a10a9969bbe8
This commit is contained in:
Josh Fox (XlxFoXxlX)
2020-02-21 22:22:18 -05:00
committed by Hưng Phan
parent 0d3f02daee
commit e02805e3aa
12 changed files with 1848 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Daniel Nilsson
Copyright (C) 2012 THe CyanogenMod Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/alert_dialog_padding_material"
android:paddingStart="@dimen/alert_dialog_padding_material"
android:paddingEnd="@dimen/alert_dialog_padding_material" >
<com.cherish.settings.ui.ColorPickerView
android:id="@+id/color_picker_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp" />
<LinearLayout
android:id="@+id/color_panel_view"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="4dp"
android:orientation="horizontal" >
<EditText
android:id="@+id/hex_color_input"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:digits="0123456789ABCDEFabcdef"
android:inputType="textNoSuggestions"
android:maxLength="6" />
<com.cherish.settings.ui.ColorPanelView
android:id="@+id/color_panel"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:id="@+id/color_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="4dp"
android:orientation="horizontal" >
<Spinner
android:id="@+id/color_list_spinner"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5" />
<com.cherish.settings.ui.ColorPanelView
android:id="@+id/color_list_panel"
android:layout_width="0px"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textViewName"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/selectableItemBackground"
android:clipToPadding="false" >
<LinearLayout
android:id="@+id/icon_frame"
style="@style/preference_icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:orientation="horizontal"
android:clipToPadding="false"
android:paddingEnd="12dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<com.android.internal.widget.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="48dp"
android:maxHeight="48dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<TextView android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp">
<ImageView
android:id="@+id/light_color"
android:layout_width="@dimen/color_preference_width"
android:layout_height="@dimen/color_preference_height"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>

View File

@@ -613,4 +613,14 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="entries_led_colors" translatable="false">
<item>@string/led_color_green</item>
<item>@string/led_color_red</item>
</string-array>
<string-array name="values_led_colors" translatable="false">
<item>#FF00FF00</item>
<item>#FFFF0000</item>
</string-array>
</resources>

View File

@@ -28,4 +28,10 @@
<attr name="ledPreview" format="boolean" />
<attr name="alphaSlider" format="boolean" />
</declare-styleable>
<declare-styleable name="ColorSelectPreference">
<attr name="ledPreview" format="boolean" />
<attr name="multiColor" format="boolean" />
<attr name="withAlpha" format="boolean" />
</declare-styleable>
</resources>

View File

@@ -16,8 +16,12 @@
-->
<resources>
<!-- Color Picker -->
<dimen name="picker_circle_preview_size">26dp</dimen>
<dimen name="oval_notification_size">26dp</dimen>
<dimen name="alert_dialog_padding_material">20dp</dimen>
<dimen name="color_preference_width">18dip</dimen>
<dimen name="color_preference_height">18dip</dimen>
<dimen name="fod_picker_item_margin">20dp</dimen>
<dimen name="fod_picker_item_size">100dp</dimen>

View File

@@ -58,6 +58,8 @@
<string name="hex_hint">#ff000000</string>
<string name="set">Set</string>
<string name="color_default">Default</string>
<string name="led_color_green">Green</string>
<string name="led_color_red">Red</string>
<!-- Lockscreen battery info indicator -->
<string name="lockscreen_battery_info_title">Lockscreen charging info</string>
@@ -722,5 +724,9 @@
<string name="pulse_custom_div">Bar spacing</string>
<string name="pulse_filled_block_size">Block size</string>
<string name="pulse_empty_block_size">Block spacing</string>
<!-- does the device have multi color led support or only
a fixed set of led colors -->
<bool name="config_has_multi_color_led">true</bool>
</resources>