summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-10 21:28:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-10 21:28:32 +0000
commit2964c7b8af15571e2967622eac0161c065880b3c (patch)
treeeaa5f324b7b2898e01afc85dd944ddd785f82172
parent09425e506948648a469e2ed0b244fc65c85fafc0 (diff)
parent5c3188e75e33c8edaf18af71fa681cd7759aee87 (diff)
downloadframeworks_base-2964c7b8af15571e2967622eac0161c065880b3c.zip
frameworks_base-2964c7b8af15571e2967622eac0161c065880b3c.tar.gz
frameworks_base-2964c7b8af15571e2967622eac0161c065880b3c.tar.bz2
Merge "Update seek bar dialog preference for Material" into mnc-dev
-rw-r--r--core/java/android/preference/SeekBarDialogPreference.java19
-rw-r--r--core/java/android/preference/VolumePreference.java26
-rw-r--r--core/res/res/layout/preference_dialog_seekbar.xml (renamed from core/res/res/layout/seekbar_dialog.xml)33
-rw-r--r--core/res/res/layout/preference_dialog_seekbar_material.xml37
-rw-r--r--core/res/res/values/attrs.xml2
-rw-r--r--core/res/res/values/styles.xml4
-rw-r--r--core/res/res/values/styles_material.xml4
-rwxr-xr-xcore/res/res/values/symbols.xml2
-rw-r--r--core/res/res/values/themes.xml1
-rw-r--r--core/res/res/values/themes_material.xml2
10 files changed, 93 insertions, 37 deletions
diff --git a/core/java/android/preference/SeekBarDialogPreference.java b/core/java/android/preference/SeekBarDialogPreference.java
index 9a08827..eeb69a3 100644
--- a/core/java/android/preference/SeekBarDialogPreference.java
+++ b/core/java/android/preference/SeekBarDialogPreference.java
@@ -18,29 +18,28 @@ package android.preference;
import android.content.Context;
import android.graphics.drawable.Drawable;
-import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
+import com.android.internal.R;
+
/**
* @hide
*/
public class SeekBarDialogPreference extends DialogPreference {
- private static final String TAG = "SeekBarDialogPreference";
-
- private Drawable mMyIcon;
+ private final Drawable mMyIcon;
public SeekBarDialogPreference(
Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
- setDialogLayoutResource(com.android.internal.R.layout.seekbar_dialog);
createActionButtons();
// Steal the XML dialogIcon attribute's value
mMyIcon = getDialogIcon();
+
setDialogIcon(null);
}
@@ -49,7 +48,7 @@ public class SeekBarDialogPreference extends DialogPreference {
}
public SeekBarDialogPreference(Context context, AttributeSet attrs) {
- this(context, attrs, com.android.internal.R.attr.dialogPreferenceStyle);
+ this(context, attrs, R.attr.seekBarDialogPreferenceStyle);
}
public SeekBarDialogPreference(Context context) {
@@ -58,15 +57,15 @@ public class SeekBarDialogPreference extends DialogPreference {
// Allow subclasses to override the action buttons
public void createActionButtons() {
- setPositiveButtonText(android.R.string.ok);
- setNegativeButtonText(android.R.string.cancel);
+ setPositiveButtonText(R.string.ok);
+ setNegativeButtonText(R.string.cancel);
}
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
- final ImageView iconView = (ImageView) view.findViewById(android.R.id.icon);
+ final ImageView iconView = (ImageView) view.findViewById(R.id.icon);
if (mMyIcon != null) {
iconView.setImageDrawable(mMyIcon);
} else {
@@ -75,6 +74,6 @@ public class SeekBarDialogPreference extends DialogPreference {
}
protected static SeekBar getSeekBar(View dialogView) {
- return (SeekBar) dialogView.findViewById(com.android.internal.R.id.seekbar);
+ return (SeekBar) dialogView.findViewById(R.id.seekbar);
}
}
diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index a2da01b..573499a 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -26,14 +26,13 @@ import android.view.KeyEvent;
import android.view.View;
import android.widget.SeekBar;
+import com.android.internal.R;
+
/**
* @hide
*/
public class VolumePreference extends SeekBarDialogPreference implements
PreferenceManager.OnActivityStopListener, View.OnKeyListener, SeekBarVolumizer.Callback {
-
- static final String TAG = "VolumePreference";
-
private int mStreamType;
/** May be null if the dialog isn't visible. */
@@ -44,7 +43,7 @@ public class VolumePreference extends SeekBarDialogPreference implements
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(attrs,
- com.android.internal.R.styleable.VolumePreference, defStyleAttr, defStyleRes);
+ R.styleable.VolumePreference, defStyleAttr, defStyleRes);
mStreamType = a.getInt(android.R.styleable.VolumePreference_streamType, 0);
a.recycle();
}
@@ -54,7 +53,11 @@ public class VolumePreference extends SeekBarDialogPreference implements
}
public VolumePreference(Context context, AttributeSet attrs) {
- this(context, attrs, com.android.internal.R.attr.dialogPreferenceStyle);
+ this(context, attrs, R.attr.seekBarDialogPreferenceStyle);
+ }
+
+ public VolumePreference(Context context) {
+ this(context, null);
}
public void setStreamType(int streamType) {
@@ -65,7 +68,7 @@ public class VolumePreference extends SeekBarDialogPreference implements
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
- final SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
+ final SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
mSeekBarVolumizer = new SeekBarVolumizer(getContext(), mStreamType, null, this);
mSeekBarVolumizer.start();
mSeekBarVolumizer.setSeekBar(seekBar);
@@ -128,14 +131,17 @@ public class VolumePreference extends SeekBarDialogPreference implements
getPreferenceManager().unregisterOnActivityStopListener(this);
if (mSeekBarVolumizer != null) {
- Dialog dialog = getDialog();
+ final Dialog dialog = getDialog();
if (dialog != null && dialog.isShowing()) {
- View view = dialog.getWindow().getDecorView()
- .findViewById(com.android.internal.R.id.seekbar);
- if (view != null) view.setOnKeyListener(null);
+ final View view = dialog.getWindow().getDecorView().findViewById(R.id.seekbar);
+ if (view != null) {
+ view.setOnKeyListener(null);
+ }
+
// Stopped while dialog was showing, revert changes
mSeekBarVolumizer.revertVolume();
}
+
mSeekBarVolumizer.stop();
mSeekBarVolumizer = null;
}
diff --git a/core/res/res/layout/seekbar_dialog.xml b/core/res/res/layout/preference_dialog_seekbar.xml
index 84352a5..4e366c4 100644
--- a/core/res/res/layout/seekbar_dialog.xml
+++ b/core/res/res/layout/preference_dialog_seekbar.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
+<!-- Copyright (C) 2015 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.
@@ -15,20 +15,21 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="20dp" />
+
+ <SeekBar
+ android:id="@+id/seekbar"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:gravity="center_horizontal">
-
- <ImageView android:id="@+id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingTop="20dip" />
-
- <SeekBar android:id="@+id/seekbar"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="20dip" />
-
+ android:layout_height="wrap_content"
+ android:padding="20dp" />
+
</LinearLayout>
-
diff --git a/core/res/res/layout/preference_dialog_seekbar_material.xml b/core/res/res/layout/preference_dialog_seekbar_material.xml
new file mode 100644
index 0000000..a98a995
--- /dev/null
+++ b/core/res/res/layout/preference_dialog_seekbar_material.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="?attr/dialogPreferredPadding" />
+
+ <SeekBar
+ android:id="@+id/seekbar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="?attr/dialogPreferredPadding"
+ android:paddingStart="?attr/dialogPreferredPadding"
+ android:paddingEnd="?attr/dialogPreferredPadding" />
+
+</LinearLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a13f494..0f66950 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -868,6 +868,8 @@
<attr name="dialogPreferenceStyle" format="reference" />
<!-- Default style for EditTextPreference. -->
<attr name="editTextPreferenceStyle" format="reference" />
+ <!-- @hide Default style for SeekBarDialogPreference. -->
+ <attr name="seekBarDialogPreferenceStyle" format="reference" />
<!-- Default style for RingtonePreference. -->
<attr name="ringtonePreferenceStyle" format="reference" />
<!-- The preference layout that has the child/tabbed effect. -->
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 4eba117..4bad16d 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1017,6 +1017,10 @@ please see styles_device_defaults.xml.
<item name="negativeButtonText">@string/no</item>
</style>
+ <style name="Preference.DialogPreference.SeekBarPreference">
+ <item name="dialogLayout">@layout/preference_dialog_seekbar</item>
+ </style>
+
<style name="Preference.DialogPreference.EditTextPreference">
<item name="dialogLayout">@layout/preference_dialog_edittext</item>
</style>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index df4106e..70f9c02 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -87,6 +87,10 @@ please see styles_device_defaults.xml.
<item name="negativeButtonText">@string/no</item>
</style>
+ <style name="Preference.Material.DialogPreference.SeekBarPreference">
+ <item name="dialogLayout">@layout/preference_dialog_seekbar_material</item>
+ </style>
+
<style name="Preference.Material.DialogPreference.EditTextPreference">
<item name="dialogLayout">@layout/preference_dialog_edittext_material</item>
</style>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 15b253d..099f6c1 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1341,7 +1341,6 @@
<java-symbol type="layout" name="preference_widget_seekbar" />
<java-symbol type="layout" name="progress_dialog" />
<java-symbol type="layout" name="resolve_list_item" />
- <java-symbol type="layout" name="seekbar_dialog" />
<java-symbol type="layout" name="select_dialog_singlechoice_holo" />
<java-symbol type="layout" name="ssl_certificate" />
<java-symbol type="layout" name="tab_content" />
@@ -2292,4 +2291,5 @@
<java-symbol type="string" name="config_radio_access_family" />
<java-symbol type="string" name="notification_inbox_ellipsis" />
<java-symbol type="bool" name="config_mainBuiltInDisplayIsRound" />
+ <java-symbol type="attr" name="seekBarDialogPreferenceStyle" />
</resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 9e87b4d..1230b5e 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -331,6 +331,7 @@ please see themes_device_defaults.xml.
<item name="seekBarPreferenceStyle">@style/Preference.SeekBarPreference</item>
<item name="yesNoPreferenceStyle">@style/Preference.DialogPreference.YesNoPreference</item>
<item name="dialogPreferenceStyle">@style/Preference.DialogPreference</item>
+ <item name="seekBarDialogPreferenceStyle">@style/Preference.DialogPreference.SeekBarPreference</item>
<item name="editTextPreferenceStyle">@style/Preference.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@style/Preference.RingtonePreference</item>
<item name="preferenceLayoutChild">@layout/preference_child</item>
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index 9f3668d..9fe8df4 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -295,6 +295,7 @@ please see themes_device_defaults.xml.
<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="seekBarDialogPreferenceStyle">@style/Preference.Material.DialogPreference.SeekBarPreference</item>
<item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@style/Preference.Material.RingtonePreference</item>
<item name="preferenceLayoutChild">@layout/preference_child_material</item>
@@ -651,6 +652,7 @@ please see themes_device_defaults.xml.
<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="seekBarDialogPreferenceStyle">@style/Preference.Material.DialogPreference.SeekBarPreference</item>
<item name="editTextPreferenceStyle">@style/Preference.Material.DialogPreference.EditTextPreference</item>
<item name="ringtonePreferenceStyle">@style/Preference.Material.RingtonePreference</item>
<item name="preferenceLayoutChild">@layout/preference_child_material</item>