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


Java RoundedBitmapDrawableFactory類代碼示例

本文整理匯總了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory的典型用法代碼示例。如果您正苦於以下問題:Java RoundedBitmapDrawableFactory類的具體用法?Java RoundedBitmapDrawableFactory怎麽用?Java RoundedBitmapDrawableFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RoundedBitmapDrawableFactory類屬於android.support.v4.graphics.drawable包,在下文中一共展示了RoundedBitmapDrawableFactory類的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: loadRound

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
public static void loadRound(final Context context, String url, final ImageView iv) {
    Glide.with(context)//
            .load(url)//
            .asBitmap()//
            .placeholder(R.drawable.company_logo)//
            .centerCrop()//
            .into(new BitmapImageViewTarget(iv) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(context.getResources(),
                                    resource);
                    circularBitmapDrawable.setCircular(true);
                    iv.setImageDrawable(circularBitmapDrawable);
                }
            });
}
 
開發者ID:gaolhjy,項目名稱:cniao5,代碼行數:18,代碼來源:GlideUtils.java

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

示例4: handleSignInResult

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
/**
 * Handle a google signIn
 * @param result - the result of the signin attempt
 */
private void handleSignInResult(GoogleSignInResult result) {
    Log.d(TAG, "handleSignInResult:" + result.isSuccess());
    final ImageView accountImageView = findViewById(R.id.account_picture);
    if (result.isSuccess()) {
        // Signed in successfully, show authenticated UI.
        GoogleSignInAccount acct = result.getSignInAccount();
        if (acct != null) {
            Glide.with(this).load(acct.getPhotoUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(accountImageView) {
                /**
                 * Set a glide image
                 * @param resource - the image to set
                 */
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    accountImageView.setImageDrawable(circularBitmapDrawable);
                }
            });
        }
    }
}
 
開發者ID:iskandergaba,項目名稱:Botanist,代碼行數:27,代碼來源:AccountActivity.java

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

示例6: loadRoundImage

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
public  void loadRoundImage(final Context context, String imgPath, final ImageView imageView, int placeholderResId, int failedResId) {
    if (context == null) {
        return;
    }
    Context appContext = context.getApplicationContext();
    Glide.with(appContext).
            load(imgPath)
            .asBitmap()
            .placeholder(placeholderResId)
            .error(failedResId)
            .centerCrop()
            .into(new BitmapImageViewTarget(imageView) {
        @Override
        protected void setResource(Bitmap resource) {
            RoundedBitmapDrawable circularBitmapDrawable =
                    RoundedBitmapDrawableFactory.create(context.getResources(), resource);
            circularBitmapDrawable.setCircular(true);
            imageView.setImageDrawable(circularBitmapDrawable);
        }
    });
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:22,代碼來源:GlideImageLoader.java

示例7: showAvatar

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
/*****
 * MVP View methods implementation
 *****/

@Override public void showAvatar(String avatarUrl) {
	if (avatarUrl.contains("gif")) {
		Glide.with(this).load(avatarUrl).asGif().into(avatar);
	} else {
		Glide.with(this).load(avatarUrl).asBitmap().centerCrop().into(new BitmapImageViewTarget(avatar) {
			@Override
			protected void setResource(Bitmap resource) {
				RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
				circularBitmapDrawable.setCircular(true);
				avatar.setImageDrawable(circularBitmapDrawable);
			}
		});
	}
}
 
開發者ID:stuxo,項目名稱:REDAndroid,代碼行數:19,代碼來源:ProfileActivity.java

示例8: displayRoundImageFromUrl

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
/**
 * Crops image into a circle that fits within the ImageView.
 */
public static void displayRoundImageFromUrl(final Context context, final String url, final ImageView imageView) {
    Glide.with(context)
            .load(url)
            .asBitmap()
            .centerCrop()
            .dontAnimate()
            .into(new BitmapImageViewTarget(imageView) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(context.getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    imageView.setImageDrawable(circularBitmapDrawable);
                }
            });
}
 
開發者ID:narenkukreja,項目名稱:quire,代碼行數:20,代碼來源:ImageUtils.java

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

示例10: onBindViewHolder

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
@Override
public void onBindViewHolder(final XianViewHolder holder, int position) {
    final XianduItem item = xiandus.get(position);
    holder.rootView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            WebUtils.openInternal(context, item.getUrl());
        }
    });
    holder.tv_name.setText(String.format("%s. %s", position + 1, item.getName()));
    holder.tv_info.setText(item.getUpdateTime() + " • " + item.getFrom());
    Glide.with(context).load(item.getIcon()).asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).fitCenter().into(new SimpleTarget<Bitmap>() {
        @Override
        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
            RoundedBitmapDrawable circularBitmapDrawable =
                    RoundedBitmapDrawableFactory.create(context.getResources(), resource);
            circularBitmapDrawable.setCircular(true);
            holder.iv.setImageDrawable(circularBitmapDrawable);
        }
    });
}
 
開發者ID:li-yu,項目名稱:FakeWeather,代碼行數:22,代碼來源:XianduAdapter.java

示例11: onBindViewHolder

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
@Override
public void onBindViewHolder(final AnchorHotViewHolder holder, final int position) {

    ComMember member = mData.get(position);
    if (StringUtils.isNotEmpty(member.getImageUrl())){
        Glide.with(mContext).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(holder.pic) {
            @Override
            protected void setResource(Bitmap resource) {
                RoundedBitmapDrawable circularBitmapDrawable =
                        RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
                circularBitmapDrawable.setCircular(true);
                holder.pic.setImageDrawable(circularBitmapDrawable);
            }
        });
    }
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:17,代碼來源:AcInfoMemberAdapter.java

示例12: setCircleInfo

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
public void setCircleInfo(CircleInfo info) {
    mTvCircleName.setText(info.getCircleName());
    mTvTitle.setText(info.getCircleName());
    mTvCircleNum.setText(info.getNum() + "人");
    mTvIntroduce.setText(info.getAnnouncement());
    String path = info.getLogoUrl();
    if (!path.contains("http://")) {
        path = BuildConfig.QiniuBase + path;
    }
    Glide.with(this.getActivity()).load(path).asBitmap().error(R.mipmap.icon_default_pic).centerCrop().into(new BitmapImageViewTarget(mImgTop) {
        @Override
        protected void setResource(Bitmap resource) {
            RoundedBitmapDrawable circularBitmapDrawable =
                    RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
            circularBitmapDrawable.setCircular(true);
            mImgTop.setImageDrawable(circularBitmapDrawable);
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:20,代碼來源:CircleDynDelegate.java

示例13: setData

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
public void setData(CircleInfo info)
    {
        Glide.with(this.getActivity()).load(info.getLogoUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(mImgPic) {
            @Override
            protected void setResource(Bitmap resource) {
                RoundedBitmapDrawable circularBitmapDrawable =
                        RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
                circularBitmapDrawable.setCircular(true);
                mImgPic.setImageDrawable(circularBitmapDrawable);
            }
        });
        mTvName.setText(info.getCircleName());
        mEdtAnnouncement.setText(info.getAnnouncement());
//        mTvType.setText();

    }
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:17,代碼來源:CreateCircleDelegate.java

示例14: onBindViewHolder

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
@Override
public void onBindViewHolder(final AnchorHotViewHolder holder, final int position) {
    ProjectComments comments = mData.get(position);
    if (comments != null) {
        ComMember member = comments.getCommentUser();
        if (null != member && StringUtils.isNotEmpty(member.getName())) {
            holder.tvName.setText(member.getName());
        }
        if (StringUtils.isNotEmpty(member.getImageUrl())){

            Glide.with(mContext).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(holder.pic) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    holder.pic.setImageDrawable(circularBitmapDrawable);
                }
            });
        }
    }
    holder.tvContent.setText(comments.getComment());
    holder.tvTime.setText(TimeUtil.getDateToString(comments.getCreateTime()));

}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:26,代碼來源:CommentsAdapter.java

示例15: setUserInfo

import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; //導入依賴的package包/類
public void setUserInfo(ComMember member) {

        if (member.getImageUrl() != null) {
            Glide.with(this.getActivity()).load(member.getImageUrl()).asBitmap().centerCrop().into(new BitmapImageViewTarget(imgPic) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(getActivity().getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    imgPic.setImageDrawable(circularBitmapDrawable);
                }
            });
        }
        if (member.getName() != null)
            tvName.setText(member.getName());

        tv_center_shareholder.setVisibility(member.getShareholder() == 0 ? View.GONE : View.VISIBLE);
        tv_center_investor.setVisibility(member.getInvestor() == 0 ? View.GONE : View.VISIBLE);

        if (StringUtils.isNotEmpty(member.getCompany()))
            tv_center_company.setText(member.getCompany());
        if (StringUtils.isNotEmpty(member.getPosition()))
            tv_center_position.setText(member.getPosition());
    }
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:25,代碼來源:UserInfoDelegate.java


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