Search in sources :

Example 21 with RoundedBitmapDrawable

use of android.support.v4.graphics.drawable.RoundedBitmapDrawable in project android_packages_apps_Dialer by MoKee.

the class ContactPhotoLoaderTest method testGetIcon_Photo.

public void testGetIcon_Photo() {
    ContactInfo info = getTestContactInfo();
    info.photoUri = getResourceUri(R.drawable.phone_icon);
    ContactPhotoLoader loader = new ContactPhotoLoader(mContext, info);
    assertTrue(loader.getIcon() instanceof RoundedBitmapDrawable);
}
Also used : RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable) ContactInfo(com.android.dialer.calllog.ContactInfo)

Example 22 with RoundedBitmapDrawable

use of android.support.v4.graphics.drawable.RoundedBitmapDrawable in project BaseProject by feer921.

the class ViewUtil method imageViewRounded.

public static void imageViewRounded(ImageView iv, int imageResId, int roundedRadius) {
    Resources res = iv.getResources();
    RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(res, BitmapFactory.decodeResource(res, imageResId));
    roundedBitmapDrawable.setCornerRadius(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, roundedRadius, res.getDisplayMetrics()));
    iv.setImageDrawable(roundedBitmapDrawable);
}
Also used : RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable) Resources(android.content.res.Resources)

Example 23 with RoundedBitmapDrawable

use of android.support.v4.graphics.drawable.RoundedBitmapDrawable in project weiui by kuaifan.

the class PictureAlbumDirectoryAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    final LocalMediaFolder folder = folders.get(position);
    String name = folder.getName();
    int imageNum = folder.getImageNum();
    String imagePath = folder.getFirstImagePath();
    boolean isChecked = folder.isChecked();
    int checkedNum = folder.getCheckedNum();
    holder.tv_sign.setVisibility(checkedNum > 0 ? View.VISIBLE : View.INVISIBLE);
    holder.itemView.setSelected(isChecked);
    if (mimeType == PictureMimeType.ofAudio()) {
        holder.first_image.setImageResource(R.drawable.audio_placeholder);
    } else {
        RequestOptions options = new RequestOptions().placeholder(R.drawable.ic_placeholder).centerCrop().sizeMultiplier(0.5f).diskCacheStrategy(DiskCacheStrategy.ALL).override(160, 160);
        Glide.with(holder.itemView.getContext()).asBitmap().load(imagePath).apply(options).into(new BitmapImageViewTarget(holder.first_image) {

            @Override
            protected void setResource(Bitmap resource) {
                RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(mContext.getResources(), resource);
                circularBitmapDrawable.setCornerRadius(8);
                holder.first_image.setImageDrawable(circularBitmapDrawable);
            }
        });
    }
    holder.image_num.setText("(" + imageNum + ")");
    holder.tv_folder_name.setText(name);
    holder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (onItemClickListener != null) {
                for (LocalMediaFolder mediaFolder : folders) {
                    mediaFolder.setChecked(false);
                }
                folder.setChecked(true);
                notifyDataSetChanged();
                onItemClickListener.onItemClick(folder.getName(), folder.getImages());
            }
        }
    });
}
Also used : RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable) LocalMediaFolder(com.luck.picture.lib.weiui.library.entity.LocalMediaFolder) Bitmap(android.graphics.Bitmap) BitmapImageViewTarget(vip.kuaifan.weiui.extend.integration.glide.request.target.BitmapImageViewTarget) RequestOptions(vip.kuaifan.weiui.extend.integration.glide.request.RequestOptions) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Example 24 with RoundedBitmapDrawable

use of android.support.v4.graphics.drawable.RoundedBitmapDrawable in project philm by chrisbanes.

the class PhilmImageView method setImageBitmapImpl.

void setImageBitmapImpl(final Bitmap bitmap) {
    if (mAvatarMode) {
        RoundedBitmapDrawable d = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
        d.setCircular(true);
        setImageDrawable(d);
    } else {
        setImageBitmap(bitmap);
    }
}
Also used : RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable)

Example 25 with RoundedBitmapDrawable

use of android.support.v4.graphics.drawable.RoundedBitmapDrawable in project philm by chrisbanes.

the class PhilmImageView method setImageResourceImpl.

void setImageResourceImpl(@DrawableRes int resId) {
    if (mAvatarMode) {
        BitmapDrawable d = (BitmapDrawable) ContextCompat.getDrawable(getContext(), resId);
        RoundedBitmapDrawable rd = RoundedBitmapDrawableFactory.create(getResources(), d.getBitmap());
        rd.setCircular(true);
        setImageDrawable(rd);
    } else {
        setImageResource(resId);
    }
}
Also used : RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) RoundedBitmapDrawable(android.support.v4.graphics.drawable.RoundedBitmapDrawable)

Aggregations

RoundedBitmapDrawable (android.support.v4.graphics.drawable.RoundedBitmapDrawable)30 Bitmap (android.graphics.Bitmap)14 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 Resources (android.content.res.Resources)4 BitmapDrawable (android.graphics.drawable.BitmapDrawable)4 Drawable (android.graphics.drawable.Drawable)4 NonNull (android.support.annotation.NonNull)3 Nullable (android.support.annotation.Nullable)3 RecyclerView (android.support.v7.widget.RecyclerView)3 IOException (java.io.IOException)3 Uri (android.net.Uri)2 SpannableStringBuilder (android.text.SpannableStringBuilder)2 LayoutInflater (android.view.LayoutInflater)2 GlideAnimation (com.bumptech.glide.request.animation.GlideAnimation)2 BitmapImageViewTarget (com.bumptech.glide.request.target.BitmapImageViewTarget)2 NotificationManager (android.app.NotificationManager)1 PendingIntent (android.app.PendingIntent)1 Context (android.content.Context)1