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

410 lines
13 KiB
Java

package com.scb.phone.view.custom.common;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.Editable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.custom.common.CustomURLEditTextWithButtonView;
import o.C14957gcv;
import o.C15715hv;
import o.C6583cXR;
import o.fJJ;
import o.nMh;
/* loaded from: classes5.dex */
public final class CustomURLEditTextWithButtonView extends LinearLayout {
@BindView
public ImageView clearButtonImageView;
@BindView
public LinearLayout componentBaseLinearLayout;
@BindView
public ImageView deleteUrlImageView;
@BindView
public Button previewBt;
@BindView
public TextView urlErrorMsgTv;
@BindView
public EditText urlEt;
@BindView
public TextView urlTitle;
public /* synthetic */ CustomURLEditTextWithButtonView(Context context, AttributeSet attributeSet, int i, byte b) {
this(context, (i & 2) != 0 ? null : attributeSet, 0);
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomURLEditTextWithButtonView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
C14957gcv.e(context, "");
LayoutInflater.from(context).inflate(R.layout.2131560158, (ViewGroup) this, true);
ButterKnife.c(this);
EditText editText = null;
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, C15715hv.jbe.CustomURLEditTextWithButtonView, 0, 0);
C14957gcv.c(obtainStyledAttributes, "");
String string = obtainStyledAttributes.getString(3);
String string2 = obtainStyledAttributes.getString(1);
String string3 = obtainStyledAttributes.getString(0);
string3 = string3 == null ? context.getString(R.string.hml_business_url_info_preview_btn) : string3;
C14957gcv.c((Object) string3, "");
String string4 = obtainStyledAttributes.getString(2);
String string5 = obtainStyledAttributes.getString(4);
string5 = string5 == null ? context.getString(R.string.hml_business_url_info_url_invalid_error) : string5;
C14957gcv.c((Object) string5, "");
obtainStyledAttributes.recycle();
if (string != null) {
String str = string;
if (str.length() > 0) {
TextView textView = this.urlTitle;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
}
if (string2 != null) {
String str2 = string2;
if (str2.length() > 0) {
EditText editText2 = this.urlEt;
if (editText2 == null) {
C14957gcv.a("");
editText2 = null;
}
editText2.setHint(str2);
}
}
if (string4 != null) {
String str3 = string4;
if (str3.length() > 0) {
EditText editText3 = this.urlEt;
if (editText3 == null) {
C14957gcv.a("");
editText3 = null;
}
editText3.setText(str3);
}
}
String str4 = string3;
if (str4.length() > 0) {
Button button = this.previewBt;
if (button == null) {
C14957gcv.a("");
button = null;
}
button.setText(str4);
}
String str5 = string5;
if (str5.length() > 0) {
TextView textView2 = this.urlErrorMsgTv;
if (textView2 == null) {
C14957gcv.a("");
textView2 = null;
}
textView2.setText(str5);
}
}
Button button2 = this.previewBt;
if (button2 == null) {
C14957gcv.a("");
button2 = null;
}
button2.setOnClickListener(new View.OnClickListener(this) { // from class: o.eCe
private CustomURLEditTextWithButtonView d;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomURLEditTextWithButtonView.d(this.d);
}
{
this.d = this;
}
});
ImageView imageView = this.clearButtonImageView;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
imageView.setOnClickListener(new View.OnClickListener(this) { // from class: o.eCi
private CustomURLEditTextWithButtonView d;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomURLEditTextWithButtonView.b(this.d);
}
{
this.d = this;
}
});
EditText editText4 = this.urlEt;
if (editText4 != null) {
editText = editText4;
} else {
C14957gcv.a("");
}
editText.addTextChangedListener(new fJJ(this) { // from class: com.scb.phone.view.custom.common.CustomURLEditTextWithButtonView.1
private CustomURLEditTextWithButtonView c;
{
this.c = this;
}
@Override // o.fJJ, android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
C14957gcv.e(editable, "");
this.c.d(true);
}
});
}
public final void setUrlTitle(String str) {
C14957gcv.e(str, "");
TextView textView = this.urlTitle;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
public final void setUrlEditText(String str) {
C14957gcv.e(str, "");
EditText editText = this.urlEt;
ImageView imageView = null;
if (editText == null) {
C14957gcv.a("");
editText = null;
}
editText.setText(str);
ImageView imageView2 = this.clearButtonImageView;
if (imageView2 != null) {
imageView = imageView2;
} else {
C14957gcv.a("");
}
ImageView imageView3 = imageView;
C14957gcv.e(imageView3, "");
imageView3.setVisibility(8);
}
public final void setUrlEditTextHint(String str) {
C14957gcv.e(str, "");
EditText editText = this.urlEt;
if (editText == null) {
C14957gcv.a("");
editText = null;
}
editText.setHint(str);
}
public final void setButtonText(String str) {
C14957gcv.e(str, "");
Button button = this.previewBt;
if (button == null) {
C14957gcv.a("");
button = null;
}
button.setText(str);
}
public final void setButtonEnabled(boolean z) {
Button button = this.previewBt;
if (button == null) {
C14957gcv.a("");
button = null;
}
button.setEnabled(z);
}
public final void setErrorMessage(String str) {
C14957gcv.e(str, "");
TextView textView = this.urlErrorMsgTv;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setText(str);
}
public final void c(boolean z) {
TextView textView = this.urlErrorMsgTv;
EditText editText = null;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
textView.setVisibility(z ? 8 : 0);
int i = z ? R.drawable.shape_gray_rounded_rectangle : R.drawable.shape_red_reounded_reactangle_border;
EditText editText2 = this.urlEt;
if (editText2 == null) {
C14957gcv.a("");
editText2 = null;
}
editText2.setBackground(nMh.getDrawable(getContext(), i));
if (z) {
EditText editText3 = this.urlEt;
if (editText3 != null) {
editText = editText3;
} else {
C14957gcv.a("");
}
editText.setTextColor(-16777216);
} else {
EditText editText4 = this.urlEt;
if (editText4 != null) {
editText = editText4;
} else {
C14957gcv.a("");
}
editText.setTextColor(nMh.getColorStateList(getContext(), R.color.f13582131100866));
}
setButtonEnabled(z);
requestLayout();
invalidate();
}
public final void apt_(View.OnFocusChangeListener onFocusChangeListener) {
C14957gcv.e(onFocusChangeListener, "");
EditText editText = this.urlEt;
LinearLayout linearLayout = null;
if (editText == null) {
C14957gcv.a("");
editText = null;
}
editText.setOnFocusChangeListener(onFocusChangeListener);
LinearLayout linearLayout2 = this.componentBaseLinearLayout;
if (linearLayout2 != null) {
linearLayout = linearLayout2;
} else {
C14957gcv.a("");
}
linearLayout.setOnClickListener(new View.OnClickListener(this) { // from class: o.eCl
private CustomURLEditTextWithButtonView e;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomURLEditTextWithButtonView.c(this.e);
}
{
this.e = this;
}
});
}
public final void d(boolean z) {
ImageView imageView = this.clearButtonImageView;
if (imageView == null) {
C14957gcv.a("");
imageView = null;
}
ImageView imageView2 = imageView;
C14957gcv.e(imageView2, "");
imageView2.setVisibility(z ? 0 : 8);
}
public static /* synthetic */ void b(CustomURLEditTextWithButtonView customURLEditTextWithButtonView) {
C14957gcv.e(customURLEditTextWithButtonView, "");
EditText editText = customURLEditTextWithButtonView.urlEt;
if (editText == null) {
C14957gcv.a("");
editText = null;
}
editText.setText("");
}
public static /* synthetic */ void c(CustomURLEditTextWithButtonView customURLEditTextWithButtonView) {
C14957gcv.e(customURLEditTextWithButtonView, "");
TextView textView = customURLEditTextWithButtonView.urlTitle;
TextView textView2 = null;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
TextView textView3 = textView;
C14957gcv.e(textView3, "");
textView3.setFocusable(true);
textView3.setFocusableInTouchMode(true);
textView3.requestFocus();
TextView textView4 = customURLEditTextWithButtonView.urlTitle;
if (textView4 != null) {
textView2 = textView4;
} else {
C14957gcv.a("");
}
C6583cXR.d(textView2);
}
public static /* synthetic */ void d(CustomURLEditTextWithButtonView customURLEditTextWithButtonView) {
C14957gcv.e(customURLEditTextWithButtonView, "");
customURLEditTextWithButtonView.c(false);
}
public final void setUrlTitle(TextView textView) {
C14957gcv.e(textView, "");
this.urlTitle = textView;
}
public final void setUrlEt(EditText editText) {
C14957gcv.e(editText, "");
this.urlEt = editText;
}
public final void setUrlErrorMsgTv(TextView textView) {
C14957gcv.e(textView, "");
this.urlErrorMsgTv = textView;
}
public final void setPreviewBt(Button button) {
C14957gcv.e(button, "");
this.previewBt = button;
}
public final void setDeleteUrlImageView(ImageView imageView) {
C14957gcv.e(imageView, "");
this.deleteUrlImageView = imageView;
}
public final void setComponentBaseLinearLayout(LinearLayout linearLayout) {
C14957gcv.e(linearLayout, "");
this.componentBaseLinearLayout = linearLayout;
}
public final void setClearButtonImageView(ImageView imageView) {
C14957gcv.e(imageView, "");
this.clearButtonImageView = imageView;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public CustomURLEditTextWithButtonView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 4, (byte) 0);
C14957gcv.e(context, "");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public CustomURLEditTextWithButtonView(Context context) {
this(context, null, 6, (byte) 0);
C14957gcv.e(context, "");
}
}