package o; import android.graphics.Rect; import android.text.SpannableString; import android.text.method.TransformationMethod; import android.view.View; import android.widget.TextView; import java.text.BreakIterator; import java.util.List; import java.util.Locale; /* renamed from: o.eCz, reason: case insensitive filesystem */ /* loaded from: classes5.dex */ public final class C10399eCz implements TransformationMethod { /* renamed from: o.eCz$RVV */ /* loaded from: classes5.dex */ public static final class RVV { private RVV() { } public /* synthetic */ RVV(byte b) { this(); } } @Override // android.text.method.TransformationMethod public final CharSequence getTransformation(CharSequence charSequence, View view) { StringBuilder sb; C14957gcv.e(charSequence, ""); C14957gcv.e(view, ""); if (!(view instanceof TextView)) { return charSequence; } int width = view.getWidth(); TextView textView = (TextView) view; if (width == 0) { return charSequence; } int paddingLeft = textView.getPaddingLeft(); int paddingRight = textView.getPaddingRight(); String obj = charSequence.toString(); float f = width - (paddingLeft + paddingRight); if (textView.getPaint().measureText(obj) > f && !(textView.getText() instanceof SpannableString)) { BreakIterator wordInstance = BreakIterator.getWordInstance(new Locale("th")); wordInstance.setText(obj); C14957gcv.c(wordInstance, ""); StringBuilder sb2 = new StringBuilder(); int first = wordInstance.first(); int next = wordInstance.next(); while (true) { int i = next; int i2 = first; first = i; if (first == -1) { break; } String substring = obj.substring(i2, first); C14957gcv.c((Object) substring, ""); StringBuilder sb3 = new StringBuilder(); sb3.append(substring); sb3.append("!split!"); sb2.append(sb3.toString()); next = wordInstance.next(); } String obj2 = sb2.toString(); C14957gcv.c((Object) obj2, ""); List e = gdZ.e(obj2, new String[]{"!split!"}); int size = e.size(); StringBuilder sb4 = new StringBuilder(); StringBuilder sb5 = new StringBuilder(); for (int i3 = 0; i3 < size; i3++) { String obj3 = sb5.toString(); C14957gcv.c((Object) obj3, ""); if (gdZ.d(obj3, "\n", false)) { sb5 = new StringBuilder(); } sb5.append(e.get(i3)); float measureText = textView.getPaint().measureText(sb5.toString()); if (f > measureText) { sb4.append(e.get(i3)); } else { if (f == measureText) { String str = e.get(i3); sb = new StringBuilder(); sb4.append(str); String obj4 = sb4.toString(); C14957gcv.c((Object) obj4, ""); if (!gdZ.d(obj4, " ", false)) { String obj5 = sb4.toString(); C14957gcv.c((Object) obj5, ""); if (!gdZ.d(obj5, "\n", false)) { sb4.append("\n"); } } } else { String str2 = e.get(i3); sb = new StringBuilder(); sb.append(str2); String obj6 = sb4.toString(); C14957gcv.c((Object) obj6, ""); if (!gdZ.d(obj6, " ", false)) { String obj7 = sb4.toString(); C14957gcv.c((Object) obj7, ""); if (!gdZ.d(obj7, "\n", false) && !gdZ.e(str2, " ", false) && !gdZ.e(str2, "\n", false)) { String obj8 = sb4.toString(); C14957gcv.c((Object) obj8, ""); if (!gdZ.d(obj8, ":", false)) { String obj9 = sb4.toString(); C14957gcv.c((Object) obj9, ""); if (obj9.length() > 0) { sb4.append("\n"); } } } } sb4.append(str2); } sb5 = sb; } } obj = sb4.toString(); C14957gcv.c((Object) obj, ""); } return obj; } @Override // android.text.method.TransformationMethod public final void onFocusChanged(View view, CharSequence charSequence, boolean z, int i, Rect rect) { C14957gcv.e(view, ""); C14957gcv.e(charSequence, ""); C14957gcv.e(rect, ""); } static { new RVV((byte) 0); } }