soul-browser/sources/java/com/google/android/material/appbar/HeaderScrollingViewBehavior.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

116 lines
4.5 KiB
Java

package com.google.android.material.appbar;
import android.graphics.Rect;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.math.MathUtils;
import androidx.core.view.WindowInsetsCompat;
import com.google.android.material.search.SearchBar;
import java.util.ArrayList;
import kotlin.jvm.internal.IntCompanionObject;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public abstract class HeaderScrollingViewBehavior extends ViewOffsetBehavior<View> {
public final Rect g;
public final Rect h;
public int i;
public int j;
public HeaderScrollingViewBehavior() {
this.g = new Rect();
this.h = new Rect();
this.i = 0;
}
@Override // com.google.android.material.appbar.ViewOffsetBehavior
public final void A(CoordinatorLayout coordinatorLayout, View view, int i) {
AppBarLayout C = C(coordinatorLayout.d(view));
int i2 = 0;
if (C != null) {
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) view.getLayoutParams();
int paddingLeft = coordinatorLayout.getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
int bottom = C.getBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin;
int width = (coordinatorLayout.getWidth() - coordinatorLayout.getPaddingRight()) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
int bottom2 = ((C.getBottom() + coordinatorLayout.getHeight()) - coordinatorLayout.getPaddingBottom()) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
Rect rect = this.g;
rect.set(paddingLeft, bottom, width, bottom2);
WindowInsetsCompat lastWindowInsets = coordinatorLayout.getLastWindowInsets();
if (lastWindowInsets != null && coordinatorLayout.getFitsSystemWindows() && !view.getFitsSystemWindows()) {
rect.left = lastWindowInsets.g() + rect.left;
rect.right -= lastWindowInsets.h();
}
int i3 = layoutParams.f611c;
if (i3 == 0) {
i3 = 8388659;
}
int measuredWidth = view.getMeasuredWidth();
int measuredHeight = view.getMeasuredHeight();
Rect rect2 = this.h;
Gravity.apply(i3, measuredWidth, measuredHeight, rect, rect2, i);
if (this.j != 0) {
float D = D(C);
int i4 = this.j;
i2 = MathUtils.b((int) (D * i4), 0, i4);
}
view.layout(rect2.left, rect2.top - i2, rect2.right, rect2.bottom - i2);
this.i = rect2.top - C.getBottom();
return;
}
coordinatorLayout.q(view, i);
this.i = 0;
}
public abstract AppBarLayout C(ArrayList arrayList);
public float D(View view) {
return 1.0f;
}
public int E(View view) {
return view.getMeasuredHeight();
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
public boolean o(CoordinatorLayout coordinatorLayout, View view, int i, int i2, int i3) {
AppBarLayout C;
int i4;
WindowInsetsCompat lastWindowInsets;
int i5 = view.getLayoutParams().height;
if ((i5 == -1 || i5 == -2) && (C = C(coordinatorLayout.d(view))) != null) {
int size = View.MeasureSpec.getSize(i3);
if (size > 0) {
if (C.getFitsSystemWindows() && (lastWindowInsets = coordinatorLayout.getLastWindowInsets()) != null) {
size += lastWindowInsets.f() + lastWindowInsets.i();
}
} else {
size = coordinatorLayout.getHeight();
}
int E = size + E(C);
int measuredHeight = C.getMeasuredHeight();
if (this instanceof SearchBar.ScrollingViewBehavior) {
view.setTranslationY(-measuredHeight);
} else {
view.setTranslationY(0.0f);
E -= measuredHeight;
}
if (i5 == -1) {
i4 = 1073741824;
} else {
i4 = IntCompanionObject.MIN_VALUE;
}
coordinatorLayout.r(i, i2, View.MeasureSpec.makeMeasureSpec(E, i4), view);
return true;
}
return false;
}
public HeaderScrollingViewBehavior(int i) {
super(0);
this.g = new Rect();
this.h = new Rect();
this.i = 0;
}
}