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;
}
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);
}
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);
}
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;
}
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);
}
Aggregations