@Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); holder.setDividerAllowedAbove(false); } }
private void setSummaries(PreferenceGroup screen) { for (int i = screen.getPreferenceCount(); i-- > 0; ) { setSummary(screen.getPreference(i)); } }
if ((pref = findPreference(R.string.pref_key__more_info__project_team)) != null && ((PreferenceGroup) pref).getPreferenceCount() == 0) { String[] data = (_cu.readTextfileFromRawRes(R.raw.project_team, "", "").trim() + "\n\n").split("\n"); for (int i = 0; i + 2 < data.length; i += 4) {
@NonNull private PreferenceGroup onMergeRoots(@Nullable PreferenceGroup givenRoot, @NonNull PreferenceGroup xmlRoot) { // If we were given a Preferences, use it as the root (ignoring the root // Preferences from the XML file). if (givenRoot == null) { xmlRoot.onAttachedToHierarchy(mPreferenceManager); return xmlRoot; } else { return givenRoot; } }
protected void removePreference(@Nullable Preference preference) { if (preference == null) { return; } PreferenceGroup parent = getPreferenceParent(getPreferenceScreen(), preference); if (parent == null) { return; } parent.removePreference(preference); }
((PreferenceGroup) parent).addItemFromInflater(item); rInflate(parser, item, attrs);
/** * Append a pref to given {@code target}. If target is null, the current screen is taken * The pref icon is tint according to color * * @param pref Preference to add * @param target The target to add the pref to, or null for current screen * @return true if successfully added */ protected boolean appendPreference(Preference pref, @Nullable PreferenceGroup target) { if (target == null) { if ((target = getPreferenceScreen()) == null) { return false; } } if (getIconTintColor() != null && pref.getIcon() != null && isAllowedToTint(pref)) { pref.setIcon(_cu.tintDrawable(pref.getIcon(), getIconTintColor())); } return target.addPreference(pref); } }
protected PreferenceGroup getPreferenceParent(PreferenceGroup prefGroup, Preference pref) { for (int i = 0; i < prefGroup.getPreferenceCount(); ++i) { Preference prefChild = prefGroup.getPreference(i); if (prefChild == pref) { return prefGroup; } if (prefChild instanceof PreferenceGroup) { PreferenceGroup childGroup = (PreferenceGroup) prefChild; PreferenceGroup result = getPreferenceParent(childGroup, pref); if (result != null) { return result; } } } return null; }
private static void tintIcons(final Context c, Preference preference) { if (preference instanceof PreferenceGroup) { PreferenceGroup group = ((PreferenceGroup) preference); for (int i = 0; i < group.getPreferenceCount(); i++) { tintIcons(c, group.getPreference(i)); } } else { CompatUtils.setDrawableColorAttr(c, preference.getIcon(), android.R.attr.textColorSecondary); } }
private void tintPrefIconsRecursive(PreferenceGroup prefGroup, @ColorInt int iconColor) { if (prefGroup != null && isAdded()) { int prefCount = prefGroup.getPreferenceCount(); for (int i = 0; i < prefCount; i++) { Preference pref = prefGroup.getPreference(i); if (pref != null) { if (isAllowedToTint(pref)) { pref.setIcon(_cu.tintDrawable(pref.getIcon(), iconColor)); } if (pref instanceof PreferenceGroup) { tintPrefIconsRecursive((PreferenceGroup) pref, iconColor); } } } } }