// Path: app/src/main/java/nich/work/aequorea/common/ui/widget/glide/CircleTransformation.java
// public class CircleTransformation extends BitmapTransformation {
// 
//     public CircleTransformation(Context context) {
//         super(context);
//     }
// 
//     private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
//         if (source == null) return null;
// 
//         int size = Math.min(source.getWidth(), source.getHeight());
//         int x = (source.getWidth() - size) / 2;
//         int y = (source.getHeight() - size) / 2;
// 
//         Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
// 
//         Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
//         if (result == null) {
//             result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
//         }
// 
//         Canvas canvas = new Canvas(result);
//         Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG | Paint
//                 .ANTI_ALIAS_FLAG);
//         paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader
//                 .TileMode.CLAMP));
//         float r = size / 2f;
//         canvas.drawCircle(r, r, r, paint);
//         return result;
//     }
// 
//     @Override
//     protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
//         return circleCrop(pool, toTransform);
//     }
// 
//     @Override
//     public String getId() {
//         return getClass().getName();
//     }
// }


import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.Target;
import nich.work.aequorea.common.ui.widget.glide.CircleTransformation;
package nich.work.aequorea.common.utils;




public class ImageHelper {
    public static Target setImage(Context context, String url, ImageView imageView) {
        return setImage(context, url, imageView, false, -1);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, boolean isRound) {
        return setImage(context, url, imageView, isRound, -1);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, int placeHolder) {
        return setImage(context, url, imageView, false, placeHolder);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, Drawable placeHolder) {
        return setImage(context, url, imageView, false, placeHolder);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, boolean isRound, int placeHolder) {
        if (isRound) {
            return Glide.with(context)
                .load(url)
// Path: app/src/main/java/nich/work/aequorea/common/ui/widget/glide/CircleTransformation.java
// public class CircleTransformation extends BitmapTransformation {
// 
//     public CircleTransformation(Context context) {
//         super(context);
//     }
// 
//     private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
//         if (source == null) return null;
// 
//         int size = Math.min(source.getWidth(), source.getHeight());
//         int x = (source.getWidth() - size) / 2;
//         int y = (source.getHeight() - size) / 2;
// 
//         Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
// 
//         Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
//         if (result == null) {
//             result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
//         }
// 
//         Canvas canvas = new Canvas(result);
//         Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG | Paint
//                 .ANTI_ALIAS_FLAG);
//         paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader
//                 .TileMode.CLAMP));
//         float r = size / 2f;
//         canvas.drawCircle(r, r, r, paint);
//         return result;
//     }
// 
//     @Override
//     protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
//         return circleCrop(pool, toTransform);
//     }
// 
//     @Override
//     public String getId() {
//         return getClass().getName();
//     }
// }


// Path: app/src/main/java/nich/work/aequorea/common/utils/ImageHelper.java
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.Target;
import nich.work.aequorea.common.ui.widget.glide.CircleTransformation;

package nich.work.aequorea.common.utils;




public class ImageHelper {
    public static Target setImage(Context context, String url, ImageView imageView) {
        return setImage(context, url, imageView, false, -1);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, boolean isRound) {
        return setImage(context, url, imageView, isRound, -1);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, int placeHolder) {
        return setImage(context, url, imageView, false, placeHolder);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, Drawable placeHolder) {
        return setImage(context, url, imageView, false, placeHolder);
    }
    
    public static Target setImage(Context context, String url, ImageView imageView, boolean isRound, int placeHolder) {
        if (isRound) {
            return Glide.with(context)
                .load(url)
                .transform(new CircleTransformation(context))