soul-browser/sources/java/com/google/android/material/internal/TextDrawableHelper.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* 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>
2026-08-10 16:07:14 +02:00

108 lines
3.9 KiB
Java

package com.google.android.material.internal;
import android.content.Context;
import android.graphics.Typeface;
import android.text.TextPaint;
import androidx.annotation.RestrictTo;
import com.google.android.material.resources.TextAppearance;
import com.google.android.material.resources.TextAppearanceFontCallback;
import java.lang.ref.WeakReference;
@RestrictTo
/* loaded from: classes3.dex */
public class TextDrawableHelper {
/* renamed from: c, reason: collision with root package name */
public float f11816c;
public float d;
public final WeakReference f;
public TextAppearance g;
/* renamed from: a, reason: collision with root package name */
public final TextPaint f11815a = new TextPaint(1);
public final TextAppearanceFontCallback b = new TextAppearanceFontCallback() { // from class: com.google.android.material.internal.TextDrawableHelper.1
@Override // com.google.android.material.resources.TextAppearanceFontCallback
public final void a(int i) {
TextDrawableHelper textDrawableHelper = TextDrawableHelper.this;
textDrawableHelper.e = true;
TextDrawableDelegate textDrawableDelegate = (TextDrawableDelegate) textDrawableHelper.f.get();
if (textDrawableDelegate != null) {
textDrawableDelegate.a();
}
}
@Override // com.google.android.material.resources.TextAppearanceFontCallback
public final void b(Typeface typeface, boolean z) {
if (!z) {
TextDrawableHelper textDrawableHelper = TextDrawableHelper.this;
textDrawableHelper.e = true;
TextDrawableDelegate textDrawableDelegate = (TextDrawableDelegate) textDrawableHelper.f.get();
if (textDrawableDelegate != null) {
textDrawableDelegate.a();
}
}
}
};
public boolean e = true;
/* loaded from: classes3.dex */
public interface TextDrawableDelegate {
void a();
int[] getState();
boolean onStateChange(int[] iArr);
}
public TextDrawableHelper(TextDrawableDelegate textDrawableDelegate) {
this.f = new WeakReference(null);
this.f = new WeakReference(textDrawableDelegate);
}
public final float a(String str) {
if (!this.e) {
return this.f11816c;
}
b(str);
return this.f11816c;
}
public final void b(String str) {
float measureText;
TextPaint textPaint = this.f11815a;
float f = 0.0f;
if (str == null) {
measureText = 0.0f;
} else {
measureText = textPaint.measureText((CharSequence) str, 0, str.length());
}
this.f11816c = measureText;
if (str != null) {
f = Math.abs(textPaint.getFontMetrics().ascent);
}
this.d = f;
this.e = false;
}
public final void c(TextAppearance textAppearance, Context context) {
if (this.g != textAppearance) {
this.g = textAppearance;
if (textAppearance != null) {
TextPaint textPaint = this.f11815a;
TextAppearanceFontCallback textAppearanceFontCallback = this.b;
textAppearance.e(context, textPaint, textAppearanceFontCallback);
TextDrawableDelegate textDrawableDelegate = (TextDrawableDelegate) this.f.get();
if (textDrawableDelegate != null) {
textPaint.drawableState = textDrawableDelegate.getState();
}
textAppearance.d(context, textPaint, textAppearanceFontCallback);
this.e = true;
}
TextDrawableDelegate textDrawableDelegate2 = (TextDrawableDelegate) this.f.get();
if (textDrawableDelegate2 != null) {
textDrawableDelegate2.a();
textDrawableDelegate2.onStateChange(textDrawableDelegate2.getState());
}
}
}
}