package o; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; import android.view.View; import android.widget.EditText; import java.util.ArrayList; import java.util.Arrays; import o.fLR; /* loaded from: classes5.dex */ public final class fLR implements TextWatcher { public boolean a; String b = ""; public RVV c; public EditText d; private int e; /* loaded from: classes5.dex */ public interface RVV { void b(String str); void d(String str); } @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public fLR(EditText editText, String str, int i) { InputFilter[] inputFilterArr; this.d = editText; if (editText.getFilters() == null || this.d.getFilters().length <= 0) { inputFilterArr = new InputFilter[]{new C12919fLP(str)}; } else { ArrayList arrayList = new ArrayList(Arrays.asList(this.d.getFilters())); arrayList.add(new C12919fLP(str)); inputFilterArr = (InputFilter[]) arrayList.toArray(new InputFilter[arrayList.size()]); } this.d.setFilters(inputFilterArr); this.d.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.fLT private fLR e; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { fLR.RVV rvv; fLR.RVV rvv2; fLR flr = this.e; if (!z && (rvv2 = flr.c) != null) { rvv2.b(flr.b); } else if (z && flr.a && (rvv = flr.c) != null) { rvv.d(flr.b); } } { this.e = this; } }); this.e = i; } @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { this.b = editable.toString(); if (this.c != null) { if (editable.length() >= this.e) { this.c.b(this.b); } else { this.c.d(this.b); } } } }