本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.getDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.getDrawable方法的具体用法?Java ApiCompatibilityUtils.getDrawable怎么用?Java ApiCompatibilityUtils.getDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.base.ApiCompatibilityUtils
的用法示例。
在下文中一共展示了ApiCompatibilityUtils.getDrawable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpIcons
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Sets compound drawables (icons) for different kinds of list entries,
* i.e. New Folder, Normal and Selected.
*/
private void setUpIcons(FolderListEntry entry, TextView textView) {
int iconId = 0;
if (entry.mType == FolderListEntry.TYPE_NORMAL) {
iconId = R.drawable.bookmark_folder;
} else if (entry.mType == FolderListEntry.TYPE_NEW_FOLDER) {
// For new folder, start_icon is different.
iconId = R.drawable.bookmark_add_folder;
}
Drawable drawableStart = TintedDrawable.constructTintedDrawable(textView.getResources(),
iconId);
// Selected entry has an end_icon, a blue check mark.
Drawable drawableEnd = entry.mIsSelected ? ApiCompatibilityUtils.getDrawable(
textView.getResources(), R.drawable.ic_check_googblue_24dp) : null;
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(textView,
drawableStart, null, drawableEnd, null);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:22,代码来源:BookmarkFolderSelectActivity.java
示例2: configureChildView
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
void configureChildView(int childPosition, ViewHolder viewHolder) {
if (isMoreButton(childPosition)) {
Resources resources = mActivity.getResources();
String text = resources.getString(R.string.recent_tabs_show_more);
viewHolder.textView.setText(text);
Drawable drawable = ApiCompatibilityUtils.getDrawable(
resources, R.drawable.more_horiz);
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
viewHolder.textView, drawable, null, null, null);
} else {
CurrentlyOpenTab openTab = getChild(childPosition);
viewHolder.textView.setText(TextUtils.isEmpty(openTab.getTitle()) ? openTab.getUrl()
: openTab.getTitle());
loadLocalFavicon(viewHolder, openTab.getUrl());
}
}
示例3: updateSyncSummaryAndIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Updates the summary and icon for this preference to reflect the current state of syncing.
*/
public void updateSyncSummaryAndIcon() {
setSummary(getSyncStatusSummary(getContext()));
if (SyncPreference.showSyncErrorIcon(getContext())) {
setIcon(ApiCompatibilityUtils.getDrawable(
getContext().getResources(), R.drawable.sync_error));
} else {
// Sets preference icon and tints it to blue.
Drawable icon = ApiCompatibilityUtils.getDrawable(
getContext().getResources(), R.drawable.permission_background_sync);
icon.setColorFilter(ApiCompatibilityUtils.getColor(
getContext().getResources(), R.color.light_active_color),
PorterDuff.Mode.SRC_IN);
setIcon(icon);
}
}
示例4: AddExceptionPreference
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Construct a AddException preference.
* @param context The current context.
* @param key The key to use for the preference.
* @param message The custom message to show in the dialog.
* @param callback A callback to receive notifications that an exception has been added.
*/
public AddExceptionPreference(
Context context, String key, String message, SiteAddedCallback callback) {
super(context);
mDialogMessage = message;
mSiteAddedCallback = callback;
setOnPreferenceClickListener(this);
setKey(key);
Resources resources = getContext().getResources();
mPrefAccentColor = ApiCompatibilityUtils.getColor(resources, R.color.pref_accent_color);
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(resources, R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(mPrefAccentColor, PorterDuff.Mode.SRC_IN);
setIcon(plusIcon);
setTitle(resources.getString(R.string.website_settings_add_site));
}
示例5: NewTabButton
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Constructor for inflating from XML.
*/
public NewTabButton(Context context, AttributeSet attrs) {
super(context, attrs);
mNormalDrawable = ApiCompatibilityUtils.getDrawable(
getResources(), R.drawable.btn_new_tab_white);
mNormalDrawable.setBounds(
0, 0, mNormalDrawable.getIntrinsicWidth(), mNormalDrawable.getIntrinsicHeight());
mNormalDrawable.setCallback(this);
mIncognitoDrawable = ApiCompatibilityUtils.getDrawable(
getResources(), R.drawable.btn_new_tab_incognito);
mIncognitoDrawable.setBounds(
0, 0,
mIncognitoDrawable.getIntrinsicWidth(), mIncognitoDrawable.getIntrinsicHeight());
mIncognitoDrawable.setCallback(this);
mIsIncognito = false;
}
示例6: AutofillPaymentInstrument
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Builds a payment instrument for the given credit card.
*
* @param context The application context.
* @param webContents The web contents where PaymentRequest was invoked.
* @param card The autofill card that can be used for payment.
* @param billingAddress The billing address for the card.
*/
public AutofillPaymentInstrument(Context context, WebContents webContents, CreditCard card,
@Nullable AutofillProfile billingAddress) {
super(card.getGUID(), card.getObfuscatedNumber(), card.getName(),
card.getIssuerIconDrawableId() == 0
? null
: ApiCompatibilityUtils.getDrawable(
context.getResources(), card.getIssuerIconDrawableId()));
mContext = context;
mWebContents = webContents;
mCard = card;
mBillingAddress = billingAddress;
mIsEditable = true;
checkAndUpateCardCompleteness();
}
示例7: loadIconForResolveInfo
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private Drawable loadIconForResolveInfo(ResolveInfo info) {
try {
final int iconRes = info.getIconResource();
if (iconRes != 0) {
Resources res = mManager.getResourcesForApplication(info.activityInfo.packageName);
Drawable icon = ApiCompatibilityUtils.getDrawable(res, iconRes);
return icon;
}
} catch (NameNotFoundException | NotFoundException e) {
// Could not find the icon. loadIcon call below will return the default app icon.
}
return info.loadIcon(mManager);
}
示例8: RecentTabsRowAdapter
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Creates an RecentTabsRowAdapter used to populate an ExpandableList with other
* devices and foreign tab cells.
*
* @param activity The Android activity this adapter will work in.
* @param recentTabsManager The RecentTabsManager that will act as the data source.
*/
public RecentTabsRowAdapter(Activity activity, RecentTabsManager recentTabsManager) {
mActivity = activity;
mRecentTabsManager = recentTabsManager;
mGroups = new ArrayList<Group>();
mFaviconCache = buildFaviconCache(MAX_NUM_FAVICONS_TO_CACHE);
Resources resources = activity.getResources();
mDefaultFavicon = ApiCompatibilityUtils.getDrawable(resources, R.drawable.default_favicon);
mFaviconSize = resources.getDimensionPixelSize(R.dimen.default_favicon_size);
RecordHistogram.recordEnumeratedHistogram("HistoryPage.OtherDevicesMenu",
OtherSessionsActions.MENU_INITIALIZED, OtherSessionsActions.LIMIT);
}
示例9: updateSecurityIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void updateSecurityIcon(int securityLevel) {
boolean isSmallDevice = !DeviceFormFactor.isTablet(getContext());
mCurrentIconResource =
LocationBarLayout.getSecurityIconResource(securityLevel, isSmallDevice, false);
if (mCurrentIconResource != 0 && mIconResourceWidths.get(mCurrentIconResource, -1) == -1) {
Drawable icon = ApiCompatibilityUtils.getDrawable(getResources(), mCurrentIconResource);
mIconResourceWidths.put(mCurrentIconResource, icon.getIntrinsicWidth());
}
ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mUrlBar,
mCurrentIconResource, 0, 0, 0);
}
示例10: getDisabledInAndroidIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Returns the icon for permissions that have been disabled by Android.
*/
Drawable getDisabledInAndroidIcon(Activity activity) {
Drawable icon = ApiCompatibilityUtils.getDrawable(activity.getResources(),
R.drawable.exclamation_triangle);
icon.mutate();
int disabledColor = ApiCompatibilityUtils.getColor(activity.getResources(),
R.color.pref_accent_color);
icon.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN);
return icon;
}
示例11: getDisabledIcon
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Returns the Drawable object of the icon for a content type with a disabled tint.
*/
public static Drawable getDisabledIcon(int contentType, Resources resources) {
Drawable icon = ApiCompatibilityUtils.getDrawable(resources, getIcon(contentType));
icon.mutate();
int disabledColor = ApiCompatibilityUtils.getColor(resources,
R.color.primary_text_disabled_material_light);
icon.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN);
return icon;
}
示例12: setPreferenceCategoryIcons
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void setPreferenceCategoryIcons() {
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
findPreference(PREF_AUTOFILL_PROFILES).setIcon(plusIcon);
plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
findPreference(PREF_AUTOFILL_CREDIT_CARDS).setIcon(plusIcon);
}
示例13: onFinishInflate
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {
super.onFinishInflate();
mLocationBar = (LocationBarPhone) findViewById(R.id.location_bar);
mToolbarButtonsContainer = (ViewGroup) findViewById(R.id.toolbar_buttons);
mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
mUrlBar = (TextView) findViewById(R.id.url_bar);
mUrlActionContainer = findViewById(R.id.url_action_container);
mBrowsingModeViews.add(mLocationBar);
mToolbarBackground = new ColorDrawable(getToolbarColorForVisualState(VisualState.NORMAL));
mTabSwitcherAnimationBgOverlay =
new ColorDrawable(getToolbarColorForVisualState(VisualState.NORMAL));
mLocationBarBackground =
ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.textbox);
mLocationBarBackground.getPadding(mLocationBarBackgroundPadding);
mLocationBar.setPadding(
mLocationBarBackgroundPadding.left, mLocationBarBackgroundPadding.top,
mLocationBarBackgroundPadding.right, mLocationBarBackgroundPadding.bottom);
setLayoutTransition(null);
mMenuButtonWrapper.setVisibility(View.VISIBLE);
inflateTabSwitchingResources();
setWillNotDraw(false);
}
示例14: setTabSwitcherAnimationMenuDrawable
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void setTabSwitcherAnimationMenuDrawable() {
mTabSwitcherAnimationMenuDrawable = ApiCompatibilityUtils.getDrawable(getResources(),
R.drawable.btn_menu);
mTabSwitcherAnimationMenuDrawable.mutate();
mTabSwitcherAnimationMenuDrawable.setColorFilter(
isIncognito() ? mLightModeDefaultColor : mDarkModeDefaultColor,
PorterDuff.Mode.SRC_IN);
((BitmapDrawable) mTabSwitcherAnimationMenuDrawable).setGravity(Gravity.CENTER);
}
示例15: setTabSwitcherAnimationMenuBadgeDrawable
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void setTabSwitcherAnimationMenuBadgeDrawable() {
mTabSwitcherAnimationMenuBadgeDarkDrawable = ApiCompatibilityUtils.getDrawable(
getResources(), R.drawable.badge_update_dark);
mTabSwitcherAnimationMenuBadgeDarkDrawable.mutate();
((BitmapDrawable) mTabSwitcherAnimationMenuBadgeDarkDrawable).setGravity(Gravity.CENTER);
mTabSwitcherAnimationMenuBadgeLightDrawable = ApiCompatibilityUtils.getDrawable(
getResources(), R.drawable.badge_update_light);
mTabSwitcherAnimationMenuBadgeLightDrawable.mutate();
((BitmapDrawable) mTabSwitcherAnimationMenuBadgeLightDrawable).setGravity(Gravity.CENTER);
}