// Path: nox/src/main/java/com/github/pedrovgs/nox/imageloader/transformation/CircleTransformation.java
// public class CircleTransformation implements Transformation {
// 
//   @Override public Bitmap transform(Bitmap source) {
//     int size = Math.min(source.getWidth(), source.getHeight());
//     int x = (source.getWidth() - size) / 2;
//     int y = (source.getHeight() - size) / 2;
//     Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
//     if (squaredBitmap != source) {
//       source.recycle();
//     }
//     Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
//     Canvas canvas = new Canvas(bitmap);
//     Paint paint = new Paint();
//     BitmapShader shader =
//         new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
//     paint.setShader(shader);
//     paint.setAntiAlias(true);
//     float r = size / 2f;
//     canvas.drawCircle(r, r, r, paint);
//     squaredBitmap.recycle();
//     return bitmap;
//   }
// 
//   @Override public String key() {
//     return "Circle_Transformation";
//   }
// }


import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import com.github.pedrovgs.nox.imageloader.transformation.CircleTransformation;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import com.squareup.picasso.Transformation;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
   * notifies when the resource has been downloaded.
   *
   * Listener and Target instances are going to be stored into a WeakHashMap to avoid a memory leak
   * when ImageLoader client code is garbage collected.
   */
  private ListenerTarget getLinearTarget(final Listener listener) {
    ListenerTarget target = targets.get(listener);
    if (target == null) {
      target = new ListenerTarget(listener);
      targets.put(listener, target);
    }
    return target;
  }

  private RequestCreator applyPlaceholder(RequestCreator bitmapRequest) {
    if (placeholderId != null) {
      bitmapRequest.placeholder(placeholderId);
    }
    return bitmapRequest;
  }

  /**
   * Lazy instantiation of the list of transformations used during the image download. This method
   * returns a List<Transformation> because Picasso doesn't support a null instance as
   * transformation.
   */
  private List<Transformation> getTransformations() {
    if (transformations == null) {
      transformations = new LinkedList<Transformation>();
      if (useCircularTransformation) {
// Path: nox/src/main/java/com/github/pedrovgs/nox/imageloader/transformation/CircleTransformation.java
// public class CircleTransformation implements Transformation {
// 
//   @Override public Bitmap transform(Bitmap source) {
//     int size = Math.min(source.getWidth(), source.getHeight());
//     int x = (source.getWidth() - size) / 2;
//     int y = (source.getHeight() - size) / 2;
//     Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
//     if (squaredBitmap != source) {
//       source.recycle();
//     }
//     Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
//     Canvas canvas = new Canvas(bitmap);
//     Paint paint = new Paint();
//     BitmapShader shader =
//         new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
//     paint.setShader(shader);
//     paint.setAntiAlias(true);
//     float r = size / 2f;
//     canvas.drawCircle(r, r, r, paint);
//     squaredBitmap.recycle();
//     return bitmap;
//   }
// 
//   @Override public String key() {
//     return "Circle_Transformation";
//   }
// }


// Path: nox/src/main/java/com/github/pedrovgs/nox/imageloader/PicassoImageLoader.java
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import com.github.pedrovgs.nox.imageloader.transformation.CircleTransformation;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import com.squareup.picasso.Transformation;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;

   * notifies when the resource has been downloaded.
   *
   * Listener and Target instances are going to be stored into a WeakHashMap to avoid a memory leak
   * when ImageLoader client code is garbage collected.
   */
  private ListenerTarget getLinearTarget(final Listener listener) {
    ListenerTarget target = targets.get(listener);
    if (target == null) {
      target = new ListenerTarget(listener);
      targets.put(listener, target);
    }
    return target;
  }

  private RequestCreator applyPlaceholder(RequestCreator bitmapRequest) {
    if (placeholderId != null) {
      bitmapRequest.placeholder(placeholderId);
    }
    return bitmapRequest;
  }

  /**
   * Lazy instantiation of the list of transformations used during the image download. This method
   * returns a List<Transformation> because Picasso doesn't support a null instance as
   * transformation.
   */
  private List<Transformation> getTransformations() {
    if (transformations == null) {
      transformations = new LinkedList<Transformation>();
      if (useCircularTransformation) {
        transformations.add(new CircleTransformation());