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

89 lines
3.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.common;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.scb.phone.R;
import o.AQw;
/* loaded from: classes5.dex */
public class ScbTextInputLayout extends LinearLayout {
private String a;
private EditText b;
private boolean c;
private int d;
private String e;
private String f;
private TextView g;
private TextView h;
private String i;
private int j;
public ScbTextInputLayout(Context context) {
this(context, null);
}
public ScbTextInputLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
setOrientation(1);
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, AQw.Sts.ScbTextInputLayout, 0, 0);
try {
this.i = obtainStyledAttributes.getString(4);
this.j = obtainStyledAttributes.getResourceId(6, R.style.f56162132017876);
this.f = obtainStyledAttributes.getString(5);
this.a = obtainStyledAttributes.getString(1);
this.d = obtainStyledAttributes.getResourceId(3, R.style.f57202132017981);
this.e = obtainStyledAttributes.getString(2);
this.c = obtainStyledAttributes.getBoolean(0, false);
obtainStyledAttributes.recycle();
if (this.f == null) {
this.f = "fonts/db_heavent_regular.ttf";
}
if (this.e == null) {
this.e = "fonts/db_heavent_regular.ttf";
}
TextView textView = new TextView(context);
this.g = textView;
textView.setTextAppearance(context, this.j);
this.g.setText(this.i);
this.g.setTypeface(Typeface.createFromAsset(context.getAssets(), this.f));
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin = context.getResources().getDimensionPixelSize(R.dimen.f17112131165477);
addView(this.g, layoutParams);
TextView textView2 = new TextView(context);
this.h = textView2;
textView2.setTextAppearance(context, this.d);
this.h.setText(this.a);
this.h.setTypeface(Typeface.createFromAsset(context.getAssets(), this.e));
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
((ViewGroup.MarginLayoutParams) layoutParams2).topMargin = context.getResources().getDimensionPixelSize(R.dimen.f17112131165477);
addView(this.h, layoutParams2);
this.h.setVisibility(this.c ? 0 : 8);
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (view instanceof EditText) {
this.b = (EditText) view;
super.addView(view, 1, layoutParams);
} else {
super.addView(view, i, layoutParams);
}
}
public void setErrorEnabled(boolean z) {
this.c = z;
this.h.setVisibility(z ? 0 : 8);
}
}