Search in sources :

Example 1 with TintedDrawable

use of org.chromium.chrome.browser.widget.TintedDrawable in project AndroidChromium by JackyAndroid.

the class NewTabPageToolbar method initButton.

private ViewGroup initButton(int buttonId, int drawableId) {
    ViewGroup button = (ViewGroup) findViewById(buttonId);
    TextView textView = (TextView) button.getChildAt(0);
    TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResources(), drawableId);
    ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(textView, icon, null, null, null);
    return button;
}
Also used : ViewGroup(android.view.ViewGroup) TextView(android.widget.TextView) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Example 2 with TintedDrawable

use of org.chromium.chrome.browser.widget.TintedDrawable in project AndroidChromium by JackyAndroid.

the class RecentTabsGroupView method onFinishInflate.

@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mDeviceIcon = (ImageView) findViewById(R.id.device_icon);
    mTimeLabel = (TextView) findViewById(R.id.time_label);
    mDeviceLabel = (TextView) findViewById(R.id.device_label);
    mExpandCollapseIcon = (ImageView) findViewById(R.id.expand_collapse_icon);
    // Create drawable for expand/collapse arrow.
    LevelListDrawable collapseIcon = new LevelListDrawable();
    collapseIcon.addLevel(DRAWABLE_LEVEL_COLLAPSED, DRAWABLE_LEVEL_COLLAPSED, TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_expanded));
    TintedDrawable collapse = TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_collapsed);
    collapse.setTint(ApiCompatibilityUtils.getColorStateList(getResources(), R.color.blue_mode_tint));
    collapseIcon.addLevel(DRAWABLE_LEVEL_EXPANDED, DRAWABLE_LEVEL_EXPANDED, collapse);
    mExpandCollapseIcon.setImageDrawable(collapseIcon);
}
Also used : LevelListDrawable(android.graphics.drawable.LevelListDrawable) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Example 3 with TintedDrawable

use of org.chromium.chrome.browser.widget.TintedDrawable 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 4 with TintedDrawable

use of org.chromium.chrome.browser.widget.TintedDrawable in project AndroidChromium by JackyAndroid.

the class PaymentRequestSection method createAndAddChevron.

private ImageView createAndAddChevron(ViewGroup parent) {
    Resources resources = parent.getResources();
    TintedDrawable chevron = TintedDrawable.constructTintedDrawable(resources, R.drawable.ic_expanded, R.color.payments_section_chevron);
    ImageView view = new ImageView(parent.getContext());
    view.setImageDrawable(chevron);
    // Wrap whatever image is passed in.
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(params, mLargeSpacing);
    parent.addView(view, params);
    return view;
}
Also used : Resources(android.content.res.Resources) ImageView(android.widget.ImageView) TintedDrawable(org.chromium.chrome.browser.widget.TintedDrawable)

Example 5 with TintedDrawable

use of org.chromium.chrome.browser.widget.TintedDrawable 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

TintedDrawable (org.chromium.chrome.browser.widget.TintedDrawable)5 ExpandablePreferenceGroup (org.chromium.chrome.browser.preferences.ExpandablePreferenceGroup)2 Resources (android.content.res.Resources)1 LevelListDrawable (android.graphics.drawable.LevelListDrawable)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1