RoundedTransformationBuilder.java 3.08 KB
package com.makeramen;

import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.widget.ImageView.ScaleType;
import com.squareup.picasso.Transformation;

public final class RoundedTransformationBuilder
{
  private final DisplayMetrics a = Resources.getSystem().getDisplayMetrics();
  private float b = 0.0F;
  private boolean c = false;
  private float d = 0.0F;
  private ColorStateList e = ColorStateList.valueOf(-16777216);
  private ImageView.ScaleType f = ImageView.ScaleType.FIT_CENTER;
  
  public final RoundedTransformationBuilder borderColor(int paramInt)
  {
    this.e = ColorStateList.valueOf(paramInt);
    return this;
  }
  
  public final RoundedTransformationBuilder borderColor(ColorStateList paramColorStateList)
  {
    this.e = paramColorStateList;
    return this;
  }
  
  public final RoundedTransformationBuilder borderWidth(float paramFloat)
  {
    this.d = paramFloat;
    return this;
  }
  
  public final RoundedTransformationBuilder borderWidthDp(float paramFloat)
  {
    this.d = TypedValue.applyDimension(1, paramFloat, this.a);
    return this;
  }
  
  public final Transformation build()
  {
    new Transformation()
    {
      public final String key()
      {
        return "r:" + RoundedTransformationBuilder.d(RoundedTransformationBuilder.this) + "b:" + RoundedTransformationBuilder.c(RoundedTransformationBuilder.this) + "c:" + RoundedTransformationBuilder.b(RoundedTransformationBuilder.this) + "o:" + RoundedTransformationBuilder.a(RoundedTransformationBuilder.this);
      }
      
      public final Bitmap transform(Bitmap paramAnonymousBitmap)
      {
        Bitmap localBitmap = RoundedDrawable.fromBitmap(paramAnonymousBitmap).setScaleType(RoundedTransformationBuilder.e(RoundedTransformationBuilder.this)).setCornerRadius(RoundedTransformationBuilder.d(RoundedTransformationBuilder.this)).setBorderWidth(RoundedTransformationBuilder.c(RoundedTransformationBuilder.this)).setBorderColor(RoundedTransformationBuilder.b(RoundedTransformationBuilder.this)).setOval(RoundedTransformationBuilder.a(RoundedTransformationBuilder.this)).toBitmap();
        if (!paramAnonymousBitmap.equals(localBitmap)) {
          paramAnonymousBitmap.recycle();
        }
        return localBitmap;
      }
    };
  }
  
  public final RoundedTransformationBuilder cornerRadius(float paramFloat)
  {
    this.b = paramFloat;
    return this;
  }
  
  public final RoundedTransformationBuilder cornerRadiusDp(float paramFloat)
  {
    this.b = TypedValue.applyDimension(1, paramFloat, this.a);
    return this;
  }
  
  public final RoundedTransformationBuilder oval(boolean paramBoolean)
  {
    this.c = paramBoolean;
    return this;
  }
  
  public final RoundedTransformationBuilder scaleType(ImageView.ScaleType paramScaleType)
  {
    this.f = paramScaleType;
    return this;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/makeramen/RoundedTransformationBuilder.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */