what-the-bank/sources/o/VBp.java

510 lines
18 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.core.view.ViewCompat;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import o.SYO;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class VBp {
private final Context h;
private TextPaint l;
private final Sts m;
/* renamed from: o, reason: collision with root package name */
private final TextView f8403o;
private static final RectF d = new RectF();
private static ConcurrentHashMap<String, Method> e = new ConcurrentHashMap<>();
private static ConcurrentHashMap<String, Field> b = new ConcurrentHashMap<>();
private int j = 0;
private boolean k = false;
private float f = -1.0f;
private float a = -1.0f;
private float c = -1.0f;
private int[] i = new int[0];
private boolean g = false;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class Sts {
void hJ_(StaticLayout.Builder builder, TextView textView) {
}
Sts() {
}
boolean hK_(TextView textView) {
return ((Boolean) VBp.d(textView, "getHorizontallyScrolling", Boolean.FALSE)).booleanValue();
}
}
/* loaded from: classes.dex */
static class HBt extends Sts {
HBt() {
}
@Override // o.VBp.Sts
void hJ_(StaticLayout.Builder builder, TextView textView) {
builder.setTextDirection((TextDirectionHeuristic) VBp.d(textView, "getTextDirectionHeuristic", TextDirectionHeuristics.FIRSTSTRONG_LTR));
}
}
/* loaded from: classes.dex */
static class saX extends HBt {
saX() {
}
@Override // o.VBp.Sts
boolean hK_(TextView textView) {
return textView.isHorizontallyScrollable();
}
@Override // o.VBp.HBt, o.VBp.Sts
void hJ_(StaticLayout.Builder builder, TextView textView) {
builder.setTextDirection(textView.getTextDirectionHeuristic());
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public VBp(TextView textView) {
this.f8403o = textView;
this.h = textView.getContext();
if (Build.VERSION.SDK_INT >= 29) {
this.m = new saX();
} else {
this.m = new HBt();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void hD_(AttributeSet attributeSet, int i) {
int resourceId;
TypedArray obtainStyledAttributes = this.h.obtainStyledAttributes(attributeSet, SYO.ZqN.AppCompatTextView, i, 0);
TextView textView = this.f8403o;
ViewCompat.sm_(textView, textView.getContext(), SYO.ZqN.AppCompatTextView, attributeSet, obtainStyledAttributes, i, 0);
if (obtainStyledAttributes.hasValue(SYO.ZqN.AppCompatTextView_autoSizeTextType)) {
this.j = obtainStyledAttributes.getInt(SYO.ZqN.AppCompatTextView_autoSizeTextType, 0);
}
float dimension = obtainStyledAttributes.hasValue(SYO.ZqN.AppCompatTextView_autoSizeStepGranularity) ? obtainStyledAttributes.getDimension(SYO.ZqN.AppCompatTextView_autoSizeStepGranularity, -1.0f) : -1.0f;
float dimension2 = obtainStyledAttributes.hasValue(SYO.ZqN.AppCompatTextView_autoSizeMinTextSize) ? obtainStyledAttributes.getDimension(SYO.ZqN.AppCompatTextView_autoSizeMinTextSize, -1.0f) : -1.0f;
float dimension3 = obtainStyledAttributes.hasValue(SYO.ZqN.AppCompatTextView_autoSizeMaxTextSize) ? obtainStyledAttributes.getDimension(SYO.ZqN.AppCompatTextView_autoSizeMaxTextSize, -1.0f) : -1.0f;
if (obtainStyledAttributes.hasValue(SYO.ZqN.AppCompatTextView_autoSizePresetSizes) && (resourceId = obtainStyledAttributes.getResourceId(SYO.ZqN.AppCompatTextView_autoSizePresetSizes, 0)) > 0) {
TypedArray obtainTypedArray = obtainStyledAttributes.getResources().obtainTypedArray(resourceId);
hA_(obtainTypedArray);
obtainTypedArray.recycle();
}
obtainStyledAttributes.recycle();
if (!l()) {
this.j = 0;
return;
}
if (this.j == 1) {
if (!this.g) {
DisplayMetrics displayMetrics = this.h.getResources().getDisplayMetrics();
if (dimension2 == -1.0f) {
dimension2 = TypedValue.applyDimension(2, 12.0f, displayMetrics);
}
if (dimension3 == -1.0f) {
dimension3 = TypedValue.applyDimension(2, 112.0f, displayMetrics);
}
if (dimension == -1.0f) {
dimension = 1.0f;
}
b(dimension2, dimension3, dimension);
}
g();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void a(int i) {
if (l()) {
if (i == 0) {
j();
return;
}
if (i == 1) {
DisplayMetrics displayMetrics = this.h.getResources().getDisplayMetrics();
b(TypedValue.applyDimension(2, 12.0f, displayMetrics), TypedValue.applyDimension(2, 112.0f, displayMetrics), 1.0f);
if (g()) {
c();
return;
}
return;
}
throw new IllegalArgumentException("Unknown auto-size text type: ".concat(String.valueOf(i)));
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void d(int i, int i2, int i3, int i4) throws IllegalArgumentException {
if (l()) {
DisplayMetrics displayMetrics = this.h.getResources().getDisplayMetrics();
b(TypedValue.applyDimension(i4, i, displayMetrics), TypedValue.applyDimension(i4, i2, displayMetrics), TypedValue.applyDimension(i4, i3, displayMetrics));
if (g()) {
c();
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void e(int[] iArr, int i) throws IllegalArgumentException {
if (l()) {
int length = iArr.length;
if (length > 0) {
int[] iArr2 = new int[length];
if (i == 0) {
iArr2 = Arrays.copyOf(iArr, length);
} else {
DisplayMetrics displayMetrics = this.h.getResources().getDisplayMetrics();
for (int i2 = 0; i2 < length; i2++) {
iArr2[i2] = Math.round(TypedValue.applyDimension(i, iArr[i2], displayMetrics));
}
}
this.i = b(iArr2);
if (!h()) {
StringBuilder sb = new StringBuilder("None of the preset sizes is valid: ");
sb.append(Arrays.toString(iArr));
throw new IllegalArgumentException(sb.toString());
}
} else {
this.g = false;
}
if (g()) {
c();
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public int b() {
return Math.round(this.f);
}
/* JADX INFO: Access modifiers changed from: package-private */
public int e() {
return Math.round(this.a);
}
/* JADX INFO: Access modifiers changed from: package-private */
public int d() {
return Math.round(this.c);
}
private void hA_(TypedArray typedArray) {
int length = typedArray.length();
int[] iArr = new int[length];
if (length > 0) {
for (int i = 0; i < length; i++) {
iArr[i] = typedArray.getDimensionPixelSize(i, -1);
}
this.i = b(iArr);
h();
}
}
private boolean h() {
boolean z = this.i.length > 0;
this.g = z;
if (z) {
this.j = 1;
this.a = r0[0];
this.c = r0[r1 - 1];
this.f = -1.0f;
}
return z;
}
private int[] b(int[] iArr) {
int length = iArr.length;
if (length == 0) {
return iArr;
}
Arrays.sort(iArr);
ArrayList arrayList = new ArrayList();
for (int i : iArr) {
if (i > 0 && Collections.binarySearch(arrayList, Integer.valueOf(i)) < 0) {
arrayList.add(Integer.valueOf(i));
}
}
if (length == arrayList.size()) {
return iArr;
}
int size = arrayList.size();
int[] iArr2 = new int[size];
for (int i2 = 0; i2 < size; i2++) {
iArr2[i2] = ((Integer) arrayList.get(i2)).intValue();
}
return iArr2;
}
private void b(float f, float f2, float f3) throws IllegalArgumentException {
if (f <= BitmapDescriptorFactory.HUE_RED) {
StringBuilder sb = new StringBuilder("Minimum auto-size text size (");
sb.append(f);
sb.append("px) is less or equal to (0px)");
throw new IllegalArgumentException(sb.toString());
}
if (f2 <= f) {
StringBuilder sb2 = new StringBuilder("Maximum auto-size text size (");
sb2.append(f2);
sb2.append("px) is less or equal to minimum auto-size text size (");
sb2.append(f);
sb2.append("px)");
throw new IllegalArgumentException(sb2.toString());
}
if (f3 <= BitmapDescriptorFactory.HUE_RED) {
StringBuilder sb3 = new StringBuilder("The auto-size step granularity (");
sb3.append(f3);
sb3.append("px) is less or equal to (0px)");
throw new IllegalArgumentException(sb3.toString());
}
this.j = 1;
this.a = f;
this.c = f2;
this.f = f3;
this.g = false;
}
private boolean g() {
if (l() && this.j == 1) {
if (!this.g || this.i.length == 0) {
int floor = ((int) Math.floor((this.c - this.a) / this.f)) + 1;
int[] iArr = new int[floor];
for (int i = 0; i < floor; i++) {
iArr[i] = Math.round(this.a + (i * this.f));
}
this.i = b(iArr);
}
this.k = true;
} else {
this.k = false;
}
return this.k;
}
/* JADX INFO: Access modifiers changed from: package-private */
public void c() {
int measuredWidth;
if (i()) {
if (this.k) {
if (this.f8403o.getMeasuredHeight() <= 0 || this.f8403o.getMeasuredWidth() <= 0) {
return;
}
if (this.m.hK_(this.f8403o)) {
measuredWidth = PKIFailureInfo.badCertTemplate;
} else {
measuredWidth = (this.f8403o.getMeasuredWidth() - this.f8403o.getTotalPaddingLeft()) - this.f8403o.getTotalPaddingRight();
}
int height = (this.f8403o.getHeight() - this.f8403o.getCompoundPaddingBottom()) - this.f8403o.getCompoundPaddingTop();
if (measuredWidth <= 0 || height <= 0) {
return;
}
RectF rectF = d;
synchronized (rectF) {
rectF.setEmpty();
rectF.right = measuredWidth;
rectF.bottom = height;
float hz_ = hz_(rectF);
if (hz_ != this.f8403o.getTextSize()) {
c(0, hz_);
}
}
}
this.k = true;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public void c(int i, float f) {
Resources resources;
Context context = this.h;
if (context == null) {
resources = Resources.getSystem();
} else {
resources = context.getResources();
}
c(TypedValue.applyDimension(i, f, resources.getDisplayMetrics()));
}
private void c(float f) {
if (f != this.f8403o.getPaint().getTextSize()) {
this.f8403o.getPaint().setTextSize(f);
boolean c = IeS.c(this.f8403o);
if (this.f8403o.getLayout() != null) {
this.k = false;
try {
Method c2 = c("nullLayouts");
if (c2 != null) {
c2.invoke(this.f8403o, new Object[0]);
}
} catch (Exception unused) {
}
if (!c) {
this.f8403o.requestLayout();
} else {
this.f8403o.forceLayout();
}
this.f8403o.invalidate();
}
}
}
private int hz_(RectF rectF) {
int length = this.i.length;
if (length == 0) {
throw new IllegalStateException("No available text sizes to choose from.");
}
int i = 1;
int i2 = length - 1;
int i3 = 0;
while (i <= i2) {
int i4 = (i + i2) / 2;
if (hB_(this.i[i4], rectF)) {
int i5 = i4 + 1;
i3 = i;
i = i5;
} else {
i3 = i4 - 1;
i2 = i3;
}
}
return this.i[i3];
}
void c(int i) {
TextPaint textPaint = this.l;
if (textPaint == null) {
this.l = new TextPaint();
} else {
textPaint.reset();
}
this.l.set(this.f8403o.getPaint());
this.l.setTextSize(i);
}
StaticLayout hC_(CharSequence charSequence, Layout.Alignment alignment, int i, int i2) {
return LWm.hF_(charSequence, alignment, i, i2, this.f8403o, this.l, this.m);
}
private boolean hB_(int i, RectF rectF) {
CharSequence transformation;
CharSequence text = this.f8403o.getText();
TransformationMethod transformationMethod = this.f8403o.getTransformationMethod();
if (transformationMethod != null && (transformation = transformationMethod.getTransformation(text, this.f8403o)) != null) {
text = transformation;
}
int hE_ = RVV.hE_(this.f8403o);
c(i);
StaticLayout hC_ = hC_(text, (Layout.Alignment) d(this.f8403o, "getLayoutAlignment", Layout.Alignment.ALIGN_NORMAL), Math.round(rectF.right), hE_);
return (hE_ == -1 || (hC_.getLineCount() <= hE_ && hC_.getLineEnd(hC_.getLineCount() - 1) == text.length())) && ((float) hC_.getHeight()) <= rectF.bottom;
}
static <T> T d(Object obj, String str, T t) {
try {
return (T) c(str).invoke(obj, new Object[0]);
} catch (Exception unused) {
return t;
}
}
private static Method c(String str) {
try {
Method method = e.get(str);
if (method == null && (method = TextView.class.getDeclaredMethod(str, new Class[0])) != null) {
method.setAccessible(true);
e.put(str, method);
}
return method;
} catch (Exception unused) {
return null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public boolean i() {
return l() && this.j != 0;
}
private boolean l() {
return !(this.f8403o instanceof AppCompatEditText);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class LWm {
static StaticLayout hF_(CharSequence charSequence, Layout.Alignment alignment, int i, int i2, TextView textView, TextPaint textPaint, Sts sts) {
StaticLayout.Builder obtain = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), textPaint, i);
StaticLayout.Builder hyphenationFrequency = obtain.setAlignment(alignment).setLineSpacing(textView.getLineSpacingExtra(), textView.getLineSpacingMultiplier()).setIncludePad(textView.getIncludeFontPadding()).setBreakStrategy(textView.getBreakStrategy()).setHyphenationFrequency(textView.getHyphenationFrequency());
if (i2 == -1) {
i2 = Integer.MAX_VALUE;
}
hyphenationFrequency.setMaxLines(i2);
try {
sts.hJ_(obtain, textView);
} catch (ClassCastException unused) {
}
return obtain.build();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class IeS {
static boolean c(View view) {
return view.isInLayout();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class RVV {
static int hE_(TextView textView) {
return textView.getMaxLines();
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public int f() {
return this.j;
}
/* JADX INFO: Access modifiers changed from: package-private */
public int[] a() {
return this.i;
}
private void j() {
this.j = 0;
this.a = -1.0f;
this.c = -1.0f;
this.f = -1.0f;
this.i = new int[0];
this.k = false;
}
}