129 lines
4.5 KiB
Java
129 lines
4.5 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.ColorFilter;
|
||
|
import android.graphics.Paint;
|
||
|
import android.graphics.Path;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.Animatable;
|
||
|
import android.graphics.drawable.BitmapDrawable;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.SystemClock;
|
||
|
import android.widget.ImageView;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import com.squareup.picasso.Picasso;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: o.fNY, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class C12986fNY extends BitmapDrawable {
|
||
|
private static final Paint d = new Paint();
|
||
|
private boolean a;
|
||
|
private int b;
|
||
|
private final boolean c;
|
||
|
private final float e;
|
||
|
private Drawable f;
|
||
|
private long g;
|
||
|
private final Picasso.HBt j;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static void aBq_(ImageView imageView, Context context, Bitmap bitmap, Picasso.HBt hBt, boolean z, boolean z2) {
|
||
|
Drawable drawable = imageView.getDrawable();
|
||
|
if (drawable instanceof Animatable) {
|
||
|
((Animatable) drawable).stop();
|
||
|
}
|
||
|
imageView.setImageDrawable(new C12986fNY(context, bitmap, drawable, hBt, z, z2));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static void aBr_(ImageView imageView, Drawable drawable) {
|
||
|
imageView.setImageDrawable(drawable);
|
||
|
if (imageView.getDrawable() instanceof Animatable) {
|
||
|
((Animatable) imageView.getDrawable()).start();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private C12986fNY(Context context, Bitmap bitmap, Drawable drawable, Picasso.HBt hBt, boolean z, boolean z2) {
|
||
|
super(context.getResources(), bitmap);
|
||
|
this.b = 255;
|
||
|
this.c = z2;
|
||
|
this.e = context.getResources().getDisplayMetrics().density;
|
||
|
this.j = hBt;
|
||
|
if (hBt == Picasso.HBt.MEMORY || z) {
|
||
|
return;
|
||
|
}
|
||
|
this.f = drawable;
|
||
|
this.a = true;
|
||
|
this.g = SystemClock.uptimeMillis();
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.BitmapDrawable, android.graphics.drawable.Drawable
|
||
|
public final void draw(Canvas canvas) {
|
||
|
if (!this.a) {
|
||
|
super.draw(canvas);
|
||
|
} else {
|
||
|
float uptimeMillis = ((float) (SystemClock.uptimeMillis() - this.g)) / 200.0f;
|
||
|
if (uptimeMillis >= 1.0f) {
|
||
|
this.a = false;
|
||
|
this.f = null;
|
||
|
super.draw(canvas);
|
||
|
} else {
|
||
|
Drawable drawable = this.f;
|
||
|
if (drawable != null) {
|
||
|
drawable.draw(canvas);
|
||
|
}
|
||
|
super.setAlpha((int) (this.b * uptimeMillis));
|
||
|
super.draw(canvas);
|
||
|
super.setAlpha(this.b);
|
||
|
}
|
||
|
}
|
||
|
if (this.c) {
|
||
|
Paint paint = d;
|
||
|
paint.setColor(-1);
|
||
|
canvas.drawPath(aBp_((int) (this.e * 16.0f)), paint);
|
||
|
paint.setColor(this.j.debugColor);
|
||
|
canvas.drawPath(aBp_((int) (this.e * 15.0f)), paint);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.BitmapDrawable, android.graphics.drawable.Drawable
|
||
|
public final void setAlpha(int i) {
|
||
|
this.b = i;
|
||
|
Drawable drawable = this.f;
|
||
|
if (drawable != null) {
|
||
|
drawable.setAlpha(i);
|
||
|
}
|
||
|
super.setAlpha(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.BitmapDrawable, android.graphics.drawable.Drawable
|
||
|
public final void setColorFilter(ColorFilter colorFilter) {
|
||
|
Drawable drawable = this.f;
|
||
|
if (drawable != null) {
|
||
|
drawable.setColorFilter(colorFilter);
|
||
|
}
|
||
|
super.setColorFilter(colorFilter);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.BitmapDrawable, android.graphics.drawable.Drawable
|
||
|
protected final void onBoundsChange(Rect rect) {
|
||
|
Drawable drawable = this.f;
|
||
|
if (drawable != null) {
|
||
|
drawable.setBounds(rect);
|
||
|
}
|
||
|
super.onBoundsChange(rect);
|
||
|
}
|
||
|
|
||
|
private static Path aBp_(int i) {
|
||
|
Path path = new Path();
|
||
|
path.moveTo(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
|
||
|
float f = i;
|
||
|
path.lineTo(f, BitmapDescriptorFactory.HUE_RED);
|
||
|
path.lineTo(BitmapDescriptorFactory.HUE_RED, f);
|
||
|
return path;
|
||
|
}
|
||
|
}
|