44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
|
package o;
|
||
|
|
||
|
import android.text.InputFilter;
|
||
|
import android.text.Spanned;
|
||
|
|
||
|
/* loaded from: classes5.dex */
|
||
|
public final class fLN implements InputFilter {
|
||
|
private final int b;
|
||
|
private final int d;
|
||
|
|
||
|
public fLN(int i) {
|
||
|
this.b = i;
|
||
|
this.d = 2;
|
||
|
}
|
||
|
|
||
|
public fLN(int i, int i2) {
|
||
|
this.b = i;
|
||
|
this.d = i2;
|
||
|
}
|
||
|
|
||
|
@Override // android.text.InputFilter
|
||
|
public final CharSequence filter(CharSequence charSequence, int i, int i2, Spanned spanned, int i3, int i4) {
|
||
|
StringBuilder sb = new StringBuilder(spanned);
|
||
|
sb.replace(i3, i4, charSequence.subSequence(i, i2).toString());
|
||
|
String obj = sb.toString();
|
||
|
StringBuilder sb2 = new StringBuilder("(([\\,0-9]{1})([0-9\\,]{0,");
|
||
|
sb2.append(this.b - 1);
|
||
|
sb2.append("})?)?");
|
||
|
String obj2 = sb2.toString();
|
||
|
if (this.d > 0) {
|
||
|
StringBuilder sb3 = new StringBuilder();
|
||
|
sb3.append(obj2);
|
||
|
sb3.append("(\\.[0-9]{0,");
|
||
|
sb3.append(this.d);
|
||
|
sb3.append("})?");
|
||
|
obj2 = sb3.toString();
|
||
|
}
|
||
|
if (obj.matches(obj2)) {
|
||
|
return null;
|
||
|
}
|
||
|
return charSequence.length() == 0 ? spanned.subSequence(i3, i4) : "";
|
||
|
}
|
||
|
}
|