當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。