what-the-bank/sources/com/scb/phone/view/custom/CustomDoubleCircleBorderVie...

475 lines
16 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.LinearInterpolator;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.scb.phone.view.custom.CustomDoubleCircleBorderView;
import java.util.ArrayList;
import java.util.List;
import o.C14957gcv;
/* loaded from: classes5.dex */
public final class CustomDoubleCircleBorderView extends View {
public float a;
public AnimatorSet b;
private float c;
public long d;
public float e;
private List<Float> f;
private int[] g;
private float h;
private long i;
private PointF j;
private boolean k;
private float l;
private Paint m;
private int n;
/* renamed from: o, reason: collision with root package name */
private RectF f8014o;
private List<Animator> p;
private int q;
private int[] r;
private RectF s;
private int t;
private Paint u;
private List<Float> v;
private float x;
private float y;
public static final /* synthetic */ void a(CustomDoubleCircleBorderView customDoubleCircleBorderView) {
int i = customDoubleCircleBorderView.t + 1;
customDoubleCircleBorderView.t = i;
if (i < customDoubleCircleBorderView.q) {
customDoubleCircleBorderView.d();
} else {
customDoubleCircleBorderView.t = 0;
}
}
/* loaded from: classes5.dex */
public static final class HBt {
private HBt() {
}
public /* synthetic */ HBt(byte b) {
this();
}
}
public final void setImageWidth(float f) {
this.h = f;
requestLayout();
invalidate();
}
public final void setBorderWidth(float f) {
this.c = f;
this.m.setStrokeWidth(f);
this.u.setStrokeWidth(f);
requestLayout();
invalidate();
}
public final void setOuterColors(int[] iArr) {
C14957gcv.e(iArr, "");
this.r = iArr;
aok_(this.u, iArr);
requestLayout();
invalidate();
}
public final void setInnerColors(int[] iArr) {
C14957gcv.e(iArr, "");
this.g = iArr;
aok_(this.m, iArr);
requestLayout();
invalidate();
}
public CustomDoubleCircleBorderView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.r = new int[0];
this.g = new int[0];
this.u = new Paint(1);
this.m = new Paint(1);
this.f8014o = new RectF();
this.s = new RectF();
this.e = -45.0f;
this.y = -45.0f;
this.a = -360.0f;
this.p = new ArrayList();
this.v = new ArrayList();
this.f = new ArrayList();
this.q = 3;
Paint paint = this.m;
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(this.c);
paint.setStrokeCap(Paint.Cap.ROUND);
aok_(paint, this.g);
Paint paint2 = this.u;
paint2.setStyle(Paint.Style.STROKE);
paint2.setStrokeWidth(this.c);
paint2.setStrokeCap(Paint.Cap.ROUND);
aok_(paint2, this.r);
e();
}
private /* synthetic */ CustomDoubleCircleBorderView(Context context, AttributeSet attributeSet, int i, byte b) {
this(context, (i & 2) != 0 ? null : attributeSet, 0);
}
public final void e() {
this.v.clear();
this.f.clear();
for (int i = 0; i < 5; i++) {
this.v.add(Float.valueOf(-60.0f));
if (i == 4) {
this.f.add(Float.valueOf(-180.0f));
} else {
this.f.add(Float.valueOf(1.0f));
}
}
}
@Override // android.view.View
protected final void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
float f = this.h + (this.c * 4.0f);
if (this.n != 0 || this.k) {
float f2 = f / 10.0f;
this.l = f2;
f += f2;
}
int i3 = (int) f;
setMeasuredDimension(i3, i3);
}
@Override // android.view.View
protected final void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
float f = this.c / 2.0f;
float f2 = i / 2.0f;
this.j = new PointF(f2, i2 / 2.0f);
float f3 = this.l;
this.x = f2 - f3;
if (this.n != 0 || this.k) {
this.s.left = f3;
this.s.top = this.l;
this.s.right = getWidth() - this.l;
this.s.bottom = getHeight() - this.l;
this.f8014o.left = this.c + this.l;
this.f8014o.top = this.c + this.l;
this.f8014o.right = (getWidth() - this.c) - this.l;
this.f8014o.bottom = (getHeight() - this.c) - this.l;
} else {
this.s.left = f;
this.s.top = f;
this.s.right = getWidth() - f;
this.s.bottom = getHeight() - f;
this.f8014o.left = this.c + f;
this.f8014o.top = this.c + f;
this.f8014o.right = (getWidth() - this.c) - f;
this.f8014o.bottom = (getHeight() - this.c) - f;
}
aok_(this.m, this.g);
aok_(this.u, this.r);
}
@Override // android.view.View
protected final void onDraw(Canvas canvas) {
C14957gcv.e(canvas, "");
super.onDraw(canvas);
if (canvas != null) {
canvas.drawArc(this.f8014o, BitmapDescriptorFactory.HUE_RED, 360.0f, false, this.m);
}
if (this.n == 0 || this.k) {
if (canvas != null) {
canvas.drawArc(this.s, this.y, this.a, false, this.u);
return;
}
return;
}
if (canvas != null) {
canvas.drawArc(this.s, this.y, this.a, false, this.u);
}
int size = this.v.size();
for (int i = 0; i < size; i++) {
if (canvas != null) {
canvas.drawArc(this.s, this.v.get(i).floatValue(), this.f.get(i).floatValue(), false, this.u);
}
}
PointF pointF = this.j;
if (pointF == null) {
C14957gcv.a("");
pointF = null;
}
double d = this.x;
double d2 = this.e;
PointF pointF2 = new PointF((float) (pointF.x + (Math.cos(Math.toRadians(d2)) * d)), (float) (pointF.y + (d * Math.sin(Math.toRadians(d2)))));
int i2 = (int) (this.l * 2.0f);
Bitmap decodeResource = BitmapFactory.decodeResource(getResources(), this.n);
C14957gcv.c(decodeResource, "");
Bitmap createBitmap = Bitmap.createBitmap(i2, i2, Bitmap.Config.ARGB_8888);
C14957gcv.c(createBitmap, "");
Canvas canvas2 = new Canvas(createBitmap);
float f = i2;
Matrix matrix = new Matrix();
matrix.postScale(f / decodeResource.getWidth(), f / decodeResource.getHeight());
canvas2.drawBitmap(decodeResource, matrix, null);
float f2 = pointF2.x;
float f3 = this.l;
float f4 = pointF2.y;
float f5 = this.l;
if (canvas != null) {
canvas.drawBitmap(createBitmap, f2 - f3, f4 - f5, (Paint) null);
}
}
@Override // android.view.View
protected final void onDetachedFromWindow() {
super.onDetachedFromWindow();
AnimatorSet animatorSet = this.b;
if (animatorSet != null) {
animatorSet.cancel();
}
}
public final void d() {
AnimatorSet animatorSet = this.b;
if (animatorSet != null) {
animatorSet.cancel();
}
this.p.clear();
AnimatorSet animatorSet2 = new AnimatorSet();
this.p.add(aoh_());
this.p.add(aoi_());
this.p.addAll(b());
animatorSet2.playTogether(this.p);
animatorSet2.setInterpolator(new LinearInterpolator());
this.b = animatorSet2;
animatorSet2.addListener(new IeS(this));
AnimatorSet animatorSet3 = this.b;
if (animatorSet3 != null) {
animatorSet3.start();
}
}
/* loaded from: classes5.dex */
public static final class IeS implements Animator.AnimatorListener {
private boolean b;
private CustomDoubleCircleBorderView e;
IeS(CustomDoubleCircleBorderView customDoubleCircleBorderView) {
this.e = customDoubleCircleBorderView;
}
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
C14957gcv.e(animator, "");
if (this.b) {
return;
}
CustomDoubleCircleBorderView.a(this.e);
}
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
C14957gcv.e(animator, "");
this.b = false;
}
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationRepeat(Animator animator) {
C14957gcv.e(animator, "");
}
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationCancel(Animator animator) {
C14957gcv.e(animator, "");
this.b = true;
}
}
private final void aok_(Paint paint, int[] iArr) {
int length = iArr.length;
if (length == 1) {
paint.setColor(iArr[0]);
paint.setShader(null);
} else {
if (2 > length || length > Integer.MAX_VALUE) {
return;
}
paint.setShader(aoj_(iArr));
}
}
private final Shader aoj_(int[] iArr) {
return new LinearGradient(this.l, getWidth() - this.l, getWidth() - this.l, getWidth() / 2.0f, iArr, (float[]) null, Shader.TileMode.CLAMP);
}
private final Animator aoh_() {
ValueAnimator ofFloat = ValueAnimator.ofFloat(BitmapDescriptorFactory.HUE_RED, 360.0f);
ofFloat.setDuration(this.i);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: o.eAm
private CustomDoubleCircleBorderView a;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
CustomDoubleCircleBorderView.aoe_(this.a, valueAnimator);
}
{
this.a = this;
}
});
C14957gcv.c(ofFloat, "");
return ofFloat;
}
private final Animator aoi_() {
ValueAnimator ofFloat = ValueAnimator.ofFloat(BitmapDescriptorFactory.HUE_RED, 360.0f);
ofFloat.setDuration(this.i);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: o.eAp
private CustomDoubleCircleBorderView e;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
CustomDoubleCircleBorderView.aog_(this.e, valueAnimator);
}
{
this.e = this;
}
});
C14957gcv.c(ofFloat, "");
return ofFloat;
}
private final List<Animator> b() {
float f;
float f2;
long j = this.i;
ArrayList arrayList = new ArrayList();
List<Float> list = this.v;
C14957gcv.e(list, "");
int size = list.size();
int size2 = this.v.size();
for (final int i = 0; i < size2; i++) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(BitmapDescriptorFactory.HUE_RED, 360.0f);
ofFloat.setDuration(j);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this, i) { // from class: o.eAq
private int d;
private CustomDoubleCircleBorderView e;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
CustomDoubleCircleBorderView.aof_(this.e, this.d, valueAnimator);
}
{
this.e = this;
this.d = i;
}
});
long j2 = this.d;
if (i < size - 2) {
f = (float) j;
f2 = 0.1f;
} else {
f = (float) j;
f2 = 0.09f;
}
long j3 = j2 + (f * f2);
this.d = j3;
ofFloat.setStartDelay(j3);
C14957gcv.c(ofFloat, "");
arrayList.add(ofFloat);
}
return arrayList;
}
public static /* synthetic */ void aoe_(CustomDoubleCircleBorderView customDoubleCircleBorderView, ValueAnimator valueAnimator) {
C14957gcv.e(customDoubleCircleBorderView, "");
C14957gcv.e(valueAnimator, "");
Object animatedValue = valueAnimator.getAnimatedValue();
C14957gcv.d(animatedValue, "");
customDoubleCircleBorderView.a = ((Float) animatedValue).floatValue() - 360.0f;
customDoubleCircleBorderView.invalidate();
}
public static /* synthetic */ void aof_(CustomDoubleCircleBorderView customDoubleCircleBorderView, int i, ValueAnimator valueAnimator) {
C14957gcv.e(customDoubleCircleBorderView, "");
C14957gcv.e(valueAnimator, "");
Object animatedValue = valueAnimator.getAnimatedValue();
C14957gcv.d(animatedValue, "");
float floatValue = ((Float) animatedValue).floatValue() - 60.0f;
customDoubleCircleBorderView.v.set(i, Float.valueOf(floatValue));
List<Float> list = customDoubleCircleBorderView.f;
C14957gcv.e(list, "");
int size = list.size();
if (i == size - 1) {
if (floatValue == 300.0f) {
customDoubleCircleBorderView.d = 0L;
customDoubleCircleBorderView.e = -45.0f;
customDoubleCircleBorderView.a = -360.0f;
customDoubleCircleBorderView.e();
} else {
customDoubleCircleBorderView.f.set(i, Float.valueOf((-180.0f) - (floatValue * 0.5f)));
}
} else if (i == size - 2) {
customDoubleCircleBorderView.f.set(i, Float.valueOf(-(floatValue / customDoubleCircleBorderView.c)));
} else {
customDoubleCircleBorderView.f.set(i, Float.valueOf(floatValue / customDoubleCircleBorderView.c));
}
customDoubleCircleBorderView.invalidate();
}
public static /* synthetic */ void aog_(CustomDoubleCircleBorderView customDoubleCircleBorderView, ValueAnimator valueAnimator) {
C14957gcv.e(customDoubleCircleBorderView, "");
C14957gcv.e(valueAnimator, "");
Object animatedValue = valueAnimator.getAnimatedValue();
C14957gcv.d(animatedValue, "");
customDoubleCircleBorderView.e = ((Float) animatedValue).floatValue() - 45.0f;
customDoubleCircleBorderView.invalidate();
}
public final void setInsightIconDrawableResId(int i) {
this.n = i;
}
public final void setDuration(long j) {
this.i = j;
}
public final void setDefaultBorder(boolean z) {
this.k = z;
}
public CustomDoubleCircleBorderView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 4, (byte) 0);
}
public CustomDoubleCircleBorderView(Context context) {
this(context, null, 6, (byte) 0);
}
static {
new HBt((byte) 0);
}
}