diff options
| author | Filip Pavlis <pavlis@google.com> | 2017-03-01 18:50:00 +0000 |
|---|---|---|
| committer | Filip Pavlis <pavlis@google.com> | 2017-03-02 14:26:58 +0000 |
| commit | fd59645ba7d4445b3308489ef07c700aaed85c6f (patch) | |
| tree | 1613e4b429c7862b157e7d272eae41580b4c7b7c /core/java/android/preference/Preference.java | |
| parent | 89c376ed66ba65b7878719efbbc0ec603441f520 (diff) | |
JavaDoc improvements as suggested by API council.
Bug: b/35813554
Test: Not needed.
Change-Id: I009497bab66c9cc624f434f6d2dde0d80381d961
Diffstat (limited to 'core/java/android/preference/Preference.java')
| -rw-r--r-- | core/java/android/preference/Preference.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 089eaeceac55..62c5dca0ada1 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -410,11 +410,13 @@ public class Preference implements Comparable<Preference> { /** * Sets a {@link PreferenceDataStore} to be used by this Preference instead of using * {@link android.content.SharedPreferences}. - * <p> - * The data store will remain assigned even if the Preference is moved between multiple - * instances of {@link PreferenceFragment}. + * + * <p>The data store will remain assigned even if the Preference is moved around the preference + * hierarchy. It will also override a data store propagated from the {@link PreferenceManager} + * that owns this Preference. * * @param dataStore The {@link PreferenceDataStore} to be used by this Preference. + * @see PreferenceManager#setPreferenceDataStore(PreferenceDataStore) */ public void setPreferenceDataStore(PreferenceDataStore dataStore) { mPreferenceDataStore = dataStore; @@ -424,6 +426,12 @@ public class Preference implements Comparable<Preference> { * Returns {@link PreferenceDataStore} used by this Preference. Returns {@code null} if * {@link android.content.SharedPreferences} is used instead. * + * <p>By default preferences always use {@link android.content.SharedPreferences}. To make this + * preference to use the {@link PreferenceDataStore} you need to assign your implementation + * to the Preference itself via {@link #setPreferenceDataStore(PreferenceDataStore)} or to its + * {@link PreferenceManager} via + * {@link PreferenceManager#setPreferenceDataStore(PreferenceDataStore)}. + * * @return The {@link PreferenceDataStore} used by this Preference or {@code null} if none. */ @Nullable @@ -1457,12 +1465,12 @@ public class Preference implements Comparable<Preference> { } /** - * Implement this to set the initial value of the Preference. + * Implement this to set the initial value of the Preference. * <p> - * If <var>restorePersistedValue</var> is true, you should restore the - * Preference value from the {@link android.content.SharedPreferences}. If - * <var>restorePersistedValue</var> is false, you should set the Preference - * value to defaultValue that is given (and possibly store to SharedPreferences + * If <var>restorePersistedValue</var> is true, you should restore the + * Preference value from the {@link android.content.SharedPreferences}. If + * <var>restorePersistedValue</var> is false, you should set the Preference + * value to defaultValue that is given (and possibly store to SharedPreferences * if {@link #shouldPersist()} is true). * <p> * This may not always be called. One example is if it should not persist |
