335 lines
12 KiB
Java
335 lines
12 KiB
Java
package o;
|
|
|
|
import android.os.Build;
|
|
import android.text.Editable;
|
|
import android.text.SpanWatcher;
|
|
import android.text.Spannable;
|
|
import android.text.SpannableStringBuilder;
|
|
import android.text.TextWatcher;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.Array;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class OiU extends SpannableStringBuilder {
|
|
private final List<IeS> a;
|
|
private final Class<?> b;
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Editable append(char c) {
|
|
return append(c);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Editable append(CharSequence charSequence) {
|
|
return append(charSequence);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Editable append(CharSequence charSequence, int i, int i2) {
|
|
return append(charSequence, i, i2);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Appendable append(char c) throws IOException {
|
|
return append(c);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Appendable append(CharSequence charSequence) throws IOException {
|
|
return append(charSequence);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final /* bridge */ /* synthetic */ Appendable append(CharSequence charSequence, int i, int i2) throws IOException {
|
|
return append(charSequence, i, i2);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final /* bridge */ /* synthetic */ Editable delete(int i, int i2) {
|
|
return delete(i, i2);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final /* bridge */ /* synthetic */ Editable insert(int i, CharSequence charSequence) {
|
|
return insert(i, charSequence);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final /* bridge */ /* synthetic */ Editable insert(int i, CharSequence charSequence, int i2, int i3) {
|
|
return insert(i, charSequence, i2, i3);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final /* bridge */ /* synthetic */ Editable replace(int i, int i2, CharSequence charSequence) {
|
|
return replace(i, i2, charSequence);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final /* bridge */ /* synthetic */ Editable replace(int i, int i2, CharSequence charSequence, int i3, int i4) {
|
|
return replace(i, i2, charSequence, i3, i4);
|
|
}
|
|
|
|
public OiU(Class<?> cls, CharSequence charSequence) {
|
|
super(charSequence);
|
|
this.a = new ArrayList();
|
|
if (cls != null) {
|
|
this.b = cls;
|
|
return;
|
|
}
|
|
throw new NullPointerException("watcherClass cannot be null");
|
|
}
|
|
|
|
private OiU(Class<?> cls, CharSequence charSequence, int i, int i2) {
|
|
super(charSequence, i, i2);
|
|
this.a = new ArrayList();
|
|
if (cls != null) {
|
|
this.b = cls;
|
|
return;
|
|
}
|
|
throw new NullPointerException("watcherClass cannot be null");
|
|
}
|
|
|
|
private boolean d(Object obj) {
|
|
if (obj != null) {
|
|
if (this.b == obj.getClass()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, java.lang.CharSequence
|
|
public final CharSequence subSequence(int i, int i2) {
|
|
return new OiU(this.b, this, i, i2);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spannable
|
|
public final void setSpan(Object obj, int i, int i2, int i3) {
|
|
if (d(obj)) {
|
|
IeS ieS = new IeS(obj);
|
|
this.a.add(ieS);
|
|
obj = ieS;
|
|
}
|
|
super.setSpan(obj, i, i2, i3);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spannable
|
|
public final void removeSpan(Object obj) {
|
|
IeS ieS;
|
|
if (d(obj)) {
|
|
ieS = c(obj);
|
|
if (ieS != null) {
|
|
obj = ieS;
|
|
}
|
|
} else {
|
|
ieS = null;
|
|
}
|
|
super.removeSpan(obj);
|
|
if (ieS != null) {
|
|
this.a.remove(ieS);
|
|
}
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spanned
|
|
public final int getSpanStart(Object obj) {
|
|
IeS c;
|
|
if (d(obj) && (c = c(obj)) != null) {
|
|
obj = c;
|
|
}
|
|
return super.getSpanStart(obj);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spanned
|
|
public final int getSpanEnd(Object obj) {
|
|
IeS c;
|
|
if (d(obj) && (c = c(obj)) != null) {
|
|
obj = c;
|
|
}
|
|
return super.getSpanEnd(obj);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spanned
|
|
public final int getSpanFlags(Object obj) {
|
|
IeS c;
|
|
if (d(obj) && (c = c(obj)) != null) {
|
|
obj = c;
|
|
}
|
|
return super.getSpanFlags(obj);
|
|
}
|
|
|
|
private IeS c(Object obj) {
|
|
for (int i = 0; i < this.a.size(); i++) {
|
|
IeS ieS = this.a.get(i);
|
|
if (ieS.c == obj) {
|
|
return ieS;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final void a() {
|
|
for (int i = 0; i < this.a.size(); i++) {
|
|
this.a.get(i).e.incrementAndGet();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final void c() {
|
|
for (int i = 0; i < this.a.size(); i++) {
|
|
this.a.get(i).e.decrementAndGet();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final void e() {
|
|
for (int i = 0; i < this.a.size(); i++) {
|
|
this.a.get(i).onTextChanged(this, 0, length(), length());
|
|
}
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final SpannableStringBuilder replace(int i, int i2, CharSequence charSequence) {
|
|
a();
|
|
super.replace(i, i2, charSequence);
|
|
c();
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final SpannableStringBuilder replace(int i, int i2, CharSequence charSequence, int i3, int i4) {
|
|
a();
|
|
super.replace(i, i2, charSequence, i3, i4);
|
|
c();
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final SpannableStringBuilder insert(int i, CharSequence charSequence) {
|
|
super.insert(i, charSequence);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final SpannableStringBuilder insert(int i, CharSequence charSequence, int i2, int i3) {
|
|
super.insert(i, charSequence, i2, i3);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable
|
|
public final SpannableStringBuilder delete(int i, int i2) {
|
|
super.delete(i, i2);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final SpannableStringBuilder append(CharSequence charSequence) {
|
|
super.append(charSequence);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final SpannableStringBuilder append(char c) {
|
|
super.append(c);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Editable, java.lang.Appendable
|
|
public final SpannableStringBuilder append(CharSequence charSequence, int i, int i2) {
|
|
super.append(charSequence, i, i2);
|
|
return this;
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder
|
|
public final SpannableStringBuilder append(CharSequence charSequence, Object obj, int i) {
|
|
super.append(charSequence, obj, i);
|
|
return this;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public static class IeS implements TextWatcher, SpanWatcher {
|
|
final Object c;
|
|
final AtomicInteger e = new AtomicInteger(0);
|
|
|
|
IeS(Object obj) {
|
|
this.c = obj;
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
((TextWatcher) this.c).beforeTextChanged(charSequence, i, i2, i3);
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
((TextWatcher) this.c).onTextChanged(charSequence, i, i2, i3);
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void afterTextChanged(Editable editable) {
|
|
((TextWatcher) this.c).afterTextChanged(editable);
|
|
}
|
|
|
|
@Override // android.text.SpanWatcher
|
|
public void onSpanAdded(Spannable spannable, Object obj, int i, int i2) {
|
|
if (this.e.get() <= 0 || !(obj instanceof ZBp)) {
|
|
((SpanWatcher) this.c).onSpanAdded(spannable, obj, i, i2);
|
|
}
|
|
}
|
|
|
|
@Override // android.text.SpanWatcher
|
|
public void onSpanRemoved(Spannable spannable, Object obj, int i, int i2) {
|
|
if (this.e.get() <= 0 || !(obj instanceof ZBp)) {
|
|
((SpanWatcher) this.c).onSpanRemoved(spannable, obj, i, i2);
|
|
}
|
|
}
|
|
|
|
@Override // android.text.SpanWatcher
|
|
public void onSpanChanged(Spannable spannable, Object obj, int i, int i2, int i3, int i4) {
|
|
int i5;
|
|
int i6;
|
|
if (this.e.get() <= 0 || !(obj instanceof ZBp)) {
|
|
if (Build.VERSION.SDK_INT < 28) {
|
|
if (i > i2) {
|
|
i = 0;
|
|
}
|
|
if (i3 > i4) {
|
|
i5 = i;
|
|
i6 = 0;
|
|
((SpanWatcher) this.c).onSpanChanged(spannable, obj, i5, i2, i6, i4);
|
|
}
|
|
}
|
|
i5 = i;
|
|
i6 = i3;
|
|
((SpanWatcher) this.c).onSpanChanged(spannable, obj, i5, i2, i6, i4);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spanned
|
|
public final <T> T[] getSpans(int i, int i2, Class<T> cls) {
|
|
if (this.b == cls) {
|
|
IeS[] ieSArr = (IeS[]) super.getSpans(i, i2, IeS.class);
|
|
T[] tArr = (T[]) ((Object[]) Array.newInstance((Class<?>) cls, ieSArr.length));
|
|
for (int i3 = 0; i3 < ieSArr.length; i3++) {
|
|
tArr[i3] = ieSArr[i3].c;
|
|
}
|
|
return tArr;
|
|
}
|
|
return (T[]) super.getSpans(i, i2, cls);
|
|
}
|
|
|
|
@Override // android.text.SpannableStringBuilder, android.text.Spanned
|
|
public final int nextSpanTransition(int i, int i2, Class cls) {
|
|
if (cls == null || this.b == cls) {
|
|
cls = IeS.class;
|
|
}
|
|
return super.nextSpanTransition(i, i2, cls);
|
|
}
|
|
}
|