OmniGears: make our custom prefs follow global style
Change-Id: Ic2484968f2eea359fd34be161f6742dbb8783baa
diff --git a/res/layout/preference_app_list.xml b/res/layout/preference_app_list.xml
deleted file mode 100644
index 449dcf5..0000000
--- a/res/layout/preference_app_list.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The OmniROM Project
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingStart="@dimen/alert_dialog_padding_material"
- android:paddingEnd="@dimen/alert_dialog_padding_material" >
- <ListView
- android:id="@+id/app_list"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_marginTop="6dip" />
-</LinearLayout>
diff --git a/res/layout/preference_battery_light.xml b/res/layout/preference_battery_light.xml
deleted file mode 100644
index 02e7646..0000000
--- a/res/layout/preference_battery_light.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/app_light_pref"
- 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:layout_marginStart="56dp" >
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingTop="16dp"
- android:paddingBottom="16dp">
-
- <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>
diff --git a/res/layout/preference_color_picker.xml b/res/layout/preference_color_picker.xml
deleted file mode 100644
index 3f5dd0d..0000000
--- a/res/layout/preference_color_picker.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- 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>
diff --git a/res/layout/preference_color_select.xml b/res/layout/preference_color_select.xml
new file mode 100644
index 0000000..dc53867
--- /dev/null
+++ b/res/layout/preference_color_select.xml
@@ -0,0 +1,82 @@
+<?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>
diff --git a/res/layout/preference_edit_text.xml b/res/layout/preference_edit_text.xml
deleted file mode 100644
index 4388b9d..0000000
--- a/res/layout/preference_edit_text.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingStart="@dimen/alert_dialog_padding_material"
- android:paddingEnd="@dimen/alert_dialog_padding_material" >
- <EditText
- android:id="@+id/edit_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_marginTop="6dip" />
-</LinearLayout>
diff --git a/res/layout/preference_font_picker.xml b/res/layout/preference_font_picker.xml
index 030c57b..fd34b75 100644
--- a/res/layout/preference_font_picker.xml
+++ b/res/layout/preference_font_picker.xml
@@ -22,7 +22,27 @@
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:background="?android:attr/selectableItemBackground" >
+ 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"
@@ -31,7 +51,7 @@
android:paddingTop="16dp"
android:paddingBottom="16dp">
- <TextView android:id="@+android:id/title"
+ <TextView android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
@@ -39,7 +59,7 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
- <TextView android:id="@+android:id/summary"
+ <TextView android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
diff --git a/res/layout/preference_notification_light.xml b/res/layout/preference_notification_light.xml
deleted file mode 100644
index 9cc98af..0000000
--- a/res/layout/preference_notification_light.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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:id="@+id/app_light_pref"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:minHeight="?android:attr/listPreferredItemHeightSmall"
- android:gravity="center_vertical"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:background="?android:attr/selectableItemBackground">
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingTop="16dip"
- android:paddingBottom="16dip">
-
- <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:textColor="?android:attr/textColorPrimary"
- 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:visibility="gone"
- android:textAlignment="viewStart"
- 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:orientation="vertical" >
-
- <TextView
- android:id="@+id/textViewTimeOnValue"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginEnd="6dp"
- android:textColor="?android:attr/textColorSecondary"
- android:textAppearance="?android:attr/textAppearanceListItemSecondary" />
-
- <TextView
- android:id="@+id/textViewTimeOffValue"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginEnd="6dp"
- android:textColor="?android:attr/textColorSecondary"
- android:textAppearance="?android:attr/textAppearanceListItemSecondary" />
- </LinearLayout>
-
- <ImageView
- android:id="@+id/light_color"
- android:layout_width="32dip"
- android:layout_height="wrap_content"
- android:layout_gravity="center"/>
-
-</LinearLayout>
diff --git a/res/layout/preference_number_picker.xml b/res/layout/preference_number_picker.xml
deleted file mode 100644
index f53e62b..0000000
--- a/res/layout/preference_number_picker.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:paddingStart="@dimen/alert_dialog_padding_material"
- android:paddingEnd="@dimen/alert_dialog_padding_material" >
- <NumberPicker
- android:id="@+id/number_picker"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="6dip"
- android:layout_marginTop="6dip" />
-</LinearLayout>
diff --git a/res/layout/preference_seek_bar.xml b/res/layout/preference_seek_bar.xml
new file mode 100644
index 0000000..d988419
--- /dev/null
+++ b/res/layout/preference_seek_bar.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2016 The OmniROM Project
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<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"
+ android:orientation="horizontal" >
+
+ <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>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:gravity="center_vertical"
+ android:layout_weight="1" >
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="6dip"
+ android:layout_marginTop="10dip"
+ android:layout_marginBottom="6dip" >
+
+ <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" />
+
+ <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="10"
+ android:ellipsize="end" />
+
+ </RelativeLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:layout_marginStart="10dip"
+ android:layout_marginEnd="6dip"
+ android:layout_marginTop="5dip"
+ android:layout_marginBottom="10dip">
+
+ <TextView android:id="@+id/seekBarPrefUnitsLeft"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
+ <SeekBar android:id="@+id/seekbar"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingLeft="5dp"
+ android:paddingRight="5dp" />
+
+ <TextView android:id="@+id/seekBarPrefValue"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingRight="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
+ <TextView android:id="@+id/seekBarPrefUnitsRight"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall" />
+
+ </LinearLayout>
+ </LinearLayout>
+</LinearLayout>
diff --git a/res/layout/seek_bar_preference.xml b/res/layout/seek_bar_preference.xml
deleted file mode 100644
index e73efd5..0000000
--- a/res/layout/seek_bar_preference.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2016 The OmniROM Project
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
--->
-<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:paddingEnd="?android:attr/scrollbarSize"
- android:background="?android:attr/selectableItemBackground"
- android:orientation="vertical"
- android:focusable="true"
- android:layout_marginStart="60dp" >
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="12dip"
- android:layout_marginEnd="6dip"
- android:layout_marginTop="10dip"
- android:layout_marginBottom="6dip"
- android:layout_weight="1">
-
- <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" />
-
- <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="10"
- android:ellipsize="end" />
-
- </RelativeLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:layout_marginStart="15dip"
- android:layout_marginEnd="6dip"
- android:layout_marginTop="5dip"
- android:layout_marginBottom="10dip" >
-
- <TextView android:id="@+id/seekBarPrefUnitsLeft"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <SeekBar android:id="@+id/seekbar"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:paddingLeft="5dp"
- android:paddingRight="5dp" />
-
- <TextView android:id="@+id/seekBarPrefValue"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingRight="5dp"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <TextView android:id="@+id/seekBarPrefUnitsRight"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- </LinearLayout>
-</LinearLayout>
diff --git a/res/xml/battery_light_settings.xml b/res/xml/battery_light_settings.xml
index 776a0dd..6e15acc 100644
--- a/res/xml/battery_light_settings.xml
+++ b/res/xml/battery_light_settings.xml
@@ -45,22 +45,22 @@
android:title="@string/battery_light_list_title"
android:dependency="battery_light_enabled" >
- <org.omnirom.omnigears.batterylight.BatteryLightPreference
+ <org.omnirom.omnigears.preference.ColorSelectPreference
android:key="low_color"
android:title="@string/battery_light_low_color_title"
android:persistent="false" />
- <org.omnirom.omnigears.batterylight.BatteryLightPreference
+ <org.omnirom.omnigears.preference.ColorSelectPreference
android:key="medium_color"
android:title="@string/battery_light_medium_color_title"
android:persistent="false" />
- <org.omnirom.omnigears.batterylight.BatteryLightPreference
+ <org.omnirom.omnigears.preference.ColorSelectPreference
android:key="full_color"
android:title="@string/battery_light_full_color_title"
android:persistent="false" />
- <org.omnirom.omnigears.batterylight.BatteryLightPreference
+ <org.omnirom.omnigears.preference.ColorSelectPreference
android:key="really_full_color"
android:title="@string/battery_light_really_full_color_title"
android:persistent="false" />
@@ -78,7 +78,7 @@
android:summary="@string/fast_charging_led_enabled_summary"
android:defaultValue="false" />
- <org.omnirom.omnigears.batterylight.BatteryLightPreference
+ <org.omnirom.omnigears.preference.ColorSelectPreference
android:key="fast_color"
android:title="@string/fast_charging_light_color_title"
android:summary="@string/fast_charging_light_color_summary"
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java b/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java
index 383bce0..3175368 100644
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java
+++ b/src/org/omnirom/omnigears/batterylight/BatteryLightSettings.java
@@ -40,6 +40,7 @@
import com.android.settings.search.Indexable;
import org.omnirom.omnigears.preference.SystemSettingSwitchPreference;
+import org.omnirom.omnigears.preference.ColorSelectPreference;
import java.util.List;
import java.util.ArrayList;
@@ -67,11 +68,11 @@
private SystemSettingSwitchPreference mOnlyFullPref;
private SystemSettingSwitchPreference mFastBatteryLightEnabledPref;
private PreferenceGroup mColorPrefs;
- private BatteryLightPreference mLowColorPref;
- private BatteryLightPreference mMediumColorPref;
- private BatteryLightPreference mFullColorPref;
- private BatteryLightPreference mReallyFullColorPref;
- private BatteryLightPreference mFastColorPref;
+ private ColorSelectPreference mLowColorPref;
+ private ColorSelectPreference mMediumColorPref;
+ private ColorSelectPreference mFullColorPref;
+ private ColorSelectPreference mReallyFullColorPref;
+ private ColorSelectPreference mFastColorPref;
private static final int MENU_RESET = Menu.FIRST;
private int mLowBatteryWarningLevel;
private boolean mBatteryLightEnabled;
@@ -112,21 +113,21 @@
setHasOptionsMenu(true);
// Low, Medium and full color preferences
- mLowColorPref = (BatteryLightPreference) prefSet.findPreference(LOW_COLOR_PREF);
+ mLowColorPref = (ColorSelectPreference) prefSet.findPreference(LOW_COLOR_PREF);
mLowColorPref.setOnPreferenceChangeListener(this);
- mMediumColorPref = (BatteryLightPreference) prefSet.findPreference(MEDIUM_COLOR_PREF);
+ mMediumColorPref = (ColorSelectPreference) prefSet.findPreference(MEDIUM_COLOR_PREF);
mMediumColorPref.setOnPreferenceChangeListener(this);
- mFullColorPref = (BatteryLightPreference) prefSet.findPreference(FULL_COLOR_PREF);
+ mFullColorPref = (ColorSelectPreference) prefSet.findPreference(FULL_COLOR_PREF);
mFullColorPref.setOnPreferenceChangeListener(this);
- mReallyFullColorPref = (BatteryLightPreference) prefSet.findPreference(REALLY_FULL_COLOR_PREF);
+ mReallyFullColorPref = (ColorSelectPreference) prefSet.findPreference(REALLY_FULL_COLOR_PREF);
mReallyFullColorPref.setOnPreferenceChangeListener(this);
mFastBatteryLightEnabledPref = (SystemSettingSwitchPreference)prefSet.findPreference(FAST_CHARGING_LED_PREF);
- mFastColorPref = (BatteryLightPreference) prefSet.findPreference(FAST_COLOR_PREF);
+ mFastColorPref = (ColorSelectPreference) prefSet.findPreference(FAST_COLOR_PREF);
mFastColorPref.setOnPreferenceChangeListener(this);
// Does the Device support fast charge ?
@@ -265,7 +266,7 @@
// If enabled, disable all but really full color preference.
updateEnablement(value);
} else {
- BatteryLightPreference lightPref = (BatteryLightPreference) preference;
+ ColorSelectPreference lightPref = (ColorSelectPreference) preference;
updateValues(lightPref.getKey(), lightPref.getColor());
}
return true;
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java b/src/org/omnirom/omnigears/preference/ColorSelectDialog.java
similarity index 97%
rename from src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java
rename to src/org/omnirom/omnigears/preference/ColorSelectDialog.java
index cb1e820..68f4f81 100644
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightDialog.java
+++ b/src/org/omnirom/omnigears/preference/ColorSelectDialog.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.omnirom.omnigears.batterylight;
+package org.omnirom.omnigears.preference;
import android.app.Activity;
import android.app.AlertDialog;
@@ -51,10 +51,10 @@
import java.util.IllegalFormatException;
import java.util.Locale;
-public class BatteryLightDialog extends AlertDialog implements
+public class ColorSelectDialog extends AlertDialog implements
ColorPickerView.OnColorChangedListener, TextWatcher, OnFocusChangeListener {
- private static final String TAG = "BatteryLightDialog";
+ private static final String TAG = "ColorSelectDialog";
private final static String STATE_KEY_COLOR = "BatteryLightDialog:color";
private ColorPickerView mColorPicker;
@@ -70,7 +70,7 @@
private LedColorAdapter mLedColorAdapter;
private boolean mWithAlpha;
- protected BatteryLightDialog(Context context, int initialColor) {
+ protected ColorSelectDialog(Context context, int initialColor) {
super(context);
mWithAlpha = false;
mMultiColor = getContext().getResources().getBoolean(R.bool.config_has_multi_color_led);
diff --git a/src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java b/src/org/omnirom/omnigears/preference/ColorSelectPreference.java
similarity index 88%
rename from src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java
rename to src/org/omnirom/omnigears/preference/ColorSelectPreference.java
index ffc203f..d969a33 100644
--- a/src/org/omnirom/omnigears/batterylight/BatteryLightPreference.java
+++ b/src/org/omnirom/omnigears/preference/ColorSelectPreference.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.omnirom.omnigears.batterylight;
+package org.omnirom.omnigears.preference;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -30,9 +30,9 @@
import com.android.settings.R;
-public class BatteryLightPreference extends Preference implements DialogInterface.OnDismissListener {
+public class ColorSelectPreference extends Preference implements DialogInterface.OnDismissListener {
- private static String TAG = "BatteryLightPreference";
+ private static String TAG = "ColorSelectPreference";
public static final int DEFAULT_COLOR = 0xFFFFFF; //White
private ImageView mLightColorView;
@@ -44,20 +44,20 @@
* @param context
* @param attrs
*/
- public BatteryLightPreference(Context context, AttributeSet attrs) {
+ public ColorSelectPreference(Context context, AttributeSet attrs) {
super(context, attrs);
mColorValue = DEFAULT_COLOR;
init();
}
- public BatteryLightPreference(Context context, int color) {
+ public ColorSelectPreference(Context context, int color) {
super(context, null);
mColorValue = color;
init();
}
private void init() {
- setLayoutResource(R.layout.preference_battery_light);
+ setLayoutResource(R.layout.preference_color_select);
mResources = getContext().getResources();
}
@@ -98,7 +98,7 @@
}
public Dialog getDialog() {
- final BatteryLightDialog d = new BatteryLightDialog(getContext(),
+ final ColorSelectDialog d = new ColorSelectDialog(getContext(),
0xFF000000 | mColorValue);
d.setButton(AlertDialog.BUTTON_POSITIVE, mResources.getString(R.string.ok),
diff --git a/src/org/omnirom/omnigears/preference/SeekBarPreference.java b/src/org/omnirom/omnigears/preference/SeekBarPreference.java
index 5dd88ee..260ae96 100644
--- a/src/org/omnirom/omnigears/preference/SeekBarPreference.java
+++ b/src/org/omnirom/omnigears/preference/SeekBarPreference.java
@@ -60,7 +60,7 @@
private void initPreference(Context context, AttributeSet attrs) {
setValuesFromXml(attrs);
- setLayoutResource(R.layout.seek_bar_preference);
+ setLayoutResource(R.layout.preference_seek_bar);
}
private void setValuesFromXml(AttributeSet attrs) {