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

482 lines
22 KiB
Java

package com.scb.phone.view.custom;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.scb.phone.R;
import o.AQw;
import o.C12891fKc;
import o.C14866gag;
import o.C14957gcv;
import o.nMh;
/* loaded from: classes5.dex */
public final class CustomProfileImageView extends FrameLayout {
private float a;
private int b;
private long c;
public int d;
private float e;
private int[] f;
private int[] g;
private int[] i;
@BindView
public ImageView ivAvatar;
private int[] j;
@BindView
public CustomDoubleCircleBorderView vBorder;
/* loaded from: classes5.dex */
public static final class HBt {
private HBt() {
}
public /* synthetic */ HBt(byte b) {
this();
}
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public CustomProfileImageView(Context context) {
this(context, null);
C14957gcv.e(context, "");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public CustomProfileImageView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
C14957gcv.e(context, "");
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomProfileImageView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
C14866gag c14866gag;
C14957gcv.e(context, "");
this.j = new int[0];
this.i = new int[0];
this.f = new int[0];
this.g = new int[0];
Context context2 = getContext();
C14957gcv.c(context2, "");
C14957gcv.e(context2, "");
TypedValue typedValue = new TypedValue();
context2.getTheme().resolveAttribute(R.attr.profilePlaceholder, typedValue, true);
this.b = typedValue.resourceId;
Object systemService = context.getSystemService("layout_inflater");
C14957gcv.d(systemService, "");
((LayoutInflater) systemService).inflate(R.layout.2131559300, (ViewGroup) this, true);
ButterKnife.c(this);
ImageView imageView = null;
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AQw.Sts.CustomProfileImageView, 0, 0);
try {
try {
C14957gcv.e(context, "");
TypedValue typedValue2 = new TypedValue();
context.getTheme().resolveAttribute(R.attr.profilePlaceholder, typedValue2, true);
this.b = obtainStyledAttributes.getResourceId(7, typedValue2.resourceId);
int resourceId = obtainStyledAttributes.getResourceId(5, 0);
if (resourceId > 0) {
String resourceTypeName = obtainStyledAttributes.getResources().getResourceTypeName(resourceId);
if (C14957gcv.b((Object) resourceTypeName, (Object) "array")) {
int[] intArray = obtainStyledAttributes.getResources().getIntArray(resourceId);
C14957gcv.c(intArray, "");
this.j = intArray;
} else if (C14957gcv.b((Object) resourceTypeName, (Object) "color")) {
this.j = new int[]{obtainStyledAttributes.getColor(5, nMh.getColor(getContext(), R.color.f14042131100912))};
}
}
int resourceId2 = obtainStyledAttributes.getResourceId(6, 0);
if (resourceId2 > 0) {
String resourceTypeName2 = obtainStyledAttributes.getResources().getResourceTypeName(resourceId2);
if (C14957gcv.b((Object) resourceTypeName2, (Object) "array")) {
int[] intArray2 = obtainStyledAttributes.getResources().getIntArray(resourceId2);
C14957gcv.c(intArray2, "");
this.i = intArray2;
} else if (C14957gcv.b((Object) resourceTypeName2, (Object) "color")) {
this.i = new int[]{obtainStyledAttributes.getColor(6, nMh.getColor(getContext(), R.color.f14042131100912))};
}
}
int resourceId3 = obtainStyledAttributes.getResourceId(4, 0);
if (resourceId3 > 0) {
String resourceTypeName3 = obtainStyledAttributes.getResources().getResourceTypeName(resourceId3);
if (!C14957gcv.b((Object) resourceTypeName3, (Object) "array")) {
if (C14957gcv.b((Object) resourceTypeName3, (Object) "color")) {
this.f = new int[]{obtainStyledAttributes.getColor(4, nMh.getColor(getContext(), R.color.f14042131100912))};
CustomDoubleCircleBorderView customDoubleCircleBorderView = this.vBorder;
if (customDoubleCircleBorderView == null) {
C14957gcv.a("");
customDoubleCircleBorderView = null;
}
customDoubleCircleBorderView.setInnerColors(this.f);
}
} else {
int[] intArray3 = obtainStyledAttributes.getResources().getIntArray(resourceId3);
C14957gcv.c(intArray3, "");
this.f = intArray3;
CustomDoubleCircleBorderView customDoubleCircleBorderView2 = this.vBorder;
if (customDoubleCircleBorderView2 == null) {
C14957gcv.a("");
customDoubleCircleBorderView2 = null;
}
customDoubleCircleBorderView2.setInnerColors(this.f);
}
}
float dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(3, 0);
this.a = dimensionPixelSize;
CustomDoubleCircleBorderView customDoubleCircleBorderView3 = this.vBorder;
if (customDoubleCircleBorderView3 == null) {
C14957gcv.a("");
customDoubleCircleBorderView3 = null;
}
customDoubleCircleBorderView3.setImageWidth(dimensionPixelSize);
float dimensionPixelSize2 = obtainStyledAttributes.getDimensionPixelSize(2, 0);
this.e = dimensionPixelSize2;
CustomDoubleCircleBorderView customDoubleCircleBorderView4 = this.vBorder;
if (customDoubleCircleBorderView4 == null) {
C14957gcv.a("");
customDoubleCircleBorderView4 = null;
}
customDoubleCircleBorderView4.setBorderWidth(dimensionPixelSize2);
long j = obtainStyledAttributes.getInt(0, 0);
this.c = j;
CustomDoubleCircleBorderView customDoubleCircleBorderView5 = this.vBorder;
if (customDoubleCircleBorderView5 == null) {
C14957gcv.a("");
customDoubleCircleBorderView5 = null;
}
customDoubleCircleBorderView5.setDuration(j);
setBorderState(obtainStyledAttributes.getInt(1, 0));
} catch (Exception unused) {
b();
}
obtainStyledAttributes.recycle();
c14866gag = C14866gag.c;
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
} else {
c14866gag = null;
}
if (c14866gag == null) {
b();
}
if (this.a > BitmapDescriptorFactory.HUE_RED) {
ImageView imageView2 = this.ivAvatar;
if (imageView2 == null) {
C14957gcv.a("");
imageView2 = null;
}
ViewGroup.LayoutParams layoutParams = imageView2.getLayoutParams();
layoutParams.width = (int) this.a;
layoutParams.height = (int) this.a;
ImageView imageView3 = this.ivAvatar;
if (imageView3 == null) {
C14957gcv.a("");
imageView3 = null;
}
imageView3.setLayoutParams(layoutParams);
}
ImageView imageView4 = this.ivAvatar;
if (imageView4 != null) {
imageView = imageView4;
} else {
C14957gcv.a("");
}
imageView.setImageResource(this.b);
}
public final void setBorderState(int i) {
this.d = i;
CustomDoubleCircleBorderView customDoubleCircleBorderView = null;
if (i == 0) {
CustomDoubleCircleBorderView customDoubleCircleBorderView2 = this.vBorder;
if (customDoubleCircleBorderView2 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView2;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.setVisibility(4);
return;
}
if (i == 1) {
CustomDoubleCircleBorderView customDoubleCircleBorderView3 = this.vBorder;
if (customDoubleCircleBorderView3 == null) {
C14957gcv.a("");
customDoubleCircleBorderView3 = null;
}
customDoubleCircleBorderView3.setVisibility(0);
CustomDoubleCircleBorderView customDoubleCircleBorderView4 = this.vBorder;
if (customDoubleCircleBorderView4 == null) {
C14957gcv.a("");
customDoubleCircleBorderView4 = null;
}
customDoubleCircleBorderView4.setOuterColors(this.i);
CustomDoubleCircleBorderView customDoubleCircleBorderView5 = this.vBorder;
if (customDoubleCircleBorderView5 == null) {
C14957gcv.a("");
customDoubleCircleBorderView5 = null;
}
customDoubleCircleBorderView5.setInsightIconDrawableResId(R.drawable.ic_insight_inactive);
CustomDoubleCircleBorderView customDoubleCircleBorderView6 = this.vBorder;
if (customDoubleCircleBorderView6 == null) {
C14957gcv.a("");
customDoubleCircleBorderView6 = null;
}
customDoubleCircleBorderView6.setRotation(90.0f);
CustomDoubleCircleBorderView customDoubleCircleBorderView7 = this.vBorder;
if (customDoubleCircleBorderView7 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView7;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.setDefaultBorder(false);
return;
}
if (i == 2) {
CustomDoubleCircleBorderView customDoubleCircleBorderView8 = this.vBorder;
if (customDoubleCircleBorderView8 == null) {
C14957gcv.a("");
customDoubleCircleBorderView8 = null;
}
customDoubleCircleBorderView8.setVisibility(0);
CustomDoubleCircleBorderView customDoubleCircleBorderView9 = this.vBorder;
if (customDoubleCircleBorderView9 == null) {
C14957gcv.a("");
customDoubleCircleBorderView9 = null;
}
customDoubleCircleBorderView9.setOuterColors(this.j);
CustomDoubleCircleBorderView customDoubleCircleBorderView10 = this.vBorder;
if (customDoubleCircleBorderView10 == null) {
C14957gcv.a("");
customDoubleCircleBorderView10 = null;
}
customDoubleCircleBorderView10.setInsightIconDrawableResId(R.drawable.ic_insight_active);
CustomDoubleCircleBorderView customDoubleCircleBorderView11 = this.vBorder;
if (customDoubleCircleBorderView11 == null) {
C14957gcv.a("");
customDoubleCircleBorderView11 = null;
}
customDoubleCircleBorderView11.setRotation(BitmapDescriptorFactory.HUE_RED);
CustomDoubleCircleBorderView customDoubleCircleBorderView12 = this.vBorder;
if (customDoubleCircleBorderView12 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView12;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.setDefaultBorder(false);
return;
}
if (i == 3) {
CustomDoubleCircleBorderView customDoubleCircleBorderView13 = this.vBorder;
if (customDoubleCircleBorderView13 == null) {
C14957gcv.a("");
customDoubleCircleBorderView13 = null;
}
customDoubleCircleBorderView13.setVisibility(0);
CustomDoubleCircleBorderView customDoubleCircleBorderView14 = this.vBorder;
if (customDoubleCircleBorderView14 == null) {
C14957gcv.a("");
customDoubleCircleBorderView14 = null;
}
customDoubleCircleBorderView14.setOuterColors(this.j);
CustomDoubleCircleBorderView customDoubleCircleBorderView15 = this.vBorder;
if (customDoubleCircleBorderView15 == null) {
C14957gcv.a("");
customDoubleCircleBorderView15 = null;
}
customDoubleCircleBorderView15.setInsightIconDrawableResId(R.drawable.ic_insight_active);
CustomDoubleCircleBorderView customDoubleCircleBorderView16 = this.vBorder;
if (customDoubleCircleBorderView16 == null) {
C14957gcv.a("");
customDoubleCircleBorderView16 = null;
}
customDoubleCircleBorderView16.setRotation(BitmapDescriptorFactory.HUE_RED);
CustomDoubleCircleBorderView customDoubleCircleBorderView17 = this.vBorder;
if (customDoubleCircleBorderView17 == null) {
C14957gcv.a("");
customDoubleCircleBorderView17 = null;
}
customDoubleCircleBorderView17.setDefaultBorder(false);
CustomDoubleCircleBorderView customDoubleCircleBorderView18 = this.vBorder;
if (customDoubleCircleBorderView18 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView18;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.d();
return;
}
if (i != 4) {
if (i == 5) {
CustomDoubleCircleBorderView customDoubleCircleBorderView19 = this.vBorder;
if (customDoubleCircleBorderView19 == null) {
C14957gcv.a("");
customDoubleCircleBorderView19 = null;
}
customDoubleCircleBorderView19.setVisibility(0);
CustomDoubleCircleBorderView customDoubleCircleBorderView20 = this.vBorder;
if (customDoubleCircleBorderView20 == null) {
C14957gcv.a("");
customDoubleCircleBorderView20 = null;
}
customDoubleCircleBorderView20.setOuterColors(new int[]{nMh.getColor(getContext(), R.color.f14042131100912)});
CustomDoubleCircleBorderView customDoubleCircleBorderView21 = this.vBorder;
if (customDoubleCircleBorderView21 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView21;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.setDefaultBorder(true);
return;
}
return;
}
CustomDoubleCircleBorderView customDoubleCircleBorderView22 = this.vBorder;
if (customDoubleCircleBorderView22 == null) {
C14957gcv.a("");
customDoubleCircleBorderView22 = null;
}
customDoubleCircleBorderView22.setVisibility(0);
CustomDoubleCircleBorderView customDoubleCircleBorderView23 = this.vBorder;
if (customDoubleCircleBorderView23 == null) {
C14957gcv.a("");
customDoubleCircleBorderView23 = null;
}
customDoubleCircleBorderView23.setOuterColors(this.i);
CustomDoubleCircleBorderView customDoubleCircleBorderView24 = this.vBorder;
if (customDoubleCircleBorderView24 == null) {
C14957gcv.a("");
customDoubleCircleBorderView24 = null;
}
customDoubleCircleBorderView24.setInsightIconDrawableResId(R.drawable.ic_insight_inactive);
CustomDoubleCircleBorderView customDoubleCircleBorderView25 = this.vBorder;
if (customDoubleCircleBorderView25 == null) {
C14957gcv.a("");
customDoubleCircleBorderView25 = null;
}
customDoubleCircleBorderView25.setRotation(90.0f);
CustomDoubleCircleBorderView customDoubleCircleBorderView26 = this.vBorder;
if (customDoubleCircleBorderView26 == null) {
C14957gcv.a("");
customDoubleCircleBorderView26 = null;
}
customDoubleCircleBorderView26.setDefaultBorder(false);
CustomDoubleCircleBorderView customDoubleCircleBorderView27 = this.vBorder;
if (customDoubleCircleBorderView27 != null) {
customDoubleCircleBorderView = customDoubleCircleBorderView27;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView.d();
}
public final void setImageUrl(String str) {
Context context = getContext();
C14957gcv.c(context, "");
C14957gcv.e(context, "");
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.profilePlaceholder, typedValue, true);
int i = typedValue.resourceId;
ImageView imageView = this.ivAvatar;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
C12891fKc.aze_(i, imageView, str);
}
public final void setImageResource(Integer num) {
if (num != null) {
ImageView imageView = this.ivAvatar;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
imageView.setImageResource(num.intValue());
}
}
public final void c() {
Animator loadAnimator = AnimatorInflater.loadAnimator(getContext(), R.animator.2130837508);
CustomDoubleCircleBorderView customDoubleCircleBorderView = this.vBorder;
if (customDoubleCircleBorderView == null) {
C14957gcv.a("");
customDoubleCircleBorderView = null;
}
loadAnimator.setTarget(customDoubleCircleBorderView);
loadAnimator.start();
}
private final void b() {
this.b = 0;
int[] iArr = {nMh.getColor(getContext(), R.color.f14042131100912)};
this.g = iArr;
CustomDoubleCircleBorderView customDoubleCircleBorderView = this.vBorder;
CustomDoubleCircleBorderView customDoubleCircleBorderView2 = null;
if (customDoubleCircleBorderView == null) {
C14957gcv.a("");
customDoubleCircleBorderView = null;
}
customDoubleCircleBorderView.setOuterColors(iArr);
this.f = new int[]{nMh.getColor(getContext(), R.color.f14042131100912)};
CustomDoubleCircleBorderView customDoubleCircleBorderView3 = this.vBorder;
if (customDoubleCircleBorderView3 == null) {
C14957gcv.a("");
customDoubleCircleBorderView3 = null;
}
customDoubleCircleBorderView3.setInnerColors(this.f);
this.a = BitmapDescriptorFactory.HUE_RED;
CustomDoubleCircleBorderView customDoubleCircleBorderView4 = this.vBorder;
if (customDoubleCircleBorderView4 == null) {
C14957gcv.a("");
customDoubleCircleBorderView4 = null;
}
customDoubleCircleBorderView4.setImageWidth(BitmapDescriptorFactory.HUE_RED);
this.e = BitmapDescriptorFactory.HUE_RED;
CustomDoubleCircleBorderView customDoubleCircleBorderView5 = this.vBorder;
if (customDoubleCircleBorderView5 == null) {
C14957gcv.a("");
customDoubleCircleBorderView5 = null;
}
customDoubleCircleBorderView5.setBorderWidth(BitmapDescriptorFactory.HUE_RED);
this.c = 0L;
CustomDoubleCircleBorderView customDoubleCircleBorderView6 = this.vBorder;
if (customDoubleCircleBorderView6 != null) {
customDoubleCircleBorderView2 = customDoubleCircleBorderView6;
} else {
C14957gcv.a("");
}
customDoubleCircleBorderView2.setDuration(0L);
setBorderState(0);
}
public final void setVBorder(CustomDoubleCircleBorderView customDoubleCircleBorderView) {
C14957gcv.e(customDoubleCircleBorderView, "");
this.vBorder = customDoubleCircleBorderView;
}
public final void setIvAvatar(ImageView imageView) {
C14957gcv.e(imageView, "");
this.ivAvatar = imageView;
}
static {
new HBt((byte) 0);
}
}