soul-browser/sources/java/com/mycompany/app/help/KeyHelper.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

148 lines
6.8 KiB
Java

package com.mycompany.app.help;
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewTreeObserver;
import com.mycompany.app.main.MainUtil;
import com.mycompany.app.pref.PrefMain;
/* loaded from: classes3.dex */
public class KeyHelper {
/* renamed from: a, reason: collision with root package name */
public final int f15716a;
public KeyHelperListener b;
/* renamed from: c, reason: collision with root package name */
public View f15717c;
public View d;
public boolean e;
public boolean f;
public int g;
public int h;
public boolean i;
/* loaded from: classes3.dex */
public interface KeyHelperListener {
void a();
void b(boolean z);
}
public KeyHelper(Context context, View view, boolean z, boolean z2, KeyHelperListener keyHelperListener) {
if (view != null) {
this.d = view;
this.e = z;
this.f = z2;
this.b = keyHelperListener;
this.g = view.getHeight();
this.f15716a = (int) MainUtil.G(context, 100.0f);
this.d.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // from class: com.mycompany.app.help.KeyHelper.1
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public final void onGlobalLayout() {
KeyHelper keyHelper = KeyHelper.this;
View view2 = keyHelper.d;
if (view2 != null) {
if (keyHelper.e && keyHelper.f) {
int height = view2.getHeight();
if (keyHelper.g == height) {
return;
} else {
keyHelper.g = height;
}
}
keyHelper.d.postDelayed(new Runnable() { // from class: com.mycompany.app.help.KeyHelper.1.1
@Override // java.lang.Runnable
public final void run() {
int i;
View view3;
KeyHelper keyHelper2 = KeyHelper.this;
View view4 = keyHelper2.d;
if (view4 != null) {
if (keyHelper2.f15717c == null) {
keyHelper2.f15717c = view4.getRootView();
if (keyHelper2.f15717c == null) {
return;
}
}
Rect rect = new Rect();
keyHelper2.f15717c.getWindowVisibleDisplayFrame(rect);
int height2 = keyHelper2.f15717c.getHeight() - rect.bottom;
if (keyHelper2.h != height2) {
keyHelper2.h = height2;
if (height2 > keyHelper2.f15716a) {
if (!keyHelper2.i) {
keyHelper2.i = true;
KeyHelperListener keyHelperListener2 = keyHelper2.b;
if (keyHelperListener2 != null) {
keyHelperListener2.b(true);
}
} else {
KeyHelperListener keyHelperListener3 = keyHelper2.b;
if (keyHelperListener3 != null) {
keyHelperListener3.a();
}
}
if (keyHelper2.a()) {
int i2 = keyHelper2.h;
if (!keyHelper2.f || (view3 = keyHelper2.d) == null || view3.getWidth() >= keyHelper2.d.getHeight()) {
i = 0;
} else {
i = PrefMain.w;
}
int i3 = i2 - i;
if (keyHelper2.d.getPaddingBottom() != i3) {
keyHelper2.d.setPadding(0, 0, 0, i3);
return;
}
return;
}
return;
}
if (keyHelper2.i) {
keyHelper2.i = false;
KeyHelperListener keyHelperListener4 = keyHelper2.b;
if (keyHelperListener4 != null) {
keyHelperListener4.b(false);
}
} else {
KeyHelperListener keyHelperListener5 = keyHelper2.b;
if (keyHelperListener5 != null) {
keyHelperListener5.a();
}
}
if (keyHelper2.a() && keyHelper2.d.getPaddingBottom() != 0) {
keyHelper2.d.setPadding(0, 0, 0, 0);
}
}
}
}
}, 400L);
}
}
});
}
}
public final boolean a() {
if (Build.VERSION.SDK_INT < 30) {
if (!this.e || !this.f) {
return true;
}
return false;
}
return !this.e;
}
public final void b(boolean z, boolean z2) {
if (this.e != z || this.f != z2) {
this.e = z;
this.f = z2;
if (this.d != null && !a() && this.d.getPaddingBottom() != 0) {
this.d.setPadding(0, 0, 0, 0);
}
}
}
}