* Decompile and recreate Soul Browser v1.4.85 with APK CI builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix CI build: include bundled google.jks and remove PR trigger The apktool build failed in CI because app/unknown/.../google.jks was excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files and commit the missing resource. Also remove the redundant pull_request workflow trigger. Co-authored-by: KaKi87 <KaKi87@pm.me> * Change package ID to com.github.kaki87.soulbrowser Rename the application ID so the rebuilt APK can be installed alongside the original Soul Browser from Google Play. - Update AndroidManifest package, permissions, providers, and actions - Update R class references in smali (com/github/kaki87/soulbrowser/R) - Update shortcuts.xml targetPackage - Rename app label to "Soul Rebuild" for easy identification Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install compatibility: remove split APK metadata and bundle native libs The rebuilt APK still declared requiredSplitTypes and Play Store split metadata, causing Android to reject standalone installs as incompatible. - Remove requiredSplitTypes and split-related manifest meta-data - Merge native libs from all ABI splits with uncompressed storage - Page-align before signing for extractNativeLibs=false - Add .so to apktool doNotCompress list Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install failure: use apksigner v2/v3 and bundle arm64 native libs Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only produces v1 signatures, causing Android to reject the install. - Sign with apksigner (v1+v2+v3) instead of jarsigner - Add arm64-v8a native libraries from universal Soul Browser 1.4.79 - Set extractNativeLibs=true for reliable sideload installs - Commit stable debug keystore for consistent signatures across builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Add committed debug keystore for consistent APK signatures Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix startup crash: use original classes2.dex desugar libraries Apktool recompiles smali_classes2 into a broken classes2.dex, causing ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init. Inject the original classes2.dex (Java 8+ desugar libs) after apktool build instead of using the recompiled version. Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix missing drawable resources from density split APKs The base APK is an app bundle module; density-specific drawables like seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild, causing Resources$NotFoundException at runtime. - Merge non-9-patch resources from split APKs before apktool build - Sync public.xml IDs from R smali only when backing files exist - Add 713 density-specific resource IDs to public.xml Co-authored-by: KaKi87 <KaKi87@pm.me> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
331 lines
12 KiB
Java
331 lines
12 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.graphics.RectF;
|
|
import android.os.Build;
|
|
import android.text.Layout;
|
|
import android.text.StaticLayout;
|
|
import android.text.TextDirectionHeuristic;
|
|
import android.text.TextDirectionHeuristics;
|
|
import android.text.TextPaint;
|
|
import android.text.method.TransformationMethod;
|
|
import android.util.Log;
|
|
import android.util.TypedValue;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.DoNotInline;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import j$.util.concurrent.ConcurrentHashMap;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class AppCompatTextViewAutoSizeHelper {
|
|
public static final RectF l = new RectF();
|
|
public static final ConcurrentHashMap m = new ConcurrentHashMap();
|
|
|
|
/* renamed from: a, reason: collision with root package name */
|
|
public int f283a = 0;
|
|
public boolean b = false;
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public float f284c = -1.0f;
|
|
public float d = -1.0f;
|
|
public float e = -1.0f;
|
|
public int[] f = new int[0];
|
|
public boolean g = false;
|
|
public TextPaint h;
|
|
public final TextView i;
|
|
public final Context j;
|
|
public final Impl23 k;
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static final class Api23Impl {
|
|
@NonNull
|
|
@DoNotInline
|
|
public static StaticLayout a(@NonNull CharSequence charSequence, @NonNull Layout.Alignment alignment, int i, int i2, @NonNull TextView textView, @NonNull TextPaint textPaint, @NonNull Impl impl) {
|
|
StaticLayout.Builder obtain = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), textPaint, i);
|
|
StaticLayout.Builder hyphenationFrequency = obtain.setAlignment(alignment).setLineSpacing(textView.getLineSpacingExtra(), textView.getLineSpacingMultiplier()).setIncludePad(textView.getIncludeFontPadding()).setBreakStrategy(textView.getBreakStrategy()).setHyphenationFrequency(textView.getHyphenationFrequency());
|
|
if (i2 == -1) {
|
|
i2 = Integer.MAX_VALUE;
|
|
}
|
|
hyphenationFrequency.setMaxLines(i2);
|
|
try {
|
|
impl.a(obtain, textView);
|
|
} catch (ClassCastException unused) {
|
|
Log.w("ACTVAutoSizeHelper", "Failed to obtain TextDirectionHeuristic, auto size may be incorrect");
|
|
}
|
|
return obtain.build();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class Impl {
|
|
public void a(StaticLayout.Builder builder, TextView textView) {
|
|
}
|
|
|
|
public boolean b(TextView textView) {
|
|
return ((Boolean) AppCompatTextViewAutoSizeHelper.e(textView, Boolean.FALSE, "getHorizontallyScrolling")).booleanValue();
|
|
}
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Impl23 extends Impl {
|
|
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
|
public void a(StaticLayout.Builder builder, TextView textView) {
|
|
builder.setTextDirection((TextDirectionHeuristic) AppCompatTextViewAutoSizeHelper.e(textView, TextDirectionHeuristics.FIRSTSTRONG_LTR, "getTextDirectionHeuristic"));
|
|
}
|
|
}
|
|
|
|
@RequiresApi
|
|
/* loaded from: classes.dex */
|
|
public static class Impl29 extends Impl23 {
|
|
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl23, androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
|
public void a(StaticLayout.Builder builder, TextView textView) {
|
|
builder.setTextDirection(textView.getTextDirectionHeuristic());
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
|
public boolean b(TextView textView) {
|
|
return textView.isHorizontallyScrollable();
|
|
}
|
|
}
|
|
|
|
public AppCompatTextViewAutoSizeHelper(TextView textView) {
|
|
this.i = textView;
|
|
this.j = textView.getContext();
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
this.k = new Impl29();
|
|
} else {
|
|
this.k = new Impl23();
|
|
}
|
|
}
|
|
|
|
public static int[] b(int[] iArr) {
|
|
int length = iArr.length;
|
|
if (length != 0) {
|
|
Arrays.sort(iArr);
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i : iArr) {
|
|
if (i > 0 && Collections.binarySearch(arrayList, Integer.valueOf(i)) < 0) {
|
|
arrayList.add(Integer.valueOf(i));
|
|
}
|
|
}
|
|
if (length != arrayList.size()) {
|
|
int size = arrayList.size();
|
|
int[] iArr2 = new int[size];
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
iArr2[i2] = ((Integer) arrayList.get(i2)).intValue();
|
|
}
|
|
return iArr2;
|
|
}
|
|
}
|
|
return iArr;
|
|
}
|
|
|
|
public static Method d(String str) {
|
|
try {
|
|
ConcurrentHashMap concurrentHashMap = m;
|
|
Method method = (Method) concurrentHashMap.get(str);
|
|
if (method == null && (method = TextView.class.getDeclaredMethod(str, null)) != null) {
|
|
method.setAccessible(true);
|
|
concurrentHashMap.put(str, method);
|
|
return method;
|
|
}
|
|
return method;
|
|
} catch (Exception e) {
|
|
Log.w("ACTVAutoSizeHelper", "Failed to retrieve TextView#" + str + "() method", e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static Object e(Object obj, Object obj2, String str) {
|
|
try {
|
|
return d(str).invoke(obj, null);
|
|
} catch (Exception e) {
|
|
Log.w("ACTVAutoSizeHelper", "Failed to invoke TextView#" + str + "() method", e);
|
|
return obj2;
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
int measuredWidth;
|
|
if (f()) {
|
|
if (this.b) {
|
|
if (this.i.getMeasuredHeight() > 0 && this.i.getMeasuredWidth() > 0) {
|
|
if (this.k.b(this.i)) {
|
|
measuredWidth = 1048576;
|
|
} else {
|
|
measuredWidth = (this.i.getMeasuredWidth() - this.i.getTotalPaddingLeft()) - this.i.getTotalPaddingRight();
|
|
}
|
|
int height = (this.i.getHeight() - this.i.getCompoundPaddingBottom()) - this.i.getCompoundPaddingTop();
|
|
if (measuredWidth > 0 && height > 0) {
|
|
RectF rectF = l;
|
|
synchronized (rectF) {
|
|
try {
|
|
rectF.setEmpty();
|
|
rectF.right = measuredWidth;
|
|
rectF.bottom = height;
|
|
float c2 = c(rectF);
|
|
if (c2 != this.i.getTextSize()) {
|
|
g(c2, 0);
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
} else {
|
|
return;
|
|
}
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
this.b = true;
|
|
}
|
|
}
|
|
|
|
public final int c(RectF rectF) {
|
|
CharSequence charSequence;
|
|
CharSequence transformation;
|
|
int length = this.f.length;
|
|
if (length != 0) {
|
|
int i = length - 1;
|
|
int i2 = 0;
|
|
int i3 = 1;
|
|
while (i3 <= i) {
|
|
int i4 = (i3 + i) / 2;
|
|
int i5 = this.f[i4];
|
|
TextView textView = this.i;
|
|
CharSequence text = textView.getText();
|
|
TransformationMethod transformationMethod = textView.getTransformationMethod();
|
|
if (transformationMethod != null && (transformation = transformationMethod.getTransformation(text, textView)) != null) {
|
|
charSequence = transformation;
|
|
} else {
|
|
charSequence = text;
|
|
}
|
|
int maxLines = textView.getMaxLines();
|
|
TextPaint textPaint = this.h;
|
|
if (textPaint == null) {
|
|
this.h = new TextPaint();
|
|
} else {
|
|
textPaint.reset();
|
|
}
|
|
this.h.set(textView.getPaint());
|
|
this.h.setTextSize(i5);
|
|
StaticLayout a2 = Api23Impl.a(charSequence, (Layout.Alignment) e(textView, Layout.Alignment.ALIGN_NORMAL, "getLayoutAlignment"), Math.round(rectF.right), maxLines, this.i, this.h, this.k);
|
|
if ((maxLines != -1 && (a2.getLineCount() > maxLines || a2.getLineEnd(a2.getLineCount() - 1) != charSequence.length())) || a2.getHeight() > rectF.bottom) {
|
|
i2 = i4 - 1;
|
|
i = i2;
|
|
} else {
|
|
int i6 = i4 + 1;
|
|
i2 = i3;
|
|
i3 = i6;
|
|
}
|
|
}
|
|
return this.f[i2];
|
|
}
|
|
throw new IllegalStateException("No available text sizes to choose from.");
|
|
}
|
|
|
|
public final boolean f() {
|
|
if (j() && this.f283a != 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void g(float f, int i) {
|
|
Resources resources;
|
|
Context context = this.j;
|
|
if (context == null) {
|
|
resources = Resources.getSystem();
|
|
} else {
|
|
resources = context.getResources();
|
|
}
|
|
float applyDimension = TypedValue.applyDimension(i, f, resources.getDisplayMetrics());
|
|
TextView textView = this.i;
|
|
if (applyDimension != textView.getPaint().getTextSize()) {
|
|
textView.getPaint().setTextSize(applyDimension);
|
|
boolean isInLayout = textView.isInLayout();
|
|
if (textView.getLayout() != null) {
|
|
this.b = false;
|
|
try {
|
|
Method d = d("nullLayouts");
|
|
if (d != null) {
|
|
d.invoke(textView, null);
|
|
}
|
|
} catch (Exception e) {
|
|
Log.w("ACTVAutoSizeHelper", "Failed to invoke TextView#nullLayouts() method", e);
|
|
}
|
|
if (!isInLayout) {
|
|
textView.requestLayout();
|
|
} else {
|
|
textView.forceLayout();
|
|
}
|
|
textView.invalidate();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean h() {
|
|
if (j() && this.f283a == 1) {
|
|
if (!this.g || this.f.length == 0) {
|
|
int floor = ((int) Math.floor((this.e - this.d) / this.f284c)) + 1;
|
|
int[] iArr = new int[floor];
|
|
for (int i = 0; i < floor; i++) {
|
|
iArr[i] = Math.round((i * this.f284c) + this.d);
|
|
}
|
|
this.f = b(iArr);
|
|
}
|
|
this.b = true;
|
|
} else {
|
|
this.b = false;
|
|
}
|
|
return this.b;
|
|
}
|
|
|
|
public final boolean i() {
|
|
boolean z;
|
|
if (this.f.length > 0) {
|
|
z = true;
|
|
} else {
|
|
z = false;
|
|
}
|
|
this.g = z;
|
|
if (z) {
|
|
this.f283a = 1;
|
|
this.d = r0[0];
|
|
this.e = r0[r1 - 1];
|
|
this.f284c = -1.0f;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public final boolean j() {
|
|
return !(this.i instanceof AppCompatEditText);
|
|
}
|
|
|
|
public final void k(float f, float f2, float f3) {
|
|
if (f > 0.0f) {
|
|
if (f2 > f) {
|
|
if (f3 > 0.0f) {
|
|
this.f283a = 1;
|
|
this.d = f;
|
|
this.e = f2;
|
|
this.f284c = f3;
|
|
this.g = false;
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("The auto-size step granularity (" + f3 + "px) is less or equal to (0px)");
|
|
}
|
|
throw new IllegalArgumentException("Maximum auto-size text size (" + f2 + "px) is less or equal to minimum auto-size text size (" + f + "px)");
|
|
}
|
|
throw new IllegalArgumentException("Minimum auto-size text size (" + f + "px) is less or equal to (0px)");
|
|
}
|
|
}
|