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

100 lines
3.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.text.InputFilter;
import android.text.Selection;
import android.text.Spannable;
import android.text.Spanned;
import android.widget.TextView;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import o.C16349neT;
/* loaded from: classes.dex */
final class lHn implements InputFilter {
private final TextView d;
private C16349neT.IeS e;
/* JADX INFO: Access modifiers changed from: package-private */
public lHn(TextView textView) {
this.d = textView;
}
@Override // android.text.InputFilter
public final CharSequence filter(CharSequence charSequence, int i, int i2, Spanned spanned, int i3, int i4) {
if (this.d.isInEditMode()) {
return charSequence;
}
int a = C16349neT.e().a();
if (a != 0) {
if (a == 1) {
if ((i4 == 0 && i3 == 0 && spanned.length() == 0 && charSequence == this.d.getText()) || charSequence == null) {
return charSequence;
}
if (i != 0 || i2 != charSequence.length()) {
charSequence = charSequence.subSequence(i, i2);
}
return C16349neT.e().b(charSequence, 0, charSequence.length());
}
if (a != 3) {
return charSequence;
}
}
C16349neT e = C16349neT.e();
if (this.e == null) {
this.e = new HBt(this.d, this);
}
e.c(this.e);
return charSequence;
}
/* loaded from: classes.dex */
static class HBt extends C16349neT.IeS {
private final Reference<TextView> a;
private final Reference<lHn> b;
HBt(TextView textView, lHn lhn) {
this.a = new WeakReference(textView);
this.b = new WeakReference(lhn);
}
@Override // o.C16349neT.IeS
public final void b() {
InputFilter[] filters;
CharSequence text;
CharSequence b;
super.b();
TextView textView = this.a.get();
lHn lhn = this.b.get();
if (lhn == null || textView == null || (filters = textView.getFilters()) == null) {
return;
}
for (InputFilter inputFilter : filters) {
if (inputFilter == lhn) {
if (!textView.isAttachedToWindow() || text == (b = C16349neT.e().b((text = textView.getText())))) {
return;
}
int selectionStart = Selection.getSelectionStart(b);
int selectionEnd = Selection.getSelectionEnd(b);
textView.setText(b);
if (b instanceof Spannable) {
lHn.xS_((Spannable) b, selectionStart, selectionEnd);
return;
}
return;
}
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void xS_(Spannable spannable, int i, int i2) {
if (i >= 0 && i2 >= 0) {
Selection.setSelection(spannable, i, i2);
} else if (i >= 0) {
Selection.setSelection(spannable, i);
} else if (i2 >= 0) {
Selection.setSelection(spannable, i2);
}
}
}