本文整理匯總了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory.create方法的典型用法代碼示例。如果您正苦於以下問題:Java RoundedBitmapDrawableFactory.create方法的具體用法?Java RoundedBitmapDrawableFactory.create怎麽用?Java RoundedBitmapDrawableFactory.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory
的用法示例。
在下文中一共展示了RoundedBitmapDrawableFactory.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initHalloweenTheme
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
private void initHalloweenTheme() {
if (!isHalloween) {
return;
}
Bitmap bmp = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ground);
RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getContext().getResources(), bmp);
dr.setCornerRadius(dialogRadius);
dr.setAntiAlias(true);
ground.setBackgroundDrawable(dr);
plane.setImageResource(R.drawable.witch);
tomb.setImageResource(R.drawable.tomb_hw);
moon.setVisibility(View.VISIBLE);
ground.setVisibility(View.VISIBLE);
pumpkin.setVisibility(View.VISIBLE);
wifiOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
mobileOn.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
airplaneOff.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.colorNoInternetGradCenterH), PorterDuff.Mode.SRC_IN);
}
示例2: onCreate
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_do);
ButterKnife.bind(this);
// handDo();
// processRetry();
// processRetryWhen();
// processRepeat();
processRepeatWhen();
GradientDrawable drawable = new GradientDrawable();
drawable.setColor(Color.BLUE);
drawable.setCornerRadius(5);
tvD.setText("贏");
tvD.setBackground(drawable);
BitmapDrawable drawable1 = new BitmapDrawable(getResources(), BitmapFactory.decodeResource(getResources(), R.drawable.bg1));
Bitmap bm = drawTBit(drawable1);
ivDo.setImageBitmap(drawCircle(bm));
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), BitmapFactory.decodeResource(getResources(), R.drawable.bg1));
roundedBitmapDrawable.setCornerRadius(20);
ivDo1.setImageDrawable(roundedBitmapDrawable);
}
示例3: onDraw
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
public void onDraw(Canvas canvas) {
if (bitmap != null) {
int size = Math.min(canvas.getWidth(), canvas.getHeight());
if (size != this.size) {
this.size = size;
bitmap = ThumbnailUtils.extractThumbnail(bitmap, size, size);
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
roundedBitmapDrawable.setCornerRadius(size / 2);
roundedBitmapDrawable.setAntiAlias(true);
bitmap = ImageUtils.drawableToBitmap(roundedBitmapDrawable);
}
canvas.drawBitmap(bitmap, 0, 0, paint);
}
}
示例4: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的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();
}
示例5: onResponse
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
return;
}
try(ResponseBody body = response.body()) {
Bitmap loaded = BitmapFactory.decodeStream(body.byteStream());
if (loaded == null) { // decode failed
return;
}
Bitmap scaled = Bitmap.createScaledBitmap(loaded, mCaller.getWidth(), mCaller.getHeight(), false);
RoundedBitmapDrawable rbd = RoundedBitmapDrawableFactory.create(mCaller.getContext().getResources(), scaled);
rbd.setCornerRadius(Math.max(scaled.getWidth(), scaled.getHeight()) / 2.0f);
setRetrieved(rbd);
ImageCache.getInstance(mCaller.getContext()).putCached(call.request().url().toString(), rbd);
mCaller.post(this);
}
}
示例6: setupImageView
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
public void setupImageView() {
if (imageView != null) {
String path = PrefHelper.getString(PrefConstant.CUSTOM_ICON);
if (!InputHelper.isEmpty(path)) {
path = Uri.decode(PrefHelper.getString(PrefConstant.CUSTOM_ICON));
boolean fileExists = new File(path).exists();
if (fileExists) {
imageView.setImageDrawable(null);
Bitmap src = BitmapFactory.decodeFile(path);
if (src == null) {
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
return;
}
RoundedBitmapDrawable dr = RoundedBitmapDrawableFactory.create(getResources(), src);
dr.setCornerRadius(Math.max(src.getWidth(), src.getHeight()) / 2.0f);
imageView.setImageDrawable(dr);
return;
}
}
imageView.setImageResource(R.drawable.ic_app_drawer_icon);
onMoving(false);
}
}
示例7: onBitmapLoaded
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
// Updating icons from Java is not supported prior to API 11.
if (!AppConstants.Versions.feature11Plus) {
return;
}
final Drawable drawable;
if (cornerRadius > 0) {
final RoundedBitmapDrawable roundedBitmapDrawable;
roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(resources, bitmap);
roundedBitmapDrawable.setCornerRadius(cornerRadius);
roundedBitmapDrawable.setAntiAlias(true);
drawable = roundedBitmapDrawable;
} else {
drawable = new BitmapDrawable(resources, bitmap);
}
preference.setIcon(drawable);
}
示例8: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(Bitmap icon, int fallbackColor,
boolean isFallbackColorDefault) {
// TODO(twellington): move this somewhere that can be shared with bookmarks.
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(getItem().getUrl());
mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), icon));
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(),
Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplayedIconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
mIconImageView.setImageDrawable(roundedIcon);
}
}
示例9: setPartyViews
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
private void setPartyViews(Party party){
//make the image circular
//make the image circular
if (!TextUtils.isEmpty(mParty.getPicturePath())) {
RoundedBitmapDrawable bitmapDrawable = RoundedBitmapDrawableFactory.create(
getResources(),
mParty.getPicturePath());
bitmapDrawable.setCircular(true);
picIV.setImageDrawable(bitmapDrawable);
} else {
picIV.setImageResource(R.drawable.default_party_pic);
}
nameTV.setText(party.getName());
balanceTV.setText(UtilsFormat.formatCurrency(party.calculateBalances(), getActivity()));
balanceTV.setTextColor(getResources().getColor(party.calculateBalances() < 0 ? R.color.red_medium : R.color.green_medium));
getActivity().setTitle(mParty.getName());
}
示例10: transform
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
private Bitmap transform(Bitmap source, int size) {
if (source != null) {
RoundedBitmapDrawable drawable =
RoundedBitmapDrawableFactory.create(getResources(), source);
drawable.setCornerRadius(100);
Bitmap.Config config = source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
Bitmap output = Bitmap.createBitmap(size, size, config);
Canvas canvas = new Canvas(output);
drawable.setAntiAlias(true);
drawable.setBounds(0, 0, size, size);
drawable.draw(canvas);
if (!source.equals(output)) {
source.recycle();
}
return output;
}
return null;
}
示例11: clipToRound
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
/**
* 把 Bitmap 變圓。
*
* @param context Context
* @param bitmap 要處理的 Bitmap
* @return 圓形的 Bitmap
*/
public static Bitmap clipToRound(Context context, Bitmap bitmap) {
final RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap);
drawable.setAntiAlias(true);
drawable.setCircular(true);
drawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.draw(canvas);
return bitmap;
}
示例12: get
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
static RoundedBitmapDrawable get(Activity activity, Uri thumbnail) {
RoundedBitmapDrawable dr = null;
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(activity.getContentResolver(), thumbnail);
dr = RoundedBitmapDrawableFactory.create(activity.getResources(), bitmap);
dr.setCircular(true);
} catch (Exception e) {
e.printStackTrace();
}
return dr;
}
示例13: TransformToRounded
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
public static Bitmap TransformToRounded(Bitmap source, Context mContext, int width, int heigth) {
// Create the RoundedBitmapDrawable.
RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(mContext.getResources(), source);
drawable.setCircular(true);
//drawable.setCornerRadius(mContext.getCornerRadius(source));
Bitmap output = Bitmap.createBitmap(width, heigth, source.getConfig());
Canvas canvas = new Canvas(output);
drawable.setAntiAlias(true);
drawable.setBounds(0, 0, width, heigth);
drawable.draw(canvas);
if (source != output) {
source.recycle();
}
return output;
}
示例14: onLargeIconAvailable
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
@Override
public void onLargeIconAvailable(
Bitmap icon, int fallbackColor, boolean isFallbackColorDefault) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(mUrl);
mIconImageView.setImageDrawable(new BitmapDrawable(getResources(), icon));
} else {
RoundedBitmapDrawable roundedIcon = RoundedBitmapDrawableFactory.create(
getResources(),
Bitmap.createScaledBitmap(icon, mDisplayedIconSize, mDisplayedIconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
mIconImageView.setImageDrawable(roundedIcon);
}
}
示例15: getFaviconDrawable
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入方法依賴的package包/類
private Drawable getFaviconDrawable(Bitmap icon, int fallbackColor, String url) {
if (icon == null) {
mIconGenerator.setBackgroundColor(fallbackColor);
icon = mIconGenerator.generateIconForUrl(url);
return new BitmapDrawable(getResources(), icon);
} else {
RoundedBitmapDrawable roundedIcon =
RoundedBitmapDrawableFactory.create(getResources(),
Bitmap.createScaledBitmap(icon, mFaviconSize, mFaviconSize, false));
roundedIcon.setCornerRadius(mCornerRadius);
return roundedIcon;
}
}
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:14,代碼來源:ConfirmImportantSitesDialogFragment.java