summaryrefslogtreecommitdiffstats
path: root/v7/preference
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-03-10 19:23:13 -0800
committerSteve Kondik <steve@cyngn.com>2016-03-10 19:23:13 -0800
commit98e06d73262bc654d546ef2ded2cd6c4db5b92bf (patch)
treed923c571c21849bf53185b26e3570fdb25fabff9 /v7/preference
parent6f0a2cb4415e2e170528c038a8f1cc2f68f60c3c (diff)
parent4097efdd93078034122f17442d5b4df675d1028a (diff)
downloadandroid_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.tar.gz
android_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.tar.bz2
android_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.zip
Merge tag 'android-6.0.1_r22' of https://android.googlesource.com/platform/frameworks/support into cm-13.0staging/cm-13.0+r22
Android 6.0.1 release 22 Change-Id: I032842dcd2a5a216a56a47a7cb109f0cee8ac251
Diffstat (limited to 'v7/preference')
-rw-r--r--v7/preference/NOTICES.md11
-rw-r--r--v7/preference/api/23.0.0.txt (renamed from v7/preference/api/23.txt)0
-rw-r--r--v7/preference/api/23.1.0.txt318
-rw-r--r--v7/preference/api/current.txt7
-rw-r--r--v7/preference/build.gradle34
-rw-r--r--v7/preference/proguard-rules.pro8
-rw-r--r--v7/preference/res/layout/preference_dialog_edittext.xml6
-rw-r--r--v7/preference/res/layout/preference_information.xml6
-rw-r--r--v7/preference/res/values-v17/styles.xml1
-rw-r--r--v7/preference/res/values/attrs.xml479
-rw-r--r--v7/preference/res/values/styles.xml29
-rw-r--r--v7/preference/res/values/themes.xml2
-rw-r--r--v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java33
-rw-r--r--v7/preference/src/android/support/v7/preference/Preference.java14
-rw-r--r--v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java137
-rw-r--r--v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java17
-rw-r--r--v7/preference/src/android/support/v7/preference/PreferenceViewHolder.java42
17 files changed, 845 insertions, 299 deletions
diff --git a/v7/preference/NOTICES.md b/v7/preference/NOTICES.md
new file mode 100644
index 0000000000..4fe92cc7ed
--- /dev/null
+++ b/v7/preference/NOTICES.md
@@ -0,0 +1,11 @@
+# Change Log
+
+## [23.1.0](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v14/preference) (2015-09-28)
+
+**Breakage and deprecation notices:**
+
+- EditTextPreferenceDialogFragmentCompat
+ - onAddEditTextToDialogView has been removed. Any code depending on overriding this method should
+ be moved to onBindDialogView.
+ - The EditText view is now expected to be present in the dialog layout file with the id
+ @android:id/edit, and is no longer created in code.
diff --git a/v7/preference/api/23.txt b/v7/preference/api/23.0.0.txt
index 6ab53c5b44..6ab53c5b44 100644
--- a/v7/preference/api/23.txt
+++ b/v7/preference/api/23.0.0.txt
diff --git a/v7/preference/api/23.1.0.txt b/v7/preference/api/23.1.0.txt
new file mode 100644
index 0000000000..7d7aeb1ba9
--- /dev/null
+++ b/v7/preference/api/23.1.0.txt
@@ -0,0 +1,318 @@
+package android.support.v7.preference {
+
+ public class CheckBoxPreference extends android.support.v7.preference.TwoStatePreference {
+ ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int);
+ ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public CheckBoxPreference(android.content.Context, android.util.AttributeSet);
+ ctor public CheckBoxPreference(android.content.Context);
+ }
+
+ public abstract class DialogPreference extends android.support.v7.preference.Preference {
+ ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public DialogPreference(android.content.Context, android.util.AttributeSet, int);
+ ctor public DialogPreference(android.content.Context, android.util.AttributeSet);
+ ctor public DialogPreference(android.content.Context);
+ method public android.graphics.drawable.Drawable getDialogIcon();
+ method public int getDialogLayoutResource();
+ method public java.lang.CharSequence getDialogMessage();
+ method public java.lang.CharSequence getDialogTitle();
+ method public java.lang.CharSequence getNegativeButtonText();
+ method public java.lang.CharSequence getPositiveButtonText();
+ method public void setDialogIcon(android.graphics.drawable.Drawable);
+ method public void setDialogIcon(int);
+ method public void setDialogLayoutResource(int);
+ method public void setDialogMessage(java.lang.CharSequence);
+ method public void setDialogMessage(int);
+ method public void setDialogTitle(java.lang.CharSequence);
+ method public void setDialogTitle(int);
+ method public void setNegativeButtonText(java.lang.CharSequence);
+ method public void setNegativeButtonText(int);
+ method public void setPositiveButtonText(java.lang.CharSequence);
+ method public void setPositiveButtonText(int);
+ }
+
+ public static abstract interface DialogPreference.TargetFragment {
+ method public abstract android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
+ }
+
+ public class EditTextPreference extends android.support.v7.preference.DialogPreference {
+ ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public EditTextPreference(android.content.Context, android.util.AttributeSet, int);
+ ctor public EditTextPreference(android.content.Context, android.util.AttributeSet);
+ ctor public EditTextPreference(android.content.Context);
+ method public java.lang.String getText();
+ method public void setText(java.lang.String);
+ }
+
+ public class EditTextPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
+ ctor public EditTextPreferenceDialogFragmentCompat();
+ method public static android.support.v7.preference.EditTextPreferenceDialogFragmentCompat newInstance(java.lang.String);
+ method public void onDialogClosed(boolean);
+ }
+
+ public class ListPreference extends android.support.v7.preference.DialogPreference {
+ ctor public ListPreference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public ListPreference(android.content.Context, android.util.AttributeSet, int);
+ ctor public ListPreference(android.content.Context, android.util.AttributeSet);
+ ctor public ListPreference(android.content.Context);
+ method public int findIndexOfValue(java.lang.String);
+ method public java.lang.CharSequence[] getEntries();
+ method public java.lang.CharSequence getEntry();
+ method public java.lang.CharSequence[] getEntryValues();
+ method public java.lang.String getValue();
+ method public void setEntries(java.lang.CharSequence[]);
+ method public void setEntries(int);
+ method public void setEntryValues(java.lang.CharSequence[]);
+ method public void setEntryValues(int);
+ method public void setValue(java.lang.String);
+ method public void setValueIndex(int);
+ }
+
+ public class ListPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
+ ctor public ListPreferenceDialogFragmentCompat();
+ method public static android.support.v7.preference.ListPreferenceDialogFragmentCompat newInstance(java.lang.String);
+ method public void onDialogClosed(boolean);
+ }
+
+ public class Preference {
+ ctor public Preference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public Preference(android.content.Context, android.util.AttributeSet, int);
+ ctor public Preference(android.content.Context, android.util.AttributeSet);
+ ctor public Preference(android.content.Context);
+ method public boolean callChangeListener(java.lang.Object);
+ method public int compareTo(android.support.v7.preference.Preference);
+ method protected android.support.v7.preference.Preference findPreferenceInHierarchy(java.lang.String);
+ method public android.content.Context getContext();
+ method public java.lang.String getDependency();
+ method public android.os.Bundle getExtras();
+ method public java.lang.String getFragment();
+ method public android.graphics.drawable.Drawable getIcon();
+ method public android.content.Intent getIntent();
+ method public java.lang.String getKey();
+ method public final int getLayoutResource();
+ method public android.support.v7.preference.Preference.OnPreferenceChangeListener getOnPreferenceChangeListener();
+ method public android.support.v7.preference.Preference.OnPreferenceClickListener getOnPreferenceClickListener();
+ method public int getOrder();
+ method protected boolean getPersistedBoolean(boolean);
+ method protected float getPersistedFloat(float);
+ method protected int getPersistedInt(int);
+ method protected long getPersistedLong(long);
+ method protected java.lang.String getPersistedString(java.lang.String);
+ method public android.support.v7.preference.PreferenceManager getPreferenceManager();
+ method public android.content.SharedPreferences getSharedPreferences();
+ method public boolean getShouldDisableView();
+ method public java.lang.CharSequence getSummary();
+ method public java.lang.CharSequence getTitle();
+ method public final int getWidgetLayoutResource();
+ method public boolean hasKey();
+ method public boolean isEnabled();
+ method public boolean isPersistent();
+ method public boolean isSelectable();
+ method public final boolean isVisible();
+ method protected void notifyChanged();
+ method public void notifyDependencyChange(boolean);
+ method protected void notifyHierarchyChanged();
+ method public void onAttached();
+ method protected void onAttachedToHierarchy(android.support.v7.preference.PreferenceManager);
+ method public void onBindViewHolder(android.support.v7.preference.PreferenceViewHolder);
+ method protected void onClick();
+ method public void onDependencyChanged(android.support.v7.preference.Preference, boolean);
+ method protected java.lang.Object onGetDefaultValue(android.content.res.TypedArray, int);
+ method public void onParentChanged(android.support.v7.preference.Preference, boolean);
+ method protected void onPrepareForRemoval();
+ method protected void onRestoreInstanceState(android.os.Parcelable);
+ method protected android.os.Parcelable onSaveInstanceState();
+ method protected void onSetInitialValue(boolean, java.lang.Object);
+ method public android.os.Bundle peekExtras();
+ method protected boolean persistBoolean(boolean);
+ method protected boolean persistFloat(float);
+ method protected boolean persistInt(int);
+ method protected boolean persistLong(long);
+ method protected boolean persistString(java.lang.String);
+ method public void restoreHierarchyState(android.os.Bundle);
+ method public void saveHierarchyState(android.os.Bundle);
+ method public void setDefaultValue(java.lang.Object);
+ method public void setDependency(java.lang.String);
+ method public void setEnabled(boolean);
+ method public void setFragment(java.lang.String);
+ method public void setIcon(android.graphics.drawable.Drawable);
+ method public void setIcon(int);
+ method public void setIntent(android.content.Intent);
+ method public void setKey(java.lang.String);
+ method public void setLayoutResource(int);
+ method public void setOnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener);
+ method public void setOnPreferenceClickListener(android.support.v7.preference.Preference.OnPreferenceClickListener);
+ method public void setOrder(int);
+ method public void setPersistent(boolean);
+ method public void setSelectable(boolean);
+ method public void setShouldDisableView(boolean);
+ method public void setSummary(java.lang.CharSequence);
+ method public void setSummary(int);
+ method public void setTitle(java.lang.CharSequence);
+ method public void setTitle(int);
+ method public final void setVisible(boolean);
+ method public void setWidgetLayoutResource(int);
+ method public boolean shouldDisableDependents();
+ method protected boolean shouldPersist();
+ field public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff
+ }
+
+ public static class Preference.BaseSavedState extends android.view.AbsSavedState {
+ ctor public Preference.BaseSavedState(android.os.Parcel);
+ ctor public Preference.BaseSavedState(android.os.Parcelable);
+ field public static final android.os.Parcelable.Creator<android.support.v7.preference.Preference.BaseSavedState> CREATOR;
+ }
+
+ public static abstract interface Preference.OnPreferenceChangeListener {
+ method public abstract boolean onPreferenceChange(android.support.v7.preference.Preference, java.lang.Object);
+ }
+
+ public static abstract interface Preference.OnPreferenceClickListener {
+ method public abstract boolean onPreferenceClick(android.support.v7.preference.Preference);
+ }
+
+ public class PreferenceCategory extends android.support.v7.preference.PreferenceGroup {
+ ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet, int);
+ ctor public PreferenceCategory(android.content.Context, android.util.AttributeSet);
+ ctor public PreferenceCategory(android.content.Context);
+ }
+
+ public abstract class PreferenceDialogFragmentCompat extends android.support.v4.app.DialogFragment implements android.content.DialogInterface.OnClickListener {
+ ctor public PreferenceDialogFragmentCompat();
+ method public android.support.v7.preference.DialogPreference getPreference();
+ method protected void onBindDialogView(android.view.View);
+ method public void onClick(android.content.DialogInterface, int);
+ method protected android.view.View onCreateDialogView(android.content.Context);
+ method public abstract void onDialogClosed(boolean);
+ method protected void onPrepareDialogBuilder(android.support.v7.app.AlertDialog.Builder);
+ field protected static final java.lang.String ARG_KEY = "key";
+ }
+
+ public abstract class PreferenceFragmentCompat extends android.support.v4.app.Fragment implements android.support.v7.preference.DialogPreference.TargetFragment android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener {
+ ctor public PreferenceFragmentCompat();
+ method public void addPreferencesFromResource(int);
+ method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
+ method public final android.support.v7.widget.RecyclerView getListView();
+ method public android.support.v7.preference.PreferenceManager getPreferenceManager();
+ method public android.support.v7.preference.PreferenceScreen getPreferenceScreen();
+ method protected android.support.v7.widget.RecyclerView.Adapter onCreateAdapter(android.support.v7.preference.PreferenceScreen);
+ method public android.support.v7.widget.RecyclerView.LayoutManager onCreateLayoutManager();
+ method public abstract void onCreatePreferences(android.os.Bundle, java.lang.String);
+ method public android.support.v7.widget.RecyclerView onCreateRecyclerView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle);
+ method public void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
+ method public void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
+ method public boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
+ method public void setPreferenceScreen(android.support.v7.preference.PreferenceScreen);
+ method public void setPreferencesFromResource(int, java.lang.String);
+ field public static final java.lang.String ARG_PREFERENCE_ROOT = "android.support.v7.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
+ }
+
+ public static abstract interface PreferenceFragmentCompat.OnPreferenceDisplayDialogCallback {
+ method public abstract boolean onPreferenceDisplayDialog(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.Preference);
+ }
+
+ public static abstract interface PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
+ method public abstract boolean onPreferenceStartFragment(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.Preference);
+ }
+
+ public static abstract interface PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
+ method public abstract boolean onPreferenceStartScreen(android.support.v7.preference.PreferenceFragmentCompat, android.support.v7.preference.PreferenceScreen);
+ }
+
+ public abstract class PreferenceGroup extends android.support.v7.preference.Preference {
+ ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet, int);
+ ctor public PreferenceGroup(android.content.Context, android.util.AttributeSet);
+ method public void addItemFromInflater(android.support.v7.preference.Preference);
+ method public boolean addPreference(android.support.v7.preference.Preference);
+ method protected void dispatchRestoreInstanceState(android.os.Bundle);
+ method protected void dispatchSaveInstanceState(android.os.Bundle);
+ method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
+ method public android.support.v7.preference.Preference getPreference(int);
+ method public int getPreferenceCount();
+ method protected boolean isOnSameScreenAsChildren();
+ method public boolean isOrderingAsAdded();
+ method protected boolean onPrepareAddPreference(android.support.v7.preference.Preference);
+ method public void removeAll();
+ method public boolean removePreference(android.support.v7.preference.Preference);
+ method public void setOrderingAsAdded(boolean);
+ }
+
+ public class PreferenceManager {
+ method public android.support.v7.preference.PreferenceScreen createPreferenceScreen(android.content.Context);
+ method public android.support.v7.preference.Preference findPreference(java.lang.CharSequence);
+ method public android.content.Context getContext();
+ method public static android.content.SharedPreferences getDefaultSharedPreferences(android.content.Context);
+ method public android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener getOnDisplayPreferenceDialogListener();
+ method public android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener getOnNavigateToScreenListener();
+ method public android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener getOnPreferenceTreeClickListener();
+ method public android.support.v7.preference.PreferenceScreen getPreferenceScreen();
+ method public android.content.SharedPreferences getSharedPreferences();
+ method public int getSharedPreferencesMode();
+ method public java.lang.String getSharedPreferencesName();
+ method public static void setDefaultValues(android.content.Context, int, boolean);
+ method public static void setDefaultValues(android.content.Context, java.lang.String, int, int, boolean);
+ method public void setOnDisplayPreferenceDialogListener(android.support.v7.preference.PreferenceManager.OnDisplayPreferenceDialogListener);
+ method public void setOnNavigateToScreenListener(android.support.v7.preference.PreferenceManager.OnNavigateToScreenListener);
+ method public void setOnPreferenceTreeClickListener(android.support.v7.preference.PreferenceManager.OnPreferenceTreeClickListener);
+ method public boolean setPreferences(android.support.v7.preference.PreferenceScreen);
+ method public void setSharedPreferencesMode(int);
+ method public void setSharedPreferencesName(java.lang.String);
+ method public void showDialog(android.support.v7.preference.Preference);
+ field public static final java.lang.String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values";
+ }
+
+ public static abstract interface PreferenceManager.OnDisplayPreferenceDialogListener {
+ method public abstract void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
+ }
+
+ public static abstract interface PreferenceManager.OnNavigateToScreenListener {
+ method public abstract void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
+ }
+
+ public static abstract interface PreferenceManager.OnPreferenceTreeClickListener {
+ method public abstract boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
+ }
+
+ public final class PreferenceScreen extends android.support.v7.preference.PreferenceGroup {
+ }
+
+ public class PreferenceViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder {
+ method public android.view.View findViewById(int);
+ }
+
+ public class SwitchPreferenceCompat extends android.support.v7.preference.TwoStatePreference {
+ ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet, int);
+ ctor public SwitchPreferenceCompat(android.content.Context, android.util.AttributeSet);
+ ctor public SwitchPreferenceCompat(android.content.Context);
+ method public java.lang.CharSequence getSwitchTextOff();
+ method public java.lang.CharSequence getSwitchTextOn();
+ method public void setSwitchTextOff(java.lang.CharSequence);
+ method public void setSwitchTextOff(int);
+ method public void setSwitchTextOn(java.lang.CharSequence);
+ method public void setSwitchTextOn(int);
+ }
+
+ public abstract class TwoStatePreference extends android.support.v7.preference.Preference {
+ ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int, int);
+ ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet, int);
+ ctor public TwoStatePreference(android.content.Context, android.util.AttributeSet);
+ ctor public TwoStatePreference(android.content.Context);
+ method public boolean getDisableDependentsState();
+ method public java.lang.CharSequence getSummaryOff();
+ method public java.lang.CharSequence getSummaryOn();
+ method public boolean isChecked();
+ method public void setChecked(boolean);
+ method public void setDisableDependentsState(boolean);
+ method public void setSummaryOff(java.lang.CharSequence);
+ method public void setSummaryOff(int);
+ method public void setSummaryOn(java.lang.CharSequence);
+ method public void setSummaryOn(int);
+ method protected void syncSummaryView(android.support.v7.preference.PreferenceViewHolder);
+ field protected boolean mChecked;
+ }
+
+}
+
diff --git a/v7/preference/api/current.txt b/v7/preference/api/current.txt
index 6ab53c5b44..9034fd41ec 100644
--- a/v7/preference/api/current.txt
+++ b/v7/preference/api/current.txt
@@ -47,7 +47,6 @@ package android.support.v7.preference {
public class EditTextPreferenceDialogFragmentCompat extends android.support.v7.preference.PreferenceDialogFragmentCompat {
ctor public EditTextPreferenceDialogFragmentCompat();
method public static android.support.v7.preference.EditTextPreferenceDialogFragmentCompat newInstance(java.lang.String);
- method protected void onAddEditTextToDialogView(android.view.View, android.widget.EditText);
method public void onDialogClosed(boolean);
}
@@ -204,6 +203,8 @@ package android.support.v7.preference {
method public void onDisplayPreferenceDialog(android.support.v7.preference.Preference);
method public void onNavigateToScreen(android.support.v7.preference.PreferenceScreen);
method public boolean onPreferenceTreeClick(android.support.v7.preference.Preference);
+ method public void setDivider(android.graphics.drawable.Drawable);
+ method public void setDividerHeight(int);
method public void setPreferenceScreen(android.support.v7.preference.PreferenceScreen);
method public void setPreferencesFromResource(int, java.lang.String);
field public static final java.lang.String ARG_PREFERENCE_ROOT = "android.support.v7.preference.PreferenceFragmentCompat.PREFERENCE_ROOT";
@@ -281,6 +282,10 @@ package android.support.v7.preference {
public class PreferenceViewHolder extends android.support.v7.widget.RecyclerView.ViewHolder {
method public android.view.View findViewById(int);
+ method public boolean isDividerAllowedAbove();
+ method public boolean isDividerAllowedBelow();
+ method public void setDividerAllowedAbove(boolean);
+ method public void setDividerAllowedBelow(boolean);
}
public class SwitchPreferenceCompat extends android.support.v7.preference.TwoStatePreference {
diff --git a/v7/preference/build.gradle b/v7/preference/build.gradle
index d93a93db0c..a0681edb20 100644
--- a/v7/preference/build.gradle
+++ b/v7/preference/build.gradle
@@ -55,3 +55,37 @@ android {
consumerProguardFiles 'proguard-rules.pro'
}
}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: uri(rootProject.ext.supportRepoOut)) {
+ }
+
+ pom.project {
+ name 'Android Support Preference v7'
+ description "Android Support Preference v7"
+ url 'http://developer.android.com/tools/extras/support-library.html'
+ inceptionYear '2015'
+
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+
+ scm {
+ url "http://source.android.com"
+ connection "scm:git:https://android.googlesource.com/platform/frameworks/support"
+ }
+ developers {
+ developer {
+ name 'The Android Open Source Project'
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/v7/preference/proguard-rules.pro b/v7/preference/proguard-rules.pro
index 07c2b2bb43..bdcc466451 100644
--- a/v7/preference/proguard-rules.pro
+++ b/v7/preference/proguard-rules.pro
@@ -13,5 +13,9 @@
# limitations under the License.
# Preference objects are inflated via reflection
--keep public class * extends android.support.v7.preference.Preference
-
+-keep public class android.support.v7.preference.Preference {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
+-keep public class * extends android.support.v7.preference.Preference {
+ public <init>(android.content.Context, android.util.AttributeSet);
+}
diff --git a/v7/preference/res/layout/preference_dialog_edittext.xml b/v7/preference/res/layout/preference_dialog_edittext.xml
index 527a7de576..9fbf2b7207 100644
--- a/v7/preference/res/layout/preference_dialog_edittext.xml
+++ b/v7/preference/res/layout/preference_dialog_edittext.xml
@@ -23,7 +23,6 @@
android:overScrollMode="ifContentScrolls">
<LinearLayout
- android:id="@+id/edittext_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dip"
@@ -36,6 +35,11 @@
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary" />
+ <EditText
+ android:id="@android:id/edit"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
</LinearLayout>
</ScrollView>
diff --git a/v7/preference/res/layout/preference_information.xml b/v7/preference/res/layout/preference_information.xml
index e3be382061..5815c46a35 100644
--- a/v7/preference/res/layout/preference_information.xml
+++ b/v7/preference/res/layout/preference_information.xml
@@ -33,14 +33,14 @@
android:layout_marginBottom="6sp"
android:layout_weight="1">
- <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"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorSecondary" />
- <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"
@@ -52,7 +52,7 @@
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
- <LinearLayout android:id="@+android:id/widget_frame"
+ <LinearLayout android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
diff --git a/v7/preference/res/values-v17/styles.xml b/v7/preference/res/values-v17/styles.xml
index 20168b2579..2184354858 100644
--- a/v7/preference/res/values-v17/styles.xml
+++ b/v7/preference/res/values-v17/styles.xml
@@ -19,6 +19,7 @@
<style name="PreferenceFragment">
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
+ <item name="android:divider">?android:attr/listDivider</item>
</style>
<style name="PreferenceFragmentList">
diff --git a/v7/preference/res/values/attrs.xml b/v7/preference/res/values/attrs.xml
index b93c1e6a70..5d39b63e6c 100644
--- a/v7/preference/res/values/attrs.xml
+++ b/v7/preference/res/values/attrs.xml
@@ -1,243 +1,248 @@
<?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
- -->
+ 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
+ -->
<resources>
- <declare-styleable name="Theme">
-
- <!-- =================== -->
- <!-- Preference styles -->
- <!-- =================== -->
- <eat-comment />
-
- <!-- Theme for inflating Preference objects -->
- <attr name="preferenceTheme" format="reference" />
-
- <!-- Default style for PreferenceScreen. -->
- <attr name="preferenceScreenStyle" format="reference" />
- <!-- Default style for the PreferenceActivity. -->
- <attr name="preferenceActivityStyle" format="reference" />
- <!-- Default style for Headers pane in PreferenceActivity. -->
- <attr name="preferenceFragmentStyle" format="reference" />
- <!-- Default style for PreferenceCategory. -->
- <attr name="preferenceCategoryStyle" format="reference" />
- <!-- Default style for Preference. -->
- <attr name="preferenceStyle" format="reference" />
- <!-- Default style for informational Preference. -->
- <attr name="preferenceInformationStyle" format="reference" />
- <!-- Default style for CheckBoxPreference. -->
- <attr name="checkBoxPreferenceStyle" format="reference" />
- <!-- Default style for YesNoPreference. -->
- <attr name="yesNoPreferenceStyle" format="reference" />
- <!-- Default style for DialogPreference. -->
- <attr name="dialogPreferenceStyle" format="reference" />
- <!-- Default style for EditTextPreference. -->
- <attr name="editTextPreferenceStyle" format="reference" />
- <!-- Default style for RingtonePreference. -->
- <attr name="ringtonePreferenceStyle" format="reference" />
- <!-- The preference layout that has the child/tabbed effect. -->
- <attr name="preferenceLayoutChild" format="reference" />
- <!-- Preference panel style -->
- <attr name="preferencePanelStyle" format="reference" />
- <!-- Preference headers panel style -->
- <attr name="preferenceHeaderPanelStyle" format="reference" />
- <!-- Preference list style -->
- <attr name="preferenceListStyle" format="reference" />
- <!-- Preference fragment list style -->
- <attr name="preferenceFragmentListStyle" format="reference" />
- <!-- Preference fragment padding side -->
- <attr name="preferenceFragmentPaddingSide" format="dimension" />
- <!-- Default style for switch preferences. -->
- <attr name="switchPreferenceStyle" format="reference" />
- <!-- Default style for switch compat preferences. -->
- <attr name="switchPreferenceCompatStyle" format="reference" />
- <!-- Default style for seekbar preferences. -->
- <attr name="seekBarPreferenceStyle" format="reference" />
- </declare-styleable>
-
- <!-- Base attributes available to PreferenceFragment. -->
- <declare-styleable name="PreferenceFragmentCompat">
- <!-- The layout for the PreferenceFragment. This should rarely need to be changed. -->
- <attr name="layout" />
- <attr name="android:layout" />
- </declare-styleable>
-
- <!-- Base attributes available to PreferenceGroup. -->
- <declare-styleable name="PreferenceGroup">
- <!-- Whether to order the Preference under this group as they appear in the XML file.
- If this is false, the ordering will follow the Preference order attribute and
- default to alphabetic for those without the order attribute. -->
- <attr name="orderingFromXml" format="boolean" />
- <attr name="android:orderingFromXml" />
- </declare-styleable>
-
- <!-- Base attributes available to Preference. -->
- <declare-styleable name="Preference">
- <!-- The optional icon for the preference -->
- <attr name="icon" />
- <attr name="android:icon" />
- <!-- The key to store the Preference value. -->
- <attr name="key" format="string" />
- <attr name="android:key" />
- <!-- The title for the Preference in a PreferenceActivity screen. -->
- <attr name="title" />
- <attr name="android:title" />
- <!-- The summary for the Preference in a PreferenceActivity screen. -->
- <attr name="summary" format="string" />
- <attr name="android:summary" />
- <!-- The order for the Preference (lower values are to be ordered first). If this is not
- specified, the default ordering will be alphabetic. -->
- <attr name="order" format="integer" />
- <attr name="android:order" />
- <!-- When used inside of a modern PreferenceActivity, this declares
- a new PreferenceFragment to be shown when the user selects this item. -->
- <attr name="fragment" format="string" />
- <attr name="android:fragment" />
- <!-- The layout for the Preference in a PreferenceActivity screen. This should
- rarely need to be changed, look at widgetLayout instead. -->
- <attr name="layout" />
- <attr name="android:layout" />
- <!-- The layout for the controllable widget portion of a Preference. This is inflated
- into the layout for a Preference and should be used more frequently than
- the layout attribute. For example, a checkbox preference would specify
- a custom layout (consisting of just the CheckBox) here. -->
- <attr name="widgetLayout" format="reference" />
- <attr name="android:widgetLayout" />
- <!-- Whether the Preference is enabled. -->
- <attr name="enabled" format="boolean" />
- <attr name="android:enabled" />
- <!-- Whether the Preference is selectable. -->
- <attr name="selectable" format="boolean" />
- <attr name="android:selectable" />
- <!-- The key of another Preference that this Preference will depend on. If the other
- Preference is not set or is off, this Preference will be disabled. -->
- <attr name="dependency" format="string" />
- <attr name="android:dependency" />
- <!-- Whether the Preference stores its value to the shared preferences. -->
- <attr name="persistent" format="boolean" />
- <attr name="android:persistent" />
- <!-- The default value for the preference, which will be set either if persistence
- is off or persistence is on and the preference is not found in the persistent
- storage. -->
- <attr name="defaultValue" format="string|boolean|integer|reference|float" />
- <attr name="android:defaultValue" />
- <!-- Whether the view of this Preference should be disabled when
- this Preference is disabled. -->
- <attr name="shouldDisableView" format="boolean" />
- <attr name="android:shouldDisableView" />
- </declare-styleable>
-
- <!-- Base attributes available to CheckBoxPreference. -->
- <declare-styleable name="CheckBoxPreference">
- <!-- The summary for the Preference in a PreferenceActivity screen when the
- CheckBoxPreference is checked. If separate on/off summaries are not
- needed, the summary attribute can be used instead. -->
- <attr name="summaryOn" format="string" />
- <attr name="android:summaryOn" />
- <!-- The summary for the Preference in a PreferenceActivity screen when the
- CheckBoxPreference is unchecked. If separate on/off summaries are not
- needed, the summary attribute can be used instead. -->
- <attr name="summaryOff" format="string" />
- <attr name="android:summaryOff" />
- <!-- The state (true for on, or false for off) that causes dependents to be disabled. By default,
- dependents will be disabled when this is unchecked, so the value of this preference is false. -->
- <attr name="disableDependentsState" format="boolean" />
- <attr name="android:disableDependentsState" />
- </declare-styleable>
-
- <!-- Base attributes available to DialogPreference. -->
- <declare-styleable name="DialogPreference">
- <!-- The title in the dialog. -->
- <attr name="dialogTitle" format="string" />
- <attr name="android:dialogTitle" />
- <!-- The message in the dialog. If a dialogLayout is provided and contains
- a TextView with ID android:id/message, this message will be placed in there. -->
- <attr name="dialogMessage" format="string" />
- <attr name="android:dialogMessage" />
- <!-- The icon for the dialog. -->
- <attr name="dialogIcon" format="reference" />
- <attr name="android:dialogIcon" />
- <!-- The positive button text for the dialog. Set to @null to hide the positive button. -->
- <attr name="positiveButtonText" format="string" />
- <attr name="android:positiveButtonText" />
- <!-- The negative button text for the dialog. Set to @null to hide the negative button. -->
- <attr name="negativeButtonText" format="string" />
- <attr name="android:negativeButtonText" />
- <!-- A layout to be used as the content View for the dialog. By default, this shouldn't
- be needed. If a custom DialogPreference is required, this should be set. For example,
- the EditTextPreference uses a layout with an EditText as this attribute. -->
- <attr name="dialogLayout" format="reference" />
- <attr name="android:dialogLayout" />
- </declare-styleable>
-
- <!-- Base attributes available to ListPreference. -->
- <declare-styleable name="ListPreference">
- <!-- The human-readable array to present as a list. Each entry must have a corresponding
- index in entryValues. -->
- <attr name="entries" format="reference" />
- <attr name="android:entries" />
- <!-- The array to find the value to save for a preference when an entry from
- entries is selected. If a user clicks on the second item in entries, the
- second item in this array will be saved to the preference. -->
- <attr name="entryValues" format="reference" />
- <attr name="android:entryValues" />
- </declare-styleable>
-
- <declare-styleable name="MultiSelectListPreference">
- <!-- The human-readable array to present as a list. Each entry must have a corresponding
- index in entryValues. -->
- <attr name="entries" />
- <attr name="android:entries" />
- <!-- The array to find the value to save for a preference when an entry from
- entries is selected. If a user clicks the second item in entries, the
- second item in this array will be saved to the preference. -->
- <attr name="entryValues" />
- <attr name="android:entryValues" />
- </declare-styleable>
-
- <declare-styleable name="SwitchPreferenceCompat">
- <!-- The summary for the Preference in a PreferenceActivity screen when the
- SwitchPreference is checked. If separate on/off summaries are not
- needed, the summary attribute can be used instead. -->
- <attr name="summaryOn" />
- <attr name="android:summaryOn" />
- <!-- The summary for the Preference in a PreferenceActivity screen when the
- SwitchPreference is unchecked. If separate on/off summaries are not
- needed, the summary attribute can be used instead. -->
- <attr name="summaryOff" />
- <attr name="android:summaryOff" />
- <!-- The text used on the switch itself when in the "on" state.
- This should be a very SHORT string, as it appears in a small space. -->
- <attr name="switchTextOn" format="string" />
- <attr name="android:switchTextOn" />
- <!-- The text used on the switch itself when in the "off" state.
- This should be a very SHORT string, as it appears in a small space. -->
- <attr name="switchTextOff" format="string" />
- <attr name="android:switchTextOff" />
- <!-- The state (true for on, or false for off) that causes dependents to be disabled. By default,
- dependents will be disabled when this is unchecked, so the value of this preference is false. -->
- <attr name="disableDependentsState" />
- <attr name="android:disableDependentsState" />
- </declare-styleable>
-
- <declare-styleable name="PreferenceImageView">
- <attr name="maxWidth" format="dimension" />
- <attr name="android:maxWidth" />
- <attr name="maxHeight" format="dimension" />
- <attr name="android:maxHeight" />
- </declare-styleable>
+ <declare-styleable name="Theme">
+
+ <!-- =================== -->
+ <!-- Preference styles -->
+ <!-- =================== -->
+ <eat-comment />
+
+ <!-- Theme for inflating Preference objects -->
+ <attr name="preferenceTheme" format="reference" />
+
+ <!-- Default style for PreferenceScreen. -->
+ <attr name="preferenceScreenStyle" format="reference" />
+ <!-- Default style for the PreferenceActivity. -->
+ <attr name="preferenceActivityStyle" format="reference" />
+ <!-- Default style for Headers pane in PreferenceActivity. -->
+ <attr name="preferenceFragmentStyle" format="reference" />
+ <!-- Default style for Headers pane in PreferenceActivity. -->
+ <attr name="preferenceFragmentCompatStyle" format="reference" />
+ <!-- Default style for PreferenceCategory. -->
+ <attr name="preferenceCategoryStyle" format="reference" />
+ <!-- Default style for Preference. -->
+ <attr name="preferenceStyle" format="reference" />
+ <!-- Default style for informational Preference. -->
+ <attr name="preferenceInformationStyle" format="reference" />
+ <!-- Default style for CheckBoxPreference. -->
+ <attr name="checkBoxPreferenceStyle" format="reference" />
+ <!-- Default style for YesNoPreference. -->
+ <attr name="yesNoPreferenceStyle" format="reference" />
+ <!-- Default style for DialogPreference. -->
+ <attr name="dialogPreferenceStyle" format="reference" />
+ <!-- Default style for EditTextPreference. -->
+ <attr name="editTextPreferenceStyle" format="reference" />
+ <!-- Default style for RingtonePreference. -->
+ <attr name="ringtonePreferenceStyle" format="reference" />
+ <!-- The preference layout that has the child/tabbed effect. -->
+ <attr name="preferenceLayoutChild" format="reference" />
+ <!-- Preference panel style -->
+ <attr name="preferencePanelStyle" format="reference" />
+ <!-- Preference headers panel style -->
+ <attr name="preferenceHeaderPanelStyle" format="reference" />
+ <!-- Preference list style -->
+ <attr name="preferenceListStyle" format="reference" />
+ <!-- Preference fragment list style -->
+ <attr name="preferenceFragmentListStyle" format="reference" />
+ <!-- Preference fragment padding side -->
+ <attr name="preferenceFragmentPaddingSide" format="dimension" />
+ <!-- Default style for switch preferences. -->
+ <attr name="switchPreferenceStyle" format="reference" />
+ <!-- Default style for switch compat preferences. -->
+ <attr name="switchPreferenceCompatStyle" format="reference" />
+ <!-- Default style for seekbar preferences. -->
+ <attr name="seekBarPreferenceStyle" format="reference" />
+ </declare-styleable>
+
+ <!-- Base attributes available to PreferenceFragment. -->
+ <declare-styleable name="PreferenceFragmentCompat">
+ <!-- The layout for the PreferenceFragment. This should rarely need to be changed. -->
+ <attr name="android:layout" />
+ <!-- List separator to draw between preference views -->
+ <attr name="android:divider" />
+ <!-- List separator height -->
+ <attr name="android:dividerHeight" />
+ </declare-styleable>
+
+ <!-- Base attributes available to PreferenceGroup. -->
+ <declare-styleable name="PreferenceGroup">
+ <!-- Whether to order the Preference under this group as they appear in the XML file.
+ If this is false, the ordering will follow the Preference order attribute and
+ default to alphabetic for those without the order attribute. -->
+ <attr name="orderingFromXml" format="boolean" />
+ <attr name="android:orderingFromXml" />
+ </declare-styleable>
+
+ <!-- Base attributes available to Preference. -->
+ <declare-styleable name="Preference">
+ <!-- The optional icon for the preference -->
+ <attr name="icon" />
+ <attr name="android:icon" />
+ <!-- The key to store the Preference value. -->
+ <attr name="key" format="string" />
+ <attr name="android:key" />
+ <!-- The title for the Preference in a PreferenceActivity screen. -->
+ <attr name="title" />
+ <attr name="android:title" />
+ <!-- The summary for the Preference in a PreferenceActivity screen. -->
+ <attr name="summary" format="string" />
+ <attr name="android:summary" />
+ <!-- The order for the Preference (lower values are to be ordered first). If this is not
+ specified, the default ordering will be alphabetic. -->
+ <attr name="order" format="integer" />
+ <attr name="android:order" />
+ <!-- When used inside of a modern PreferenceActivity, this declares
+ a new PreferenceFragment to be shown when the user selects this item. -->
+ <attr name="fragment" format="string" />
+ <attr name="android:fragment" />
+ <!-- The layout for the Preference in a PreferenceActivity screen. This should
+ rarely need to be changed, look at widgetLayout instead. -->
+ <attr name="layout" />
+ <attr name="android:layout" />
+ <!-- The layout for the controllable widget portion of a Preference. This is inflated
+ into the layout for a Preference and should be used more frequently than
+ the layout attribute. For example, a checkbox preference would specify
+ a custom layout (consisting of just the CheckBox) here. -->
+ <attr name="widgetLayout" format="reference" />
+ <attr name="android:widgetLayout" />
+ <!-- Whether the Preference is enabled. -->
+ <attr name="enabled" format="boolean" />
+ <attr name="android:enabled" />
+ <!-- Whether the Preference is selectable. -->
+ <attr name="selectable" format="boolean" />
+ <attr name="android:selectable" />
+ <!-- The key of another Preference that this Preference will depend on. If the other
+ Preference is not set or is off, this Preference will be disabled. -->
+ <attr name="dependency" format="string" />
+ <attr name="android:dependency" />
+ <!-- Whether the Preference stores its value to the shared preferences. -->
+ <attr name="persistent" format="boolean" />
+ <attr name="android:persistent" />
+ <!-- The default value for the preference, which will be set either if persistence
+ is off or persistence is on and the preference is not found in the persistent
+ storage. -->
+ <attr name="defaultValue" format="string|boolean|integer|reference|float" />
+ <attr name="android:defaultValue" />
+ <!-- Whether the view of this Preference should be disabled when
+ this Preference is disabled. -->
+ <attr name="shouldDisableView" format="boolean" />
+ <attr name="android:shouldDisableView" />
+ </declare-styleable>
+
+ <!-- Base attributes available to CheckBoxPreference. -->
+ <declare-styleable name="CheckBoxPreference">
+ <!-- The summary for the Preference in a PreferenceActivity screen when the
+ CheckBoxPreference is checked. If separate on/off summaries are not
+ needed, the summary attribute can be used instead. -->
+ <attr name="summaryOn" format="string" />
+ <attr name="android:summaryOn" />
+ <!-- The summary for the Preference in a PreferenceActivity screen when the
+ CheckBoxPreference is unchecked. If separate on/off summaries are not
+ needed, the summary attribute can be used instead. -->
+ <attr name="summaryOff" format="string" />
+ <attr name="android:summaryOff" />
+ <!-- The state (true for on, or false for off) that causes dependents to be disabled. By default,
+ dependents will be disabled when this is unchecked, so the value of this preference is false. -->
+ <attr name="disableDependentsState" format="boolean" />
+ <attr name="android:disableDependentsState" />
+ </declare-styleable>
+
+ <!-- Base attributes available to DialogPreference. -->
+ <declare-styleable name="DialogPreference">
+ <!-- The title in the dialog. -->
+ <attr name="dialogTitle" format="string" />
+ <attr name="android:dialogTitle" />
+ <!-- The message in the dialog. If a dialogLayout is provided and contains
+ a TextView with ID android:id/message, this message will be placed in there. -->
+ <attr name="dialogMessage" format="string" />
+ <attr name="android:dialogMessage" />
+ <!-- The icon for the dialog. -->
+ <attr name="dialogIcon" format="reference" />
+ <attr name="android:dialogIcon" />
+ <!-- The positive button text for the dialog. Set to @null to hide the positive button. -->
+ <attr name="positiveButtonText" format="string" />
+ <attr name="android:positiveButtonText" />
+ <!-- The negative button text for the dialog. Set to @null to hide the negative button. -->
+ <attr name="negativeButtonText" format="string" />
+ <attr name="android:negativeButtonText" />
+ <!-- A layout to be used as the content View for the dialog. By default, this shouldn't
+ be needed. If a custom DialogPreference is required, this should be set. For example,
+ the EditTextPreference uses a layout with an EditText as this attribute. -->
+ <attr name="dialogLayout" format="reference" />
+ <attr name="android:dialogLayout" />
+ </declare-styleable>
+
+ <!-- Base attributes available to ListPreference. -->
+ <declare-styleable name="ListPreference">
+ <!-- The human-readable array to present as a list. Each entry must have a corresponding
+ index in entryValues. -->
+ <attr name="entries" format="reference" />
+ <attr name="android:entries" />
+ <!-- The array to find the value to save for a preference when an entry from
+ entries is selected. If a user clicks on the second item in entries, the
+ second item in this array will be saved to the preference. -->
+ <attr name="entryValues" format="reference" />
+ <attr name="android:entryValues" />
+ </declare-styleable>
+
+ <declare-styleable name="MultiSelectListPreference">
+ <!-- The human-readable array to present as a list. Each entry must have a corresponding
+ index in entryValues. -->
+ <attr name="entries" />
+ <attr name="android:entries" />
+ <!-- The array to find the value to save for a preference when an entry from
+ entries is selected. If a user clicks the second item in entries, the
+ second item in this array will be saved to the preference. -->
+ <attr name="entryValues" />
+ <attr name="android:entryValues" />
+ </declare-styleable>
+
+ <declare-styleable name="SwitchPreferenceCompat">
+ <!-- The summary for the Preference in a PreferenceActivity screen when the
+ SwitchPreference is checked. If separate on/off summaries are not
+ needed, the summary attribute can be used instead. -->
+ <attr name="summaryOn" />
+ <attr name="android:summaryOn" />
+ <!-- The summary for the Preference in a PreferenceActivity screen when the
+ SwitchPreference is unchecked. If separate on/off summaries are not
+ needed, the summary attribute can be used instead. -->
+ <attr name="summaryOff" />
+ <attr name="android:summaryOff" />
+ <!-- The text used on the switch itself when in the "on" state.
+ This should be a very SHORT string, as it appears in a small space. -->
+ <attr name="switchTextOn" format="string" />
+ <attr name="android:switchTextOn" />
+ <!-- The text used on the switch itself when in the "off" state.
+ This should be a very SHORT string, as it appears in a small space. -->
+ <attr name="switchTextOff" format="string" />
+ <attr name="android:switchTextOff" />
+ <!-- The state (true for on, or false for off) that causes dependents to be disabled. By default,
+ dependents will be disabled when this is unchecked, so the value of this preference is false. -->
+ <attr name="disableDependentsState" />
+ <attr name="android:disableDependentsState" />
+ </declare-styleable>
+
+ <declare-styleable name="PreferenceImageView">
+ <attr name="maxWidth" format="dimension" />
+ <attr name="android:maxWidth" />
+ <attr name="maxHeight" format="dimension" />
+ <attr name="android:maxHeight" />
+ </declare-styleable>
</resources>
diff --git a/v7/preference/res/values/styles.xml b/v7/preference/res/values/styles.xml
index 3af31a4211..774c0c93db 100644
--- a/v7/preference/res/values/styles.xml
+++ b/v7/preference/res/values/styles.xml
@@ -17,47 +17,48 @@
<resources>
<style name="Preference">
- <item name="layout">@layout/preference</item>
+ <item name="android:layout">@layout/preference</item>
</style>
<style name="PreferenceFragment">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
+ <item name="android:divider">?android:attr/listDivider</item>
</style>
<style name="Preference.Information">
- <item name="layout">@layout/preference_information</item>
- <item name="enabled">false</item>
- <item name="shouldDisableView">false</item>
+ <item name="android:layout">@layout/preference_information</item>
+ <item name="android:enabled">false</item>
+ <item name="android:shouldDisableView">false</item>
</style>
<style name="Preference.Category">
- <item name="layout">@layout/preference_category</item>
+ <item name="android:layout">@layout/preference_category</item>
<!-- The title should not dim if the category is disabled, instead only the preference children should dim. -->
- <item name="shouldDisableView">false</item>
- <item name="selectable">false</item>
+ <item name="android:shouldDisableView">false</item>
+ <item name="android:selectable">false</item>
</style>
<style name="Preference.CheckBoxPreference">
- <item name="widgetLayout">@layout/preference_widget_checkbox</item>
+ <item name="android:widgetLayout">@layout/preference_widget_checkbox</item>
</style>
<style name="Preference.SwitchPreferenceCompat">
- <item name="widgetLayout">@layout/preference_widget_switch_compat</item>
- <item name="switchTextOn">@string/v7_preference_on</item>
- <item name="switchTextOff">@string/v7_preference_off</item>
+ <item name="android:widgetLayout">@layout/preference_widget_switch_compat</item>
+ <item name="android:switchTextOn">@string/v7_preference_on</item>
+ <item name="android:switchTextOff">@string/v7_preference_off</item>
</style>
<style name="Preference.PreferenceScreen">
</style>
<style name="Preference.DialogPreference">
- <item name="positiveButtonText">@android:string/ok</item>
- <item name="negativeButtonText">@android:string/cancel</item>
+ <item name="android:positiveButtonText">@android:string/ok</item>
+ <item name="android:negativeButtonText">@android:string/cancel</item>
</style>
<style name="Preference.DialogPreference.EditTextPreference">
- <item name="dialogLayout">@layout/preference_dialog_edittext</item>
+ <item name="android:dialogLayout">@layout/preference_dialog_edittext</item>
</style>
<style name="PreferenceFragmentList">
diff --git a/v7/preference/res/values/themes.xml b/v7/preference/res/values/themes.xml
index c2c2c3c10c..8a7eaa3841 100644
--- a/v7/preference/res/values/themes.xml
+++ b/v7/preference/res/values/themes.xml
@@ -18,7 +18,7 @@
<resources>
<style name="PreferenceThemeOverlay">
<item name="preferenceScreenStyle">@style/Preference.PreferenceScreen</item>
- <item name="preferenceFragmentStyle">@style/PreferenceFragment</item>
+ <item name="preferenceFragmentCompatStyle">@style/PreferenceFragment</item>
<item name="preferenceCategoryStyle">@style/Preference.Category</item>
<item name="preferenceStyle">@style/Preference</item>
<item name="preferenceInformationStyle">@style/Preference.Information</item>
diff --git a/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java b/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
index 182cf28efd..6e7663cb49 100644
--- a/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
+++ b/v7/preference/src/android/support/v7/preference/EditTextPreferenceDialogFragmentCompat.java
@@ -18,8 +18,6 @@ package android.support.v7.preference;
import android.os.Bundle;
import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewParent;
import android.widget.EditText;
public class EditTextPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat {
@@ -39,19 +37,14 @@ public class EditTextPreferenceDialogFragmentCompat extends PreferenceDialogFrag
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
- mEditText = new EditText(view.getContext());
- // Give it an ID so it can be saved/restored
- mEditText.setId(android.R.id.edit);
+ mEditText = (EditText) view.findViewById(android.R.id.edit);
- mEditText.setText(getEditTextPreference().getText());
-
- ViewParent oldParent = mEditText.getParent();
- if (oldParent != view) {
- if (oldParent != null) {
- ((ViewGroup) oldParent).removeView(mEditText);
- }
- onAddEditTextToDialogView(view, mEditText);
+ if (mEditText == null) {
+ throw new IllegalStateException("Dialog view must contain an EditText with id" +
+ " @android:id/edit");
}
+
+ mEditText.setText(getEditTextPreference().getText());
}
private EditTextPreference getEditTextPreference() {
@@ -65,20 +58,6 @@ public class EditTextPreferenceDialogFragmentCompat extends PreferenceDialogFrag
return true;
}
- /**
- * Adds the EditText widget of this preference to the dialog's view.
- *
- * @param dialogView The dialog view.
- */
- protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
- ViewGroup container = (ViewGroup) dialogView
- .findViewById(R.id.edittext_container);
- if (container != null) {
- container.addView(editText, ViewGroup.LayoutParams.FILL_PARENT,
- ViewGroup.LayoutParams.WRAP_CONTENT);
- }
- }
-
@Override
public void onDialogClosed(boolean positiveResult) {
diff --git a/v7/preference/src/android/support/v7/preference/Preference.java b/v7/preference/src/android/support/v7/preference/Preference.java
index 4f210ae71e..f3865928e4 100644
--- a/v7/preference/src/android/support/v7/preference/Preference.java
+++ b/v7/preference/src/android/support/v7/preference/Preference.java
@@ -516,6 +516,12 @@ public class Preference implements Comparable<Preference> {
} else {
setEnabledStateOnViews(holder.itemView, true);
}
+
+ final boolean selectable = isSelectable();
+ holder.itemView.setFocusable(selectable);
+
+ holder.setDividerAllowedAbove(selectable);
+ holder.setDividerAllowedBelow(selectable);
}
/**
@@ -749,9 +755,11 @@ public class Preference implements Comparable<Preference> {
* @param visible Set false if this preference should be hidden from the list.
*/
public final void setVisible(boolean visible) {
- mVisible = visible;
- if (mListener != null) {
- mListener.onPreferenceVisibilityChange(this);
+ if (mVisible != visible) {
+ mVisible = visible;
+ if (mListener != null) {
+ mListener.onPreferenceVisibilityChange(this);
+ }
}
}
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java b/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
index 8231d8903f..221d3ea22a 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceFragmentCompat.java
@@ -18,6 +18,9 @@ package android.support.v7.preference;
import android.content.Context;
import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -25,6 +28,7 @@ import android.support.annotation.Nullable;
import android.support.annotation.XmlRes;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
+import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
@@ -51,7 +55,7 @@ import android.view.ViewGroup;
* hierarchy. Furthermore, subsequent {@link PreferenceScreen} in the hierarchy
* denote a screen break--that is the preferences contained within subsequent
* {@link PreferenceScreen} should be shown on another screen. The preference
- * framework handles showing these other screens from the preference hierarchy.
+ * framework handles this by calling {@link #onNavigateToScreen(PreferenceScreen)}.
* <p>
* The preference hierarchy can be formed in multiple ways:
* <li> From an XML file specifying the hierarchy
@@ -123,10 +127,7 @@ public abstract class PreferenceFragmentCompat extends Fragment implements
private int mLayoutResId = R.layout.preference_list_fragment;
- /**
- * The starting request code given out to preference framework.
- */
- private static final int FIRST_REQUEST_CODE = 100;
+ private final DividerDecoration mDividerDecoration = new DividerDecoration();
private static final int MSG_BIND_PREFERENCES = 1;
private Handler mHandler = new Handler() {
@@ -233,15 +234,28 @@ public abstract class PreferenceFragmentCompat extends Fragment implements
TypedArray a = mStyledContext.obtainStyledAttributes(null,
R.styleable.PreferenceFragmentCompat,
- R.attr.preferenceFragmentStyle,
+ R.attr.preferenceFragmentCompatStyle,
0);
- mLayoutResId = a.getResourceId(R.styleable.PreferenceFragmentCompat_layout,
+ mLayoutResId = a.getResourceId(R.styleable.PreferenceFragmentCompat_android_layout,
mLayoutResId);
+ final Drawable divider = a.getDrawable(
+ R.styleable.PreferenceFragmentCompat_android_divider);
+ final int dividerHeight = a.getInt(
+ R.styleable.PreferenceFragmentCompat_android_dividerHeight, -1);
+
a.recycle();
- final View view = inflater.inflate(mLayoutResId, container, false);
+ // Need to theme the inflater to pick up the preferenceFragmentListStyle
+ final TypedValue tv = new TypedValue();
+ getActivity().getTheme().resolveAttribute(R.attr.preferenceTheme, tv, true);
+ final int theme = tv.resourceId;
+
+ final Context themedContext = new ContextThemeWrapper(inflater.getContext(), theme);
+ final LayoutInflater themedInflater = inflater.cloneInContext(themedContext);
+
+ final View view = themedInflater.inflate(mLayoutResId, container, false);
final View rawListContainer = view.findViewById(R.id.list_container);
if (!(rawListContainer instanceof ViewGroup)) {
@@ -251,18 +265,49 @@ public abstract class PreferenceFragmentCompat extends Fragment implements
final ViewGroup listContainer = (ViewGroup) rawListContainer;
- final RecyclerView listView = onCreateRecyclerView(inflater, listContainer,
+ final RecyclerView listView = onCreateRecyclerView(themedInflater, listContainer,
savedInstanceState);
if (listView == null) {
throw new RuntimeException("Could not create RecyclerView");
}
mList = listView;
+
+ listView.addItemDecoration(mDividerDecoration);
+ setDivider(divider);
+ if (dividerHeight != -1) {
+ setDividerHeight(dividerHeight);
+ }
+
listContainer.addView(mList);
mHandler.post(mRequestFocus);
return view;
}
+ /**
+ * Sets the drawable that will be drawn between each item in the list.
+ * <p>
+ * <strong>Note:</strong> If the drawable does not have an intrinsic
+ * height, you should also call {@link #setDividerHeight(int)}.
+ *
+ * @param divider the drawable to use
+ * @attr ref R.styleable#PreferenceFragmentCompat_android_divider
+ */
+ public void setDivider(Drawable divider) {
+ mDividerDecoration.setDivider(divider);
+ }
+
+ /**
+ * Sets the height of the divider that will be drawn between each item in the list. Calling
+ * this will override the intrinsic height as set by {@link #setDivider(Drawable)}
+ *
+ * @param height The new height of the divider in pixels.
+ * @attr ref R.styleable#PreferenceFragmentCompat_android_dividerHeight
+ */
+ public void setDividerHeight(int height) {
+ mDividerDecoration.setDividerHeight(height);
+ }
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -574,4 +619,78 @@ public abstract class PreferenceFragmentCompat extends Fragment implements
public Fragment getCallbackFragment() {
return null;
}
+
+ private class DividerDecoration extends RecyclerView.ItemDecoration {
+
+ private Drawable mDivider;
+ private int mDividerHeight;
+
+ @Override
+ public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
+ if (mDivider == null) {
+ return;
+ }
+ final int childCount = parent.getChildCount();
+ final int width = parent.getWidth();
+ for (int childViewIndex = 0; childViewIndex < childCount; childViewIndex++) {
+ final View view = parent.getChildAt(childViewIndex);
+ if (shouldDrawDividerAbove(view, parent)) {
+ int top = (int) ViewCompat.getY(view);
+ mDivider.setBounds(0, top, width, top + mDividerHeight);
+ mDivider.draw(c);
+ }
+ if (shouldDrawDividerBelow(view, parent)) {
+ int top = (int) ViewCompat.getY(view) + view.getHeight();
+ mDivider.setBounds(0, top, width, top + mDividerHeight);
+ mDivider.draw(c);
+ }
+ }
+ }
+
+ @Override
+ public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
+ RecyclerView.State state) {
+ if (shouldDrawDividerAbove(view, parent)) {
+ outRect.top = mDividerHeight;
+ }
+ if (shouldDrawDividerBelow(view, parent)) {
+ outRect.bottom = mDividerHeight;
+ }
+ }
+
+ private boolean shouldDrawDividerAbove(View view, RecyclerView parent) {
+ final RecyclerView.ViewHolder holder = parent.getChildViewHolder(view);
+ return holder.getAdapterPosition() == 0 &&
+ ((PreferenceViewHolder) holder).isDividerAllowedAbove();
+ }
+
+ private boolean shouldDrawDividerBelow(View view, RecyclerView parent) {
+ final PreferenceViewHolder holder =
+ (PreferenceViewHolder) parent.getChildViewHolder(view);
+ boolean nextAllowed = true;
+ int index = parent.indexOfChild(view);
+ if (index < parent.getChildCount() - 1) {
+ final View nextView = parent.getChildAt(index + 1);
+ final PreferenceViewHolder nextHolder =
+ (PreferenceViewHolder) parent.getChildViewHolder(nextView);
+ nextAllowed = nextHolder.isDividerAllowedAbove();
+ }
+ return nextAllowed && holder.isDividerAllowedBelow();
+ }
+
+ public void setDivider(Drawable divider) {
+ if (divider != null) {
+ mDividerHeight = divider.getIntrinsicHeight();
+ } else {
+ mDividerHeight = 0;
+ }
+ mDivider = divider;
+ mList.invalidateItemDecorations();
+ }
+
+ public void setDividerHeight(int dividerHeight) {
+ mDividerHeight = dividerHeight;
+ mList.invalidateItemDecorations();
+ }
+ }
}
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java b/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
index 9943087fd1..c4ccc6666d 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceGroupAdapter.java
@@ -79,6 +79,14 @@ public class PreferenceGroupAdapter extends RecyclerView.Adapter<PreferenceViewH
private int widgetResId;
private String name;
+ public PreferenceLayout() {}
+
+ public PreferenceLayout(PreferenceLayout other) {
+ resId = other.resId;
+ widgetResId = other.widgetResId;
+ name = other.name;
+ }
+
@Override
public boolean equals(Object o) {
if (!(o instanceof PreferenceLayout)) {
@@ -249,7 +257,14 @@ public class PreferenceGroupAdapter extends RecyclerView.Adapter<PreferenceViewH
mTempPreferenceLayout = createPreferenceLayout(preference, mTempPreferenceLayout);
- return mPreferenceLayouts.indexOf(mTempPreferenceLayout);
+ int viewType = mPreferenceLayouts.indexOf(mTempPreferenceLayout);
+ if (viewType != -1) {
+ return viewType;
+ } else {
+ viewType = mPreferenceLayouts.size();
+ mPreferenceLayouts.add(new PreferenceLayout(mTempPreferenceLayout));
+ return viewType;
+ }
}
@Override
diff --git a/v7/preference/src/android/support/v7/preference/PreferenceViewHolder.java b/v7/preference/src/android/support/v7/preference/PreferenceViewHolder.java
index c7e247c0ca..f9eaf2271e 100644
--- a/v7/preference/src/android/support/v7/preference/PreferenceViewHolder.java
+++ b/v7/preference/src/android/support/v7/preference/PreferenceViewHolder.java
@@ -28,6 +28,8 @@ import android.view.View;
*/
public class PreferenceViewHolder extends RecyclerView.ViewHolder {
private final SparseArray<View> mCachedViews = new SparseArray<>(4);
+ private boolean mDividerAllowedAbove;
+ private boolean mDividerAllowedBelow;
/* package */ PreferenceViewHolder(View itemView) {
super(itemView);
@@ -58,4 +60,44 @@ public class PreferenceViewHolder extends RecyclerView.ViewHolder {
return v;
}
}
+
+ /**
+ * Dividers are only drawn between items if both items allow it, or above the first and below
+ * the last item if that item allows it.
+ *
+ * @return true if dividers are allowed above this item
+ */
+ public boolean isDividerAllowedAbove() {
+ return mDividerAllowedAbove;
+ }
+
+ /**
+ * Dividers are only drawn between items if both items allow it, or above the first and below
+ * the last item if that item allows it.
+ *
+ * @param allowed false to prevent dividers being drawn above this item
+ */
+ public void setDividerAllowedAbove(boolean allowed) {
+ mDividerAllowedAbove = allowed;
+ }
+
+ /**
+ * Dividers are only drawn between items if both items allow it, or above the first and below
+ * the last item if that item allows it.
+ *
+ * @return true if dividers are allowed below this item
+ */
+ public boolean isDividerAllowedBelow() {
+ return mDividerAllowedBelow;
+ }
+
+ /**
+ * Dividers are only drawn between items if both items allow it, or above the first and below
+ * the last item if that item allows it.
+ *
+ * @param allowed false to prevent dividers being drawn below this item
+ */
+ public void setDividerAllowedBelow(boolean allowed) {
+ mDividerAllowedBelow = allowed;
+ }
}