本文整理匯總了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable.setFilterBitmap方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundedBitmapDrawable.setFilterBitmap方法的具體用法?Java RoundedBitmapDrawable.setFilterBitmap怎麽用?Java RoundedBitmapDrawable.setFilterBitmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.graphics.drawable.RoundedBitmapDrawable
的用法示例。
在下文中一共展示了RoundedBitmapDrawable.setFilterBitmap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(
Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mItem.getUrl());
mItemView.setIcon(new BitmapDrawable(getResources(), icon));
mItem.setTileType(isFallbackColorDefault ? MostVisitedTileType.ICON_DEFAULT
: MostVisitedTileType.ICON_COLOR);
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(), icon);
int cornerRadius = Math.round(ICON_CORNER_RADIUS_DP
* getResources().getDisplayMetrics().density * icon.getWidth()
/ mDesiredIconSize);
roundedIcon.setCornerRadius(cornerRadius);
roundedIcon.setAntiAlias(true);
roundedIcon.setFilterBitmap(true);
mItemView.setIcon(roundedIcon);
mItem.setTileType(MostVisitedTileType.ICON_REAL);
}
mSnapshotMostVisitedChanged = true;
if (mIsInitialLoad) loadTaskCompleted();
}
示例2: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(Bitmap icon, int fallbackColor) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mUrl);
mView.setIcon(new BitmapDrawable(getResources(), icon));
if (mIsInitialLoad) {
if (fallbackColor == ICON_BACKGROUND_COLOR) {
mNumGrayIcons++;
} else {
mNumColorIcons++;
}
}
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(), icon);
int cornerRadius = Math.round(ICON_CORNER_RADIUS_DP
* getResources().getDisplayMetrics().density * icon.getWidth()
/ mDesiredIconSize);
roundedIcon.setCornerRadius(cornerRadius);
roundedIcon.setAntiAlias(true);
roundedIcon.setFilterBitmap(true);
mView.setIcon(roundedIcon);
if (mIsInitialLoad) mNumRealIcons++;
}
mSnapshotMostVisitedChanged = true;
if (mIsInitialLoad) loadTaskCompleted();
}
示例3: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(
@Nullable Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
if (mTrackLoadTask) mObserver.onLoadTaskCompleted();
Tile tile = getTile(mUrl);
if (tile == null) return; // The tile might have been removed.
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mUrl);
tile.setIcon(new BitmapDrawable(mContext.getResources(), icon));
tile.setType(isFallbackColorDefault ? TileVisualType.ICON_DEFAULT
: TileVisualType.ICON_COLOR);
} else {
RoundedBitmapDrawable roundedIcon =
RoundedBitmapDrawableFactory.create(mContext.getResources(), icon);
int cornerRadius = Math.round(ICON_CORNER_RADIUS_DP
* mContext.getResources().getDisplayMetrics().density * icon.getWidth()
/ mDesiredIconSize);
roundedIcon.setCornerRadius(cornerRadius);
roundedIcon.setAntiAlias(true);
roundedIcon.setFilterBitmap(true);
tile.setIcon(roundedIcon);
tile.setType(TileVisualType.ICON_REAL);
}
mObserver.onTileIconChanged(tile);
}