當前位置: 首頁>>代碼示例>>Java>>正文


Java RoundedBitmapDrawableFactory.create方法代碼示例

本文整理匯總了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);
}
 
開發者ID:appwise-labs,項目名稱:NoInternetDialog,代碼行數:22,代碼來源:NoInternetDialog.java

示例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);
    }
 
開發者ID:penghuanliang,項目名稱:Rxjava2.0Demo,代碼行數:24,代碼來源:DoActivity.java

示例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);
    }
}
 
開發者ID:TheAndroidMaster,項目名稱:MediaNotification,代碼行數:20,代碼來源:CircleImageView.java

示例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();
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:25,代碼來源:NewTabPageView.java

示例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);
    }
}
 
開發者ID:asmolko,項目名稱:MyDebts,代碼行數:22,代碼來源:ImageCache.java

示例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);
    }
}
 
開發者ID:k0shk0sh,項目名稱:FastAccess,代碼行數:25,代碼來源:FloatingView.java

示例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);
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:20,代碼來源:PicassoPreferenceIconTarget.java

示例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);
    }
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:17,代碼來源:HistoryItemView.java

示例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());

    }
 
開發者ID:ndhunju,項目名稱:dailyJournal,代碼行數:24,代碼來源:PartyDetailFragment.java

示例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;
}
 
開發者ID:alorma,項目名稱:TimelineView,代碼行數:19,代碼來源:RoundTimelineView.java

示例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;
}
 
開發者ID:RikkaApps,項目名稱:FCM-for-Mojo,代碼行數:20,代碼來源:ChatIcon.java

示例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;
    }
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:14,代碼來源:RoundedContact.java

示例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;
}
 
開發者ID:malah-code,項目名稱:Open-Quran-Radio,代碼行數:16,代碼來源:ImageHelper.java

示例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);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:16,代碼來源:BookmarkItemRow.java

示例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


注:本文中的android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。