CrackMe.apk
Download file
package com.facebook.drawee.generic;
import android.content.res.Resources;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import com.facebook.common.internal.Preconditions;
import com.facebook.drawee.drawable.ScalingUtils;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
public class GenericDraweeHierarchyBuilder {
public static final ScalingUtils.ScaleType DEFAULT_ACTUAL_IMAGE_SCALE_TYPE = ScalingUtils.ScaleType.CENTER_CROP;
public static final int DEFAULT_FADE_DURATION = 300;
public static final ScalingUtils.ScaleType DEFAULT_SCALE_TYPE = ScalingUtils.ScaleType.CENTER_INSIDE;
@Nullable
private ColorFilter mActualImageColorFilter;
@Nullable
private PointF mActualImageFocusPoint;
@Nullable
private Matrix mActualImageMatrix;
@Nullable
private ScalingUtils.ScaleType mActualImageScaleType;
@Nullable
private Drawable mBackground;
private float mDesiredAspectRatio;
private int mFadeDuration;
@Nullable
private Drawable mFailureImage;
@Nullable
private ScalingUtils.ScaleType mFailureImageScaleType;
@Nullable
private List<Drawable> mOverlays;
@Nullable
private Drawable mPlaceholderImage;
@Nullable
private ScalingUtils.ScaleType mPlaceholderImageScaleType;
@Nullable
private Drawable mPressedStateOverlay;
@Nullable
private Drawable mProgressBarImage;
@Nullable
private ScalingUtils.ScaleType mProgressBarImageScaleType;
private Resources mResources;
@Nullable
private Drawable mRetryImage;
@Nullable
private ScalingUtils.ScaleType mRetryImageScaleType;
@Nullable
private RoundingParams mRoundingParams;
public GenericDraweeHierarchyBuilder(Resources resources) {
this.mResources = resources;
init();
}
public static GenericDraweeHierarchyBuilder newInstance(Resources resources) {
return new GenericDraweeHierarchyBuilder(resources);
}
private void init() {
this.mFadeDuration = 300;
this.mDesiredAspectRatio = 0.0f;
this.mPlaceholderImage = null;
ScalingUtils.ScaleType scaleType = DEFAULT_SCALE_TYPE;
this.mPlaceholderImageScaleType = scaleType;
this.mRetryImage = null;
this.mRetryImageScaleType = scaleType;
this.mFailureImage = null;
this.mFailureImageScaleType = scaleType;
this.mProgressBarImage = null;
this.mProgressBarImageScaleType = scaleType;
this.mActualImageScaleType = DEFAULT_ACTUAL_IMAGE_SCALE_TYPE;
this.mActualImageMatrix = null;
this.mActualImageFocusPoint = null;
this.mActualImageColorFilter = null;
this.mBackground = null;
this.mOverlays = null;
this.mPressedStateOverlay = null;
this.mRoundingParams = null;
}
public GenericDraweeHierarchyBuilder reset() {
init();
return this;
}
public Resources getResources() {
return this.mResources;
}
public GenericDraweeHierarchyBuilder setFadeDuration(int i) {
this.mFadeDuration = i;
return this;
}
public int getFadeDuration() {
return this.mFadeDuration;
}
public GenericDraweeHierarchyBuilder setDesiredAspectRatio(float f) {
this.mDesiredAspectRatio = f;
return this;
}
public float getDesiredAspectRatio() {
return this.mDesiredAspectRatio;
}
public GenericDraweeHierarchyBuilder setPlaceholderImage(@Nullable Drawable drawable) {
this.mPlaceholderImage = drawable;
return this;
}
public GenericDraweeHierarchyBuilder setPlaceholderImage(int i) {
this.mPlaceholderImage = this.mResources.getDrawable(i);
return this;
}
@Nullable
public Drawable getPlaceholderImage() {
return this.mPlaceholderImage;
}
public GenericDraweeHierarchyBuilder setPlaceholderImageScaleType(@Nullable ScalingUtils.ScaleType scaleType) {
this.mPlaceholderImageScaleType = scaleType;
return this;
}
@Nullable
public ScalingUtils.ScaleType getPlaceholderImageScaleType() {
return this.mPlaceholderImageScaleType;
}
public GenericDraweeHierarchyBuilder setPlaceholderImage(Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) {
this.mPlaceholderImage = drawable;
this.mPlaceholderImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setPlaceholderImage(int i, @Nullable ScalingUtils.ScaleType scaleType) {
this.mPlaceholderImage = this.mResources.getDrawable(i);
this.mPlaceholderImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setRetryImage(@Nullable Drawable drawable) {
this.mRetryImage = drawable;
return this;
}
public GenericDraweeHierarchyBuilder setRetryImage(int i) {
this.mRetryImage = this.mResources.getDrawable(i);
return this;
}
@Nullable
public Drawable getRetryImage() {
return this.mRetryImage;
}
public GenericDraweeHierarchyBuilder setRetryImageScaleType(@Nullable ScalingUtils.ScaleType scaleType) {
this.mRetryImageScaleType = scaleType;
return this;
}
@Nullable
public ScalingUtils.ScaleType getRetryImageScaleType() {
return this.mRetryImageScaleType;
}
public GenericDraweeHierarchyBuilder setRetryImage(Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) {
this.mRetryImage = drawable;
this.mRetryImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setRetryImage(int i, @Nullable ScalingUtils.ScaleType scaleType) {
this.mRetryImage = this.mResources.getDrawable(i);
this.mRetryImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setFailureImage(@Nullable Drawable drawable) {
this.mFailureImage = drawable;
return this;
}
public GenericDraweeHierarchyBuilder setFailureImage(int i) {
this.mFailureImage = this.mResources.getDrawable(i);
return this;
}
@Nullable
public Drawable getFailureImage() {
return this.mFailureImage;
}
public GenericDraweeHierarchyBuilder setFailureImageScaleType(@Nullable ScalingUtils.ScaleType scaleType) {
this.mFailureImageScaleType = scaleType;
return this;
}
@Nullable
public ScalingUtils.ScaleType getFailureImageScaleType() {
return this.mFailureImageScaleType;
}
public GenericDraweeHierarchyBuilder setFailureImage(Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) {
this.mFailureImage = drawable;
this.mFailureImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setFailureImage(int i, @Nullable ScalingUtils.ScaleType scaleType) {
this.mFailureImage = this.mResources.getDrawable(i);
this.mFailureImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setProgressBarImage(@Nullable Drawable drawable) {
this.mProgressBarImage = drawable;
return this;
}
public GenericDraweeHierarchyBuilder setProgressBarImage(int i) {
this.mProgressBarImage = this.mResources.getDrawable(i);
return this;
}
@Nullable
public Drawable getProgressBarImage() {
return this.mProgressBarImage;
}
public GenericDraweeHierarchyBuilder setProgressBarImageScaleType(@Nullable ScalingUtils.ScaleType scaleType) {
this.mProgressBarImageScaleType = scaleType;
return this;
}
@Nullable
public ScalingUtils.ScaleType getProgressBarImageScaleType() {
return this.mProgressBarImageScaleType;
}
public GenericDraweeHierarchyBuilder setProgressBarImage(Drawable drawable, @Nullable ScalingUtils.ScaleType scaleType) {
this.mProgressBarImage = drawable;
this.mProgressBarImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setProgressBarImage(int i, @Nullable ScalingUtils.ScaleType scaleType) {
this.mProgressBarImage = this.mResources.getDrawable(i);
this.mProgressBarImageScaleType = scaleType;
return this;
}
public GenericDraweeHierarchyBuilder setActualImageScaleType(@Nullable ScalingUtils.ScaleType scaleType) {
this.mActualImageScaleType = scaleType;
this.mActualImageMatrix = null;
return this;
}
@Nullable
public ScalingUtils.ScaleType getActualImageScaleType() {
return this.mActualImageScaleType;
}
public GenericDraweeHierarchyBuilder setActualImageFocusPoint(@Nullable PointF pointF) {
this.mActualImageFocusPoint = pointF;
return this;
}
@Nullable
public PointF getActualImageFocusPoint() {
return this.mActualImageFocusPoint;
}
public GenericDraweeHierarchyBuilder setActualImageColorFilter(@Nullable ColorFilter colorFilter) {
this.mActualImageColorFilter = colorFilter;
return this;
}
@Nullable
public ColorFilter getActualImageColorFilter() {
return this.mActualImageColorFilter;
}
public GenericDraweeHierarchyBuilder setBackground(@Nullable Drawable drawable) {
this.mBackground = drawable;
return this;
}
@Nullable
public Drawable getBackground() {
return this.mBackground;
}
public GenericDraweeHierarchyBuilder setOverlays(@Nullable List<Drawable> list) {
this.mOverlays = list;
return this;
}
public GenericDraweeHierarchyBuilder setOverlay(@Nullable Drawable drawable) {
if (drawable == null) {
this.mOverlays = null;
} else {
this.mOverlays = Arrays.asList(new Drawable[]{drawable});
}
return this;
}
@Nullable
public List<Drawable> getOverlays() {
return this.mOverlays;
}
public GenericDraweeHierarchyBuilder setPressedStateOverlay(@Nullable Drawable drawable) {
if (drawable == null) {
this.mPressedStateOverlay = null;
} else {
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[]{16842919}, drawable);
this.mPressedStateOverlay = stateListDrawable;
}
return this;
}
@Nullable
public Drawable getPressedStateOverlay() {
return this.mPressedStateOverlay;
}
public GenericDraweeHierarchyBuilder setRoundingParams(@Nullable RoundingParams roundingParams) {
this.mRoundingParams = roundingParams;
return this;
}
@Nullable
public RoundingParams getRoundingParams() {
return this.mRoundingParams;
}
private void validate() {
List<Drawable> list = this.mOverlays;
if (list != null) {
for (Drawable checkNotNull : list) {
Preconditions.checkNotNull(checkNotNull);
}
}
}
public GenericDraweeHierarchy build() {
validate();
return new GenericDraweeHierarchy(this);
}
}
Download file