Search in sources :

Example 1 with ExpandablePreferenceGroup

use of org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup in project AndroidChromium by JackyAndroid.

the class SingleCategoryPreferences method updateBlockedHeader.

private void updateBlockedHeader(int numBlocked) {
    ExpandablePreferenceGroup blockedGroup = (ExpandablePreferenceGroup) getPreferenceScreen().findPreference(BLOCKED_GROUP);
    if (numBlocked == 0) {
        if (blockedGroup != null)
            getPreferenceScreen().removePreference(blockedGroup);
        return;
    }
    if (!mGroupByAllowBlock)
        return;
    // Set the title and arrow icons for the header.
    blockedGroup.setGroupTitle(R.string.website_settings_blocked_group_heading, numBlocked);
    TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResources(), mBlockListExpanded ? R.drawable.ic_expanded : R.drawable.ic_collapsed);
    blockedGroup.setExpanded(mBlockListExpanded);
    blockedGroup.setIcon(icon);
}
Also used : ExpandablePreferenceGroup(org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Example 2 with ExpandablePreferenceGroup

use of org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup in project AndroidChromium by JackyAndroid.

the class SingleCategoryPreferences method updateAllowedHeader.

/**
 * Update the Category Header for the Allowed list.
 * @param numAllowed The number of sites that are on the Allowed list
 * @param toggleValue The value the global toggle will have once precessing ends.
 */
private void updateAllowedHeader(int numAllowed, boolean toggleValue) {
    ExpandablePreferenceGroup allowedGroup = (ExpandablePreferenceGroup) getPreferenceScreen().findPreference(ALLOWED_GROUP);
    if (numAllowed == 0) {
        if (allowedGroup != null)
            getPreferenceScreen().removePreference(allowedGroup);
        return;
    }
    if (!mGroupByAllowBlock)
        return;
    // When the toggle is set to Blocked, the Allowed list header should read 'Exceptions', not
    // 'Allowed' (because it shows exceptions from the rule).
    int resourceId = toggleValue ? R.string.website_settings_allowed_group_heading : R.string.website_settings_exceptions_group_heading;
    // Set the title and arrow icons for the header.
    allowedGroup.setGroupTitle(resourceId, numAllowed);
    TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResources(), mAllowListExpanded ? R.drawable.ic_expanded : R.drawable.ic_collapsed);
    allowedGroup.setExpanded(mAllowListExpanded);
    allowedGroup.setIcon(icon);
}
Also used : ExpandablePreferenceGroup(org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Aggregations

ExpandablePreferenceGroup (org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup)2 TintedDrawable (org.chromium.chrome.browser.widget.TintedDrawable)2