diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/preference/SeekBarPreference.java | 14 | ||||
-rw-r--r-- | core/res/res/layout/preference_widget_seekbar.xml | 4 | ||||
-rw-r--r-- | core/res/res/layout/preference_widget_seekbar_material.xml | 86 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 6 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 8 | ||||
-rw-r--r-- | core/res/res/values/styles_device_defaults.xml | 1 | ||||
-rw-r--r-- | core/res/res/values/styles_material.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
-rw-r--r-- | core/res/res/values/themes.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/themes_device_defaults.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/themes_material.xml | 2 |
11 files changed, 125 insertions, 6 deletions
diff --git a/core/java/android/preference/SeekBarPreference.java b/core/java/android/preference/SeekBarPreference.java index e32890d..67f6409 100644 --- a/core/java/android/preference/SeekBarPreference.java +++ b/core/java/android/preference/SeekBarPreference.java @@ -40,11 +40,19 @@ public class SeekBarPreference extends Preference Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - final TypedArray a = context.obtainStyledAttributes( + TypedArray a = context.obtainStyledAttributes( attrs, com.android.internal.R.styleable.ProgressBar, defStyleAttr, defStyleRes); setMax(a.getInt(com.android.internal.R.styleable.ProgressBar_max, mMax)); a.recycle(); - setLayoutResource(com.android.internal.R.layout.preference_widget_seekbar); + + a = context.obtainStyledAttributes(attrs, + com.android.internal.R.styleable.SeekBarPreference, defStyleAttr, defStyleRes); + final int layoutResId = a.getResourceId( + com.android.internal.R.styleable.SeekBarPreference_layout, + com.android.internal.R.layout.preference_widget_seekbar); + a.recycle(); + + setLayoutResource(layoutResId); } public SeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) { @@ -52,7 +60,7 @@ public class SeekBarPreference extends Preference } public SeekBarPreference(Context context, AttributeSet attrs) { - this(context, attrs, 0); + this(context, attrs, com.android.internal.R.attr.seekBarPreferenceStyle); } public SeekBarPreference(Context context) { diff --git a/core/res/res/layout/preference_widget_seekbar.xml b/core/res/res/layout/preference_widget_seekbar.xml index c427965..05daa1a 100644 --- a/core/res/res/layout/preference_widget_seekbar.xml +++ b/core/res/res/layout/preference_widget_seekbar.xml @@ -14,9 +14,7 @@ limitations under the License. --> -<!-- Layout for a Preference in a PreferenceActivity. The - Preference is able to place a specific widget for its particular - type in the "widget_frame" layout. --> +<!-- Layout used by SeekBarPreference for the seekbar widget style. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/core/res/res/layout/preference_widget_seekbar_material.xml b/core/res/res/layout/preference_widget_seekbar_material.xml new file mode 100644 index 0000000..f70a472 --- /dev/null +++ b/core/res/res/layout/preference_widget_seekbar_material.xml @@ -0,0 +1,86 @@ +<?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. +--> + +<!-- Layout used by SeekBarPreference for the seekbar widget style. --> +<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="?attr/listPreferredItemPaddingStart" + android:paddingEnd="?attr/listPreferredItemPaddingEnd"> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center" + android:minWidth="@dimen/preference_icon_minWidth" + android:orientation="horizontal"> + <ImageView + android:id="@+android:id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:minWidth="48dp" + /> + </LinearLayout> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dip" + android:layout_marginEnd="8dip" + android:layout_marginTop="6dip" + 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/textAppearanceMedium" + 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/textAppearanceSmall" + android:textColor="?android:attr/textColorSecondary" + android:maxLines="4" /> + + <!-- Preference should place its actual preference widget here. --> + <LinearLayout android:id="@+android:id/widget_frame" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_below="@android:id/summary" + android:layout_alignStart="@android:id/title" + android:minWidth="@dimen/preference_widget_width" + android:gravity="center" + android:orientation="vertical" /> + + <SeekBar android:id="@+android:id/seekbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@android:id/summary" + android:layout_toEndOf="@android:id/widget_frame" + android:layout_alignParentEnd="true" /> + + </RelativeLayout> + +</LinearLayout> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 5213896..e807d69 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -834,6 +834,8 @@ <attr name="preferenceFragmentPaddingSide" format="dimension" /> <!-- Default style for switch preferences. --> <attr name="switchPreferenceStyle" format="reference" /> + <!-- Default style for seekbar preferences. --> + <attr name="seekBarPreferenceStyle" format="reference" /> <!-- ============================ --> <!-- Text selection handle styles --> @@ -6607,6 +6609,10 @@ <attr name="disableDependentsState" /> </declare-styleable> + <declare-styleable name="SeekBarPreference"> + <attr name="layout" /> + </declare-styleable> + <!-- Use <code>tts-engine</code> as the root tag of the XML resource that describes a text to speech engine implemented as a subclass of {@link android.speech.tts.TextToSpeechService}. diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 5bd6122..d6be3133 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -980,6 +980,10 @@ please see styles_device_defaults.xml. <item name="android:switchTextOff">@android:string/capital_off</item> </style> + <style name="Preference.SeekBarPreference"> + <item name="android:layout">@android:layout/preference_widget_seekbar</item> + </style> + <style name="Preference.PreferenceScreen"> </style> @@ -1035,6 +1039,10 @@ please see styles_device_defaults.xml. <item name="android:switchTextOff">@android:string/capital_off</item> </style> + <style name="Preference.Holo.SeekBarPreference"> + <item name="android:layout">@android:layout/preference_widget_seekbar</item> + </style> + <style name="Preference.Holo.PreferenceScreen"> </style> diff --git a/core/res/res/values/styles_device_defaults.xml b/core/res/res/values/styles_device_defaults.xml index 84dbc79..84d38ce 100644 --- a/core/res/res/values/styles_device_defaults.xml +++ b/core/res/res/values/styles_device_defaults.xml @@ -254,6 +254,7 @@ easier. <style name="Preference.DeviceDefault.PreferenceScreen" parent="Preference.Material.PreferenceScreen"/> <style name="Preference.DeviceDefault.RingtonePreference" parent="Preference.Material.RingtonePreference"/> <style name="Preference.DeviceDefault.SwitchPreference" parent="Preference.Material.SwitchPreference"/> + <style name="Preference.DeviceDefault.SeekBarPreference" parent="Preference.Material.SeekBarPreference"/> <!-- AlertDialog Styles --> <style name="AlertDialog.DeviceDefault" parent="AlertDialog.Material"/> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 0c95149..25307b9 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -64,6 +64,10 @@ please see styles_device_defaults.xml. <item name="switchTextOff">@string/capital_off</item> </style> + <style name="Preference.Material.SeekBarPreference"> + <item name="layout">@android:layout/preference_widget_seekbar_material</item> + </style> + <style name="Preference.Material.PreferenceScreen"/> <style name="Preference.Material.DialogPreference"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d69f60a..5f4553b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1893,5 +1893,6 @@ <java-symbol type="color" name="timepicker_default_selector_color_material" /> <java-symbol type="color" name="timepicker_default_numbers_background_color_material" /> <java-symbol type="style" name="TextAppearance.Material.TimePicker.TimeLabel" /> + <java-symbol type="attr" name="seekBarPreferenceStyle" /> </resources> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index cb5cb0c..5eec197 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -321,6 +321,7 @@ please see themes_device_defaults.xml. <item name="preferenceInformationStyle">@android:style/Preference.Information</item> <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item> <item name="switchPreferenceStyle">@android:style/Preference.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@android:style/Preference.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item> <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item> @@ -1203,6 +1204,7 @@ please see themes_device_defaults.xml. <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item> <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item> <item name="switchPreferenceStyle">@android:style/Preference.Holo.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@android:style/Preference.Holo.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item> <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item> @@ -1543,6 +1545,7 @@ please see themes_device_defaults.xml. <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item> <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item> <item name="switchPreferenceStyle">@android:style/Preference.Holo.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@android:style/Preference.Holo.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item> <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item> diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index 27c8754..8e83e48 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -160,6 +160,7 @@ easier. <item name="preferenceInformationStyle">@style/Preference.DeviceDefault.Information</item> <item name="checkBoxPreferenceStyle">@style/Preference.DeviceDefault.CheckBoxPreference</item> <item name="switchPreferenceStyle">@style/Preference.DeviceDefault.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@style/Preference.DeviceDefault.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference</item> <item name="editTextPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item> @@ -421,6 +422,7 @@ easier. <item name="preferenceInformationStyle">@style/Preference.DeviceDefault.Information</item> <item name="checkBoxPreferenceStyle">@style/Preference.DeviceDefault.CheckBoxPreference</item> <item name="switchPreferenceStyle">@style/Preference.DeviceDefault.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@style/Preference.DeviceDefault.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference</item> <item name="editTextPreferenceStyle">@style/Preference.DeviceDefault.DialogPreference.EditTextPreference</item> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 769c8a1..77e4307 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -282,6 +282,7 @@ please see themes_device_defaults.xml. <item name="preferenceInformationStyle">@style/Preference.Material.Information</item> <item name="checkBoxPreferenceStyle">@style/Preference.Material.CheckBoxPreference</item> <item name="switchPreferenceStyle">@style/Preference.Material.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@style/Preference.Material.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.Material.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.Material.DialogPreference</item> <item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item> @@ -634,6 +635,7 @@ please see themes_device_defaults.xml. <item name="preferenceInformationStyle">@style/Preference.Material.Information</item> <item name="checkBoxPreferenceStyle">@style/Preference.Material.CheckBoxPreference</item> <item name="switchPreferenceStyle">@style/Preference.Material.SwitchPreference</item> + <item name="seekBarPreferenceStyle">@style/Preference.Material.SeekBarPreference</item> <item name="yesNoPreferenceStyle">@style/Preference.Material.DialogPreference.YesNoPreference</item> <item name="dialogPreferenceStyle">@style/Preference.Material.DialogPreference</item> <item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item> |