Lines Matching refs:preference

17 package android.support.v7.preference;
125 public void addItemFromInflater(Preference preference) {
126 addPreference(preference);
131 * @return The number of preference children in this group.
149 * preference's order.
151 * @param preference The preference to add.
152 * @return Whether the preference is now in this group.
154 public boolean addPreference(Preference preference) {
155 if (mPreferenceList.contains(preference)) {
160 if (preference.getOrder() == DEFAULT_ORDER) {
162 preference.setOrder(mCurrentPreferenceOrder++);
165 if (preference instanceof PreferenceGroup) {
168 ((PreferenceGroup)preference).setOrderingAsAdded(mOrderingAsAdded);
172 int insertionIndex = Collections.binarySearch(mPreferenceList, preference);
177 if (!onPrepareAddPreference(preference)) {
182 mPreferenceList.add(insertionIndex, preference);
186 final String key = preference.getKey();
194 preference.onAttachedToHierarchy(preferenceManager, id);
195 preference.assignParent(this);
198 preference.onAttached();
209 * @param preference The preference to remove.
210 * @return Whether the preference was found and removed.
212 public boolean removePreference(Preference preference) {
213 final boolean returnValue = removePreferenceInt(preference);
218 private boolean removePreferenceInt(Preference preference) {
220 preference.onPrepareForRemoval();
221 if (preference.getParent() == this) {
222 preference.assignParent(null);
224 boolean success = mPreferenceList.remove(preference);
226 // If this preference, or another preference with the same key, gets re-added
229 // seamlessly updated. If the preference is not re-added by the time the handler
230 // runs, we take that as a signal that the preference will not be re-added soon
235 // preferences will receive a newly generated id. This use pattern of the preference
237 final String key = preference.getKey();
239 mIdRecycleCache.put(key, preference.getId());
244 preference.onDetached();
268 * @param preference The preference to add.
269 * @return Whether to allow adding the preference (true), or not (false).
271 protected boolean onPrepareAddPreference(Preference preference) {
272 preference.onParentChanged(this, shouldDisableDependents());
279 * returned (to retrieve the other preference with the same key, call this
280 * method on the first preference). If this preference has the key, it will
283 * This will recursively search for the preference into children that are
286 * @param key The key of the preference to retrieve.
295 final Preference preference = getPreference(i);
296 final String curKey = preference.getKey();
299 return preference;
302 if (preference instanceof PreferenceGroup) {
303 final Preference returnedPreference = ((PreferenceGroup)preference)
315 * Whether this preference group should be shown on the same screen as its
319 * screen as this preference.
338 // Mark as attached so if a preference is later added to this group, we
405 * {@link android.support.v14.preference.PreferenceFragment#scrollToPreference(String)} and
406 * {@link android.support.v14.preference.PreferenceFragment#scrollToPreference(Preference)} or
423 * @param preference {@link Preference} object to find
427 int getPreferenceAdapterPosition(Preference preference);