当前位置: 首页>>代码示例>>Java>>正文


Java RoundedBitmapDrawable类代码示例

本文整理汇总了Java中android.support.v4.graphics.drawable.RoundedBitmapDrawable的典型用法代码示例。如果您正苦于以下问题:Java RoundedBitmapDrawable类的具体用法?Java RoundedBitmapDrawable怎么用?Java RoundedBitmapDrawable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RoundedBitmapDrawable类属于android.support.v4.graphics.drawable包,在下文中一共展示了RoundedBitmapDrawable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initHalloweenTheme

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.RoundedBitmapDrawable; //导入依赖的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.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();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:25,代码来源:NewTabPageView.java

示例10: onBindViewHolder

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的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: setCenterMaker

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的package包/类
/**
 * 设置地图中心的标记,也是定位的当前位置
 * 暂注释掉,测试后解除
 */
private void setCenterMaker(final LatLng latLng, final float radius, String url) {
    logo = getLayoutInflater().inflate(R.layout.view_sign_logo, null);
    imgHeadCenter = (ImageView) logo.findViewById(R.id.head_signmap);

    if (roundedBitmapDrawable != null) {
        imgHeadCenter.setImageDrawable(roundedBitmapDrawable);
        Log.e("load","imgHeadCenter2="+roundedBitmapDrawable);
    }
    if (latLng != null) {

        addCenterMark(latLng);
        addCircle(latLng, radius);
    }


    Utils.load(GdmapTestLocateActivity.this, url, imgHeadCenter, new OnImgLoadFinish() {
        @Override
        public void loadFinish(RoundedBitmapDrawable drawable) {
            GdmapTestLocateActivity.this.roundedBitmapDrawable = drawable;
            Log.e("load","imgHeadCenter1="+drawable);
        }

    });

}
 
开发者ID:larrySmile02,项目名称:MultipleViewMap,代码行数:30,代码来源:GdmapTestLocateActivity.java

示例12: showDialog

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的package包/类
public void showDialog(String title, String end, String start, String reputation, String encouragment, String referee,
                       Drawable profileImage, Goal.GoalCompleteResult goalCompleteResult, String guid) {
    Bundle bundle = new Bundle();
    bundle.putBoolean("isMyGoal", true);
    bundle.putString("title", title);
    bundle.putString("end", end);
    bundle.putString("start", start);
    bundle.putString("reputation", reputation);
    bundle.putString("referee", referee);
    bundle.putString("encouragement", encouragment);
    if (profileImage instanceof RoundedBitmapDrawable)
        bundle.putParcelable("profile", ((RoundedBitmapDrawable) profileImage).getBitmap());
    else if (profileImage instanceof BitmapDrawable)
        bundle.putParcelable("profile", ((BitmapDrawable) profileImage).getBitmap());
    bundle.putSerializable("goalCompleteResult", goalCompleteResult);
    bundle.putString("guid", guid);

    GoalsDetailedDialog detailedDialog = new GoalsDetailedDialog();
    detailedDialog.setArguments(bundle);
    detailedDialog.setTargetFragment(this, Constants.RESULT_MY_GOAL_DIALOG);
    detailedDialog.show(getActivity().getSupportFragmentManager(), "GoalsDetailedDialog");
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:23,代码来源:MyGoalsFragment.java

示例13: showDialog

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的package包/类
public void showDialog(String title, String end, String start, String reputation, String encouragment, String referee,
                       Drawable profileImage, Goal.GoalCompleteResult goalCompleteResult, String guid) {
    Bundle bundle = new Bundle();
    bundle.putBoolean("isMyGoal", false);
    bundle.putString("title", title);
    bundle.putString("end", end);
    bundle.putString("start", start);
    bundle.putString("reputation", reputation);
    bundle.putString("referee", referee);
    bundle.putString("encouragement", encouragment);
    if (profileImage instanceof RoundedBitmapDrawable)
        bundle.putParcelable("profile", ((RoundedBitmapDrawable) profileImage).getBitmap());
    else if (profileImage instanceof BitmapDrawable)
        bundle.putParcelable("profile", ((BitmapDrawable) profileImage).getBitmap());
    bundle.putSerializable("goalCompleteResult", goalCompleteResult);
    bundle.putString("guid", guid);

    GoalsDetailedDialog detailedDialog = new GoalsDetailedDialog();
    detailedDialog.setArguments(bundle);
    detailedDialog.setTargetFragment(this, Constants.RESULT_MY_GOAL_DIALOG);
    detailedDialog.show(getActivity().getSupportFragmentManager(), "GoalsDetailedDialog");
}
 
开发者ID:Q115,项目名称:Goalie_Android,代码行数:23,代码来源:RequestsFragment.java

示例14: onBindViewHolder

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的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

示例15: setCircleInfo

import android.support.v4.graphics.drawable.RoundedBitmapDrawable; //导入依赖的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


注:本文中的android.support.v4.graphics.drawable.RoundedBitmapDrawable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。