254 lines
7.6 KiB
Java
254 lines
7.6 KiB
Java
package com.scb.phone.view.custom.common;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.view.KeyEvent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.AdapterView;
|
|
import android.widget.ArrayAdapter;
|
|
import android.widget.ImageView;
|
|
import android.widget.Spinner;
|
|
import android.widget.SpinnerAdapter;
|
|
import android.widget.TextView;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.OnClick;
|
|
import com.scb.phone.R;
|
|
import com.scb.phone.view.custom.common.AmountEditText;
|
|
import com.scb.phone.view.custom.common.CustomSchedulePayment;
|
|
import java.util.List;
|
|
import o.AQw;
|
|
import o.C0738Nl;
|
|
import o.C6583cXR;
|
|
import o.nMh;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class CustomSchedulePayment extends ConstraintLayout {
|
|
private IeS b;
|
|
|
|
@BindView
|
|
View clickableSpinner;
|
|
|
|
@BindView
|
|
ConstraintLayout container;
|
|
private boolean e;
|
|
|
|
@BindView
|
|
public AmountEditText etAmount;
|
|
|
|
@BindView
|
|
ImageView ivSpinnerArrow;
|
|
|
|
@BindView
|
|
public Spinner spinner;
|
|
|
|
@BindView
|
|
TextView tvCurrency;
|
|
|
|
@BindView
|
|
TextView tvError;
|
|
|
|
@BindView
|
|
TextView tvExtraInfo;
|
|
|
|
@BindView
|
|
View vSeparator;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public interface IeS {
|
|
void d();
|
|
|
|
void d(C0738Nl.IeS ieS);
|
|
}
|
|
|
|
public static /* synthetic */ void e() {
|
|
}
|
|
|
|
public CustomSchedulePayment(Context context) {
|
|
super(context);
|
|
this.e = true;
|
|
apr_(null);
|
|
}
|
|
|
|
public CustomSchedulePayment(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.e = true;
|
|
apr_(attributeSet);
|
|
}
|
|
|
|
public CustomSchedulePayment(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.e = true;
|
|
apr_(attributeSet);
|
|
}
|
|
|
|
private void apr_(AttributeSet attributeSet) {
|
|
String str;
|
|
LayoutInflater.from(getContext()).inflate(R.layout.2131559329, (ViewGroup) this, true);
|
|
ButterKnife.c(this);
|
|
if (attributeSet != null) {
|
|
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(attributeSet, AQw.Sts.ScheduledPaymentLayout, 0, 0);
|
|
str = obtainStyledAttributes.getString(0);
|
|
obtainStyledAttributes.recycle();
|
|
} else {
|
|
str = null;
|
|
}
|
|
if (str != null && !str.isEmpty()) {
|
|
this.tvCurrency.setText(str);
|
|
} else {
|
|
this.tvCurrency.setText(R.string.hml_baht_curreny);
|
|
}
|
|
this.etAmount.setImeOptions(6);
|
|
this.etAmount.setOnHandleDismissKeyboardListener(new AmountEditText.IeS(this) { // from class: o.eBZ
|
|
private CustomSchedulePayment b;
|
|
|
|
@Override // com.scb.phone.view.custom.common.AmountEditText.IeS
|
|
public final void e() {
|
|
this.b.b();
|
|
}
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
});
|
|
this.etAmount.setCustomHint(getResources().getString(R.string.transfer_to_account_amount_hint));
|
|
this.etAmount.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.eBY
|
|
private CustomSchedulePayment e;
|
|
|
|
@Override // android.widget.TextView.OnEditorActionListener
|
|
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
|
return CustomSchedulePayment.c(this.e, i);
|
|
}
|
|
|
|
{
|
|
this.e = this;
|
|
}
|
|
});
|
|
this.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this) { // from class: com.scb.phone.view.custom.common.CustomSchedulePayment.5
|
|
private CustomSchedulePayment d;
|
|
|
|
@Override // android.widget.AdapterView.OnItemSelectedListener
|
|
public final void onNothingSelected(AdapterView<?> adapterView) {
|
|
}
|
|
|
|
{
|
|
this.d = this;
|
|
}
|
|
|
|
@Override // android.widget.AdapterView.OnItemSelectedListener
|
|
public final void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
|
|
if (this.d.b != null) {
|
|
this.d.b.d((C0738Nl.IeS) adapterView.getSelectedItem());
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b() {
|
|
this.container.setFocusable(true);
|
|
this.container.setFocusableInTouchMode(true);
|
|
this.container.requestFocus();
|
|
IeS ieS = this.b;
|
|
if (ieS != null) {
|
|
double d = this.etAmount.e;
|
|
ieS.d();
|
|
}
|
|
}
|
|
|
|
public void setExtraInfo(String str) {
|
|
this.tvExtraInfo.setText(str);
|
|
}
|
|
|
|
public void setError(String str) {
|
|
this.tvError.setText(str);
|
|
}
|
|
|
|
public final void b(boolean z) {
|
|
this.tvError.setVisibility(z ? 0 : 8);
|
|
this.tvExtraInfo.setVisibility(z ? 8 : 0);
|
|
}
|
|
|
|
public void setInstallment(List<?> list) {
|
|
this.spinner.setAdapter((SpinnerAdapter) new ArrayAdapter(getContext(), R.layout.2131559354, list));
|
|
if (list.size() <= 1) {
|
|
this.clickableSpinner.setOnClickListener(new View.OnClickListener() { // from class: o.eCc
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
CustomSchedulePayment.e();
|
|
}
|
|
});
|
|
this.ivSpinnerArrow.setVisibility(8);
|
|
} else {
|
|
this.clickableSpinner.setOnClickListener(new View.OnClickListener(this) { // from class: o.eCg
|
|
private CustomSchedulePayment a;
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
CustomSchedulePayment.b(this.a);
|
|
}
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
});
|
|
this.ivSpinnerArrow.setVisibility(0);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setEnabled(boolean z) {
|
|
super.setEnabled(z);
|
|
this.spinner.setEnabled(z);
|
|
this.ivSpinnerArrow.setEnabled(z);
|
|
this.e = z;
|
|
this.etAmount.setEnabled(z);
|
|
this.container.setEnabled(z);
|
|
View view = this.vSeparator;
|
|
Context context = getContext();
|
|
int i = R.color.f3412131099849;
|
|
view.setBackgroundColor(nMh.getColor(context, z ? R.color.f3102131099817 : R.color.f3412131099849));
|
|
TextView textView = this.tvCurrency;
|
|
Context context2 = getContext();
|
|
if (z) {
|
|
i = R.color.f2982131099805;
|
|
}
|
|
textView.setTextColor(nMh.getColor(context2, i));
|
|
}
|
|
|
|
@OnClick
|
|
public void onClickArrow() {
|
|
if (this.e) {
|
|
this.spinner.performClick();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setOnFocusChangeListener(View.OnFocusChangeListener onFocusChangeListener) {
|
|
this.etAmount.setOnFocusChangeListener(onFocusChangeListener);
|
|
}
|
|
|
|
public static /* synthetic */ void b(CustomSchedulePayment customSchedulePayment) {
|
|
if (customSchedulePayment.e) {
|
|
customSchedulePayment.spinner.performClick();
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ boolean c(CustomSchedulePayment customSchedulePayment, int i) {
|
|
if (i != 6) {
|
|
return false;
|
|
}
|
|
C6583cXR.d(customSchedulePayment);
|
|
customSchedulePayment.b();
|
|
return true;
|
|
}
|
|
|
|
public void setListener(IeS ieS) {
|
|
this.b = ieS;
|
|
}
|
|
}
|