Merge "Deprecates framework Preference classes"

This commit is contained in:
Louis Pullen-Freilich
2018-11-21 14:42:43 +00:00
committed by Android (Google) Code Review
28 changed files with 316 additions and 144 deletions

44
api/current.txt Executable file → Normal file
View File

@@ -34633,14 +34633,14 @@ package android.os.strictmode {
package android.preference {
public class CheckBoxPreference extends android.preference.TwoStatePreference {
public deprecated class CheckBoxPreference extends android.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.preference.Preference implements android.content.DialogInterface.OnClickListener android.content.DialogInterface.OnDismissListener android.preference.PreferenceManager.OnActivityDestroyListener {
public abstract deprecated class DialogPreference extends android.preference.Preference implements android.content.DialogInterface.OnClickListener android.content.DialogInterface.OnDismissListener android.preference.PreferenceManager.OnActivityDestroyListener {
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);
@@ -34673,7 +34673,7 @@ package android.preference {
method protected void showDialog(android.os.Bundle);
}
public class EditTextPreference extends android.preference.DialogPreference {
public deprecated class EditTextPreference extends android.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);
@@ -34684,7 +34684,7 @@ package android.preference {
method public void setText(java.lang.String);
}
public class ListPreference extends android.preference.DialogPreference {
public deprecated class ListPreference extends android.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);
@@ -34702,7 +34702,7 @@ package android.preference {
method public void setValueIndex(int);
}
public class MultiSelectListPreference extends android.preference.DialogPreference {
public deprecated class MultiSelectListPreference extends android.preference.DialogPreference {
ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int, int);
ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int);
ctor public MultiSelectListPreference(android.content.Context, android.util.AttributeSet);
@@ -34718,7 +34718,7 @@ package android.preference {
method public void setValues(java.util.Set<java.lang.String>);
}
public class Preference implements java.lang.Comparable {
public deprecated class Preference implements java.lang.Comparable {
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);
@@ -34815,21 +34815,21 @@ package android.preference {
field public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff
}
public static class Preference.BaseSavedState extends android.view.AbsSavedState {
public static deprecated 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.preference.Preference.BaseSavedState> CREATOR;
}
public static abstract interface Preference.OnPreferenceChangeListener {
public static abstract deprecated interface Preference.OnPreferenceChangeListener {
method public abstract boolean onPreferenceChange(android.preference.Preference, java.lang.Object);
}
public static abstract interface Preference.OnPreferenceClickListener {
public static abstract deprecated interface Preference.OnPreferenceClickListener {
method public abstract boolean onPreferenceClick(android.preference.Preference);
}
public abstract class PreferenceActivity extends android.app.ListActivity implements android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback {
public abstract deprecated class PreferenceActivity extends android.app.ListActivity implements android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback {
ctor public PreferenceActivity();
method public deprecated void addPreferencesFromIntent(android.content.Intent);
method public deprecated void addPreferencesFromResource(int);
@@ -34869,7 +34869,7 @@ package android.preference {
field public static final long HEADER_ID_UNDEFINED = -1L; // 0xffffffffffffffffL
}
public static final class PreferenceActivity.Header implements android.os.Parcelable {
public static final deprecated class PreferenceActivity.Header implements android.os.Parcelable {
ctor public PreferenceActivity.Header();
method public int describeContents();
method public java.lang.CharSequence getBreadCrumbShortTitle(android.content.res.Resources);
@@ -34895,14 +34895,14 @@ package android.preference {
field public int titleRes;
}
public class PreferenceCategory extends android.preference.PreferenceGroup {
public deprecated class PreferenceCategory extends android.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 interface PreferenceDataStore {
public abstract deprecated interface PreferenceDataStore {
method public default boolean getBoolean(java.lang.String, boolean);
method public default float getFloat(java.lang.String, float);
method public default int getInt(java.lang.String, int);
@@ -34932,7 +34932,7 @@ package android.preference {
method public abstract boolean onPreferenceStartFragment(android.preference.PreferenceFragment, android.preference.Preference);
}
public abstract class PreferenceGroup extends android.preference.Preference {
public abstract deprecated class PreferenceGroup extends android.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);
@@ -34951,7 +34951,7 @@ package android.preference {
method public void setOrderingAsAdded(boolean);
}
public class PreferenceManager {
public deprecated class PreferenceManager {
method public android.preference.PreferenceScreen createPreferenceScreen(android.content.Context);
method public android.preference.Preference findPreference(java.lang.CharSequence);
method public static android.content.SharedPreferences getDefaultSharedPreferences(android.content.Context);
@@ -34973,19 +34973,19 @@ package android.preference {
field public static final java.lang.String METADATA_KEY_PREFERENCES = "android.preference";
}
public static abstract interface PreferenceManager.OnActivityDestroyListener {
public static abstract deprecated interface PreferenceManager.OnActivityDestroyListener {
method public abstract void onActivityDestroy();
}
public static abstract interface PreferenceManager.OnActivityResultListener {
public static abstract deprecated interface PreferenceManager.OnActivityResultListener {
method public abstract boolean onActivityResult(int, int, android.content.Intent);
}
public static abstract interface PreferenceManager.OnActivityStopListener {
public static abstract deprecated interface PreferenceManager.OnActivityStopListener {
method public abstract void onActivityStop();
}
public final class PreferenceScreen extends android.preference.PreferenceGroup implements android.widget.AdapterView.OnItemClickListener android.content.DialogInterface.OnDismissListener {
public final deprecated class PreferenceScreen extends android.preference.PreferenceGroup implements android.widget.AdapterView.OnItemClickListener android.content.DialogInterface.OnDismissListener {
method public void bind(android.widget.ListView);
method public android.app.Dialog getDialog();
method public android.widget.ListAdapter getRootAdapter();
@@ -34994,7 +34994,7 @@ package android.preference {
method public void onItemClick(android.widget.AdapterView, android.view.View, int, long);
}
public class RingtonePreference extends android.preference.Preference implements android.preference.PreferenceManager.OnActivityResultListener {
public deprecated class RingtonePreference extends android.preference.Preference implements android.preference.PreferenceManager.OnActivityResultListener {
ctor public RingtonePreference(android.content.Context, android.util.AttributeSet, int, int);
ctor public RingtonePreference(android.content.Context, android.util.AttributeSet, int);
ctor public RingtonePreference(android.content.Context, android.util.AttributeSet);
@@ -35011,7 +35011,7 @@ package android.preference {
method public void setShowSilent(boolean);
}
public class SwitchPreference extends android.preference.TwoStatePreference {
public deprecated class SwitchPreference extends android.preference.TwoStatePreference {
ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int, int);
ctor public SwitchPreference(android.content.Context, android.util.AttributeSet, int);
ctor public SwitchPreference(android.content.Context, android.util.AttributeSet);
@@ -35024,7 +35024,7 @@ package android.preference {
method public void setSwitchTextOn(int);
}
public abstract class TwoStatePreference extends android.preference.Preference {
public abstract deprecated class TwoStatePreference extends android.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);

View File

@@ -4357,7 +4357,7 @@ package android.permissionpresenterservice {
package android.preference {
public class PreferenceManager {
public deprecated class PreferenceManager {
method public boolean isStorageCredentialProtected();
method public void setStorageCredentialProtected();
}

View File

@@ -27,11 +27,18 @@ import android.widget.Checkable;
* functionality.
* <p>
* This preference will store a boolean into the SharedPreferences.
*
*
* @attr ref android.R.styleable#CheckBoxPreference_summaryOff
* @attr ref android.R.styleable#CheckBoxPreference_summaryOn
* @attr ref android.R.styleable#CheckBoxPreference_disableDependentsState
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class CheckBoxPreference extends TwoStatePreference {
public CheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr) {

View File

@@ -50,7 +50,14 @@ import android.widget.TextView;
* @attr ref android.R.styleable#DialogPreference_dialogLayout
* @attr ref android.R.styleable#DialogPreference_positiveButtonText
* @attr ref android.R.styleable#DialogPreference_negativeButtonText
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public abstract class DialogPreference extends Preference implements
DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
PreferenceManager.OnActivityDestroyListener {

View File

@@ -42,7 +42,14 @@ import android.widget.EditText;
* This preference will store a string into the SharedPreferences.
* <p>
* See {@link android.R.styleable#EditText EditText Attributes}.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class EditTextPreference extends DialogPreference {
/**
* The edit text shown in the dialog.

View File

@@ -16,13 +16,6 @@
package android.preference;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.annotation.XmlRes;
import android.content.Context;
import android.content.res.XmlResourceParser;
@@ -32,6 +25,13 @@ import android.view.ContextThemeWrapper;
import android.view.InflateException;
import android.view.LayoutInflater;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
// TODO: fix generics
/**
* Generic XML inflater. This has been adapted from {@link LayoutInflater} and
@@ -41,7 +41,14 @@ import android.view.LayoutInflater;
* @param T The type of the items to inflate
* @param P The type of parents (that is those items that contain other items).
* Must implement {@link GenericInflater.Parent}
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
abstract class GenericInflater<T, P extends GenericInflater.Parent> {
private final boolean DEBUG = false;

View File

@@ -36,7 +36,14 @@ import android.util.AttributeSet;
*
* @attr ref android.R.styleable#ListPreference_entries
* @attr ref android.R.styleable#ListPreference_entryValues
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class ListPreference extends DialogPreference {
private CharSequence[] mEntries;
private CharSequence[] mEntryValues;

View File

@@ -16,8 +16,6 @@
package android.preference;
import java.util.Arrays;
import android.annotation.ArrayRes;
import android.app.AlertDialog.Builder;
import android.content.Context;
@@ -27,6 +25,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import java.util.Arrays;
/**
* @hide
* A {@link Preference} that displays a list of entries as
@@ -34,7 +34,14 @@ import android.util.AttributeSet;
*
* @attr ref android.R.styleable#ListPreference_entries
* @attr ref android.R.styleable#ListPreference_entryValues
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class MultiCheckPreference extends DialogPreference {
private CharSequence[] mEntries;
private String[] mEntryValues;

View File

@@ -35,10 +35,17 @@ import java.util.Set;
* This preference will store a set of strings into the SharedPreferences.
* This set will contain one or more values from the
* {@link #setEntryValues(CharSequence[])} array.
*
*
* @attr ref android.R.styleable#MultiSelectListPreference_entries
* @attr ref android.R.styleable#MultiSelectListPreference_entryValues
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class MultiSelectListPreference extends DialogPreference {
private CharSequence[] mEntries;
private CharSequence[] mEntryValues;
@@ -65,25 +72,25 @@ public class MultiSelectListPreference extends DialogPreference {
public MultiSelectListPreference(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.dialogPreferenceStyle);
}
public MultiSelectListPreference(Context context) {
this(context, null);
}
/**
* Sets the human-readable entries to be shown in the list. This will be
* shown in subsequent dialogs.
* <p>
* Each entry must have a corresponding index in
* {@link #setEntryValues(CharSequence[])}.
*
*
* @param entries The entries.
* @see #setEntryValues(CharSequence[])
*/
public void setEntries(CharSequence[] entries) {
mEntries = entries;
}
/**
* @see #setEntries(CharSequence[])
* @param entriesResId The entries array as a resource.
@@ -91,21 +98,21 @@ public class MultiSelectListPreference extends DialogPreference {
public void setEntries(@ArrayRes int entriesResId) {
setEntries(getContext().getResources().getTextArray(entriesResId));
}
/**
* The list of entries to be shown in the list in subsequent dialogs.
*
*
* @return The list as an array.
*/
public CharSequence[] getEntries() {
return mEntries;
}
/**
* 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.
*
*
* @param entryValues The array to be used as values to save for the preference.
*/
public void setEntryValues(CharSequence[] entryValues) {
@@ -119,20 +126,20 @@ public class MultiSelectListPreference extends DialogPreference {
public void setEntryValues(@ArrayRes int entryValuesResId) {
setEntryValues(getContext().getResources().getTextArray(entryValuesResId));
}
/**
* Returns the array of values to be saved for the preference.
*
*
* @return The array of values.
*/
public CharSequence[] getEntryValues() {
return mEntryValues;
}
/**
* Sets the value of the key. This should contain entries in
* {@link #getEntryValues()}.
*
*
* @param values The values to set for the key.
*/
public void setValues(Set<String> values) {
@@ -141,17 +148,17 @@ public class MultiSelectListPreference extends DialogPreference {
persistStringSet(values);
}
/**
* Retrieves the current value of the key.
*/
public Set<String> getValues() {
return mValues;
}
/**
* Returns the index of the given value (in the entry values array).
*
*
* @param value The value whose index should be returned.
* @return The index of the value, or -1 if not found.
*/
@@ -165,17 +172,17 @@ public class MultiSelectListPreference extends DialogPreference {
}
return -1;
}
@Override
protected void onPrepareDialogBuilder(Builder builder) {
super.onPrepareDialogBuilder(builder);
if (mEntries == null || mEntryValues == null) {
throw new IllegalStateException(
"MultiSelectListPreference requires an entries array and " +
"an entryValues array.");
}
boolean[] checkedItems = getSelectedItems();
builder.setMultiChoiceItems(mEntries, checkedItems,
new DialogInterface.OnMultiChoiceClickListener() {
@@ -190,24 +197,24 @@ public class MultiSelectListPreference extends DialogPreference {
mNewValues.clear();
mNewValues.addAll(mValues);
}
private boolean[] getSelectedItems() {
final CharSequence[] entries = mEntryValues;
final int entryCount = entries.length;
final Set<String> values = mValues;
boolean[] result = new boolean[entryCount];
for (int i = 0; i < entryCount; i++) {
result[i] = values.contains(entries[i].toString());
}
return result;
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (positiveResult && mPreferenceChanged) {
final Set<String> values = mNewValues;
if (callChangeListener(values)) {
@@ -216,25 +223,25 @@ public class MultiSelectListPreference extends DialogPreference {
}
mPreferenceChanged = false;
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index) {
final CharSequence[] defaultValues = a.getTextArray(index);
final int valueCount = defaultValues.length;
final Set<String> result = new HashSet<String>();
for (int i = 0; i < valueCount; i++) {
result.add(defaultValues[i].toString());
}
return result;
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
setValues(restoreValue ? getPersistedStringSet(mValues) : (Set<String>) defaultValue);
}
@Override
protected Parcelable onSaveInstanceState() {
final Parcelable superState = super.onSaveInstanceState();
@@ -242,42 +249,42 @@ public class MultiSelectListPreference extends DialogPreference {
// No need to save instance state
return superState;
}
final SavedState myState = new SavedState(superState);
myState.values = getValues();
return myState;
}
private static class SavedState extends BaseSavedState {
Set<String> values;
public SavedState(Parcel source) {
super(source);
values = new HashSet<String>();
String[] strings = source.readStringArray();
final int stringCount = strings.length;
for (int i = 0; i < stringCount; i++) {
values.add(strings[i]);
}
}
public SavedState(Parcelable superState) {
super(superState);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeStringArray(values.toArray(new String[0]));
}
public static final Parcelable.Creator<SavedState> CREATOR =
new Parcelable.Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}

View File

@@ -86,7 +86,14 @@ import java.util.Set;
* @attr ref android.R.styleable#Preference_recycleEnabled
* @attr ref android.R.styleable#Preference_singleLineTitle
* @attr ref android.R.styleable#Preference_iconSpaceReserved
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class Preference implements Comparable<Preference> {
/**
* Specify for {@link #setOrder(int)} if a specific order is not required.
@@ -165,7 +172,14 @@ public class Preference implements Comparable<Preference> {
* {@link Preference} has been changed by the user and is
* about to be set and/or persisted. This gives the client a chance
* to prevent setting and/or persisting the value.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnPreferenceChangeListener {
/**
* Called when a Preference has been changed by the user. This is
@@ -182,7 +196,14 @@ public class Preference implements Comparable<Preference> {
/**
* Interface definition for a callback to be invoked when a {@link Preference} is
* clicked.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnPreferenceClickListener {
/**
* Called when a Preference has been clicked.
@@ -2070,7 +2091,14 @@ public class Preference implements Comparable<Preference> {
/**
* A base class for managing the instance state of a {@link Preference}.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public static class BaseSavedState extends AbsSavedState {
public BaseSavedState(Parcel source) {
super(source);

View File

@@ -97,34 +97,13 @@ import java.util.List;
* guide.</p>
* </div>
*
* <a name="SampleCode"></a>
* <h3>Sample Code</h3>
*
* <p>The following sample code shows a simple preference activity that
* has two different sets of preferences. The implementation, consisting
* of the activity itself as well as its two preference fragments is:</p>
*
* {@sample development/samples/ApiDemos/src/com/example/android/apis/preference/PreferenceWithHeaders.java
* activity}
*
* <p>The preference_headers resource describes the headers to be displayed
* and the fragments associated with them. It is:
*
* {@sample development/samples/ApiDemos/res/xml/preference_headers.xml headers}
*
* <p>The first header is shown by Prefs1Fragment, which populates itself
* from the following XML resource:</p>
*
* {@sample development/samples/ApiDemos/res/xml/fragmented_preferences.xml preferences}
*
* <p>Note that this XML resource contains a preference screen holding another
* fragment, the Prefs1FragmentInner implemented here. This allows the user
* to traverse down a hierarchy of preferences; pressing back will pop each
* fragment off the stack to return to the previous preferences.
*
* <p>See {@link PreferenceFragment} for information on implementing the
* fragments themselves.
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public abstract class PreferenceActivity extends ListActivity implements
PreferenceManager.OnPreferenceTreeClickListener,
PreferenceFragment.OnPreferenceStartFragmentCallback {
@@ -337,7 +316,14 @@ public abstract class PreferenceActivity extends ListActivity implements
/**
* Description of a single Header item that the user can select.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public static final class Header implements Parcelable {
/**
* Identifier for this header, to correlate with a new list when

View File

@@ -29,7 +29,14 @@ import android.util.AttributeSet;
* read the <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>
* guide.</p>
* </div>
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class PreferenceCategory extends PreferenceGroup {
private static final String TAG = "PreferenceCategory";

View File

@@ -39,7 +39,14 @@ import java.util.Set;
*
* @see Preference#setPreferenceDataStore(PreferenceDataStore)
* @see PreferenceManager#setPreferenceDataStore(PreferenceDataStore)
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface PreferenceDataStore {
/**

View File

@@ -88,25 +88,14 @@ import android.widget.TextView;
* guide.</p>
* </div>
*
* <a name="SampleCode"></a>
* <h3>Sample Code</h3>
*
* <p>The following sample code shows a simple preference fragment that is
* populated from a resource. The resource it loads is:</p>
*
* {@sample development/samples/ApiDemos/res/xml/preferences.xml preferences}
*
* <p>The fragment implementation itself simply populates the preferences
* when created. Note that the preferences framework takes care of loading
* the current values out of the app preferences and writing them when changed:</p>
*
* {@sample development/samples/ApiDemos/src/com/example/android/apis/preference/FragmentPreferences.java
* fragment}
*
* @see Preference
* @see PreferenceScreen
*
* @deprecated Use {@link android.support.v7.preference.PreferenceFragmentCompat}
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public abstract class PreferenceFragment extends Fragment implements

View File

@@ -24,7 +24,14 @@ import android.widget.FrameLayout;
/**
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class PreferenceFrameLayout extends FrameLayout {
private static final int DEFAULT_BORDER_TOP = 0;
private static final int DEFAULT_BORDER_BOTTOM = 0;

View File

@@ -16,15 +16,16 @@
package android.preference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.AttributeSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* A container for multiple
* {@link Preference} objects. It is a base class for Preference objects that are
@@ -38,7 +39,14 @@ import android.util.AttributeSet;
* </div>
*
* @attr ref android.R.styleable#PreferenceGroup_orderingFromXml
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public abstract class PreferenceGroup extends Preference implements GenericInflater.Parent<Preference> {
/**
* The container for child {@link Preference}s. This is sorted based on the

View File

@@ -16,10 +16,6 @@
package android.preference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.preference.Preference.OnPreferenceChangeInternalListener;
@@ -30,6 +26,10 @@ import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* An adapter that returns the {@link Preference} contained in this group.
* In most cases, this adapter should be the base class for any custom
@@ -49,7 +49,14 @@ import android.widget.ListView;
* @see PreferenceCategoryAdapter
*
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class PreferenceGroupAdapter extends BaseAdapter
implements OnPreferenceChangeInternalListener {

View File

@@ -16,16 +16,16 @@
package android.preference;
import com.android.internal.util.XmlUtils;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import java.io.IOException;
import com.android.internal.util.XmlUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import java.io.IOException;
/**
* The {@link PreferenceInflater} is used to inflate preference hierarchies from
@@ -34,7 +34,14 @@ import android.util.AttributeSet;
* Do not construct this directly, instead use
* {@link Context#getSystemService(String)} with
* {@link Context#PREFERENCE_INFLATER_SERVICE}.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
class PreferenceInflater extends GenericInflater<Preference, PreferenceGroup> {
private static final String TAG = "PreferenceInflater";
private static final String INTENT_TAG_NAME = "intent";

View File

@@ -47,7 +47,14 @@ import java.util.List;
* {@link PreferenceActivity#addPreferencesFromResource(int)}.
*
* @see PreferenceActivity
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class PreferenceManager {
private static final String TAG = "PreferenceManager";
@@ -1004,7 +1011,14 @@ public class PreferenceManager {
* clicked.
*
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnPreferenceTreeClickListener {
/**
* Called when a preference in the tree rooted at this
@@ -1021,7 +1035,14 @@ public class PreferenceManager {
/**
* Interface definition for a class that will be called when the container's activity
* receives an activity result.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnActivityResultListener {
/**
@@ -1036,7 +1057,14 @@ public class PreferenceManager {
/**
* Interface definition for a class that will be called when the container's activity
* is stopped.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnActivityStopListener {
/**
@@ -1048,7 +1076,14 @@ public class PreferenceManager {
/**
* Interface definition for a class that will be called when the container's activity
* is destroyed.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices.
* For more information on using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public interface OnActivityDestroyListener {
/**

View File

@@ -86,7 +86,14 @@ import android.widget.TextView;
* </div>
*
* @see PreferenceCategory
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public final class PreferenceScreen extends PreferenceGroup implements AdapterView.OnItemClickListener,
DialogInterface.OnDismissListener {

View File

@@ -40,7 +40,14 @@ import android.util.AttributeSet;
* @attr ref android.R.styleable#RingtonePreference_ringtoneType
* @attr ref android.R.styleable#RingtonePreference_showDefault
* @attr ref android.R.styleable#RingtonePreference_showSilent
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class RingtonePreference extends Preference implements
PreferenceManager.OnActivityResultListener {

View File

@@ -28,7 +28,14 @@ import com.android.internal.R;
/**
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class SeekBarDialogPreference extends DialogPreference {
private final Drawable mMyIcon;

View File

@@ -29,7 +29,14 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
/**
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class SeekBarPreference extends Preference
implements OnSeekBarChangeListener {

View File

@@ -45,7 +45,14 @@ import com.android.internal.annotations.GuardedBy;
/**
* Turns a {@link SeekBar} into a volume control.
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callback {
private static final String TAG = "SeekBarVolumizer";

View File

@@ -36,7 +36,14 @@ import android.widget.Switch;
* @attr ref android.R.styleable#SwitchPreference_switchTextOff
* @attr ref android.R.styleable#SwitchPreference_switchTextOn
* @attr ref android.R.styleable#SwitchPreference_disableDependentsState
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class SwitchPreference extends TwoStatePreference {
@UnsupportedAppUsage
private final Listener mListener = new Listener();

View File

@@ -32,7 +32,14 @@ import android.widget.TextView;
* Common base class for preferences that have two selectable states, persist a
* boolean value in SharedPreferences, and may have dependent preferences that are
* enabled/disabled based on the current state.
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public abstract class TwoStatePreference extends Preference {
private CharSequence mSummaryOn;

View File

@@ -31,7 +31,14 @@ import com.android.internal.R;
/**
* @hide
*
* @deprecated Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
* <a href="{@docRoot}reference/androidx/preference/package-summary.html">
* Preference Library</a> for consistent behavior across all devices. For more information on
* using the AndroidX Preference Library see
* <a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
*/
@Deprecated
public class VolumePreference extends SeekBarDialogPreference implements
PreferenceManager.OnActivityStopListener, View.OnKeyListener, SeekBarVolumizer.Callback {
@UnsupportedAppUsage

View File

@@ -1,23 +1,9 @@
<HTML>
<BODY>
Provides classes that manage application preferences and implement the preferences UI.
Using these ensures that all the preferences within each application are maintained
in the same manner and the user experience is consistent with that of the system and
other applications.
<p>
The preferences portion of an application
should be ran as a separate {@link android.app.Activity} that extends
the {@link android.preference.PreferenceActivity} class. In the PreferenceActivity, a
{@link android.preference.PreferenceScreen} object should be the root element of the layout.
The PreferenceScreen contains {@link android.preference.Preference} elements such as a
{@link android.preference.CheckBoxPreference}, {@link android.preference.EditTextPreference},
{@link android.preference.ListPreference}, {@link android.preference.PreferenceCategory},
or {@link android.preference.RingtonePreference}. </p>
<p>
All settings made for a given {@link android.preference.Preference} will be automatically saved
to the application's instance of {@link android.content.SharedPreferences}. Access to the
SharedPreferences is simple with {@link android.preference.Preference#getSharedPreferences()}.</p>
<p>
Note that saved preferences are accessible only to the application that created them.</p>
These classes are deprecated. Use the <a href="{@docRoot}jetpack/androidx.html">AndroidX</a>
<a href="{@docRoot}reference/androidx/preference/package-summary.html">
Preference Library</a> for consistent behavior across all devices. For more information on
using the AndroidX Preference Library see
<a href="{@docRoot}guide/topics/ui/settings.html">Settings</a>.
</BODY>
</HTML>