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

190 lines
6.2 KiB
Java

package com.google.android.material.internal;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.RestrictTo;
import com.google.android.material.R;
@RestrictTo
/* loaded from: classes3.dex */
public class FlowLayout extends ViewGroup {
/* renamed from: c, reason: collision with root package name */
public int f11811c;
public int f;
public boolean g;
public int h;
public boolean a() {
return this.g;
}
public int getItemSpacing() {
return this.f;
}
public int getLineSpacing() {
return this.f11811c;
}
public int getRowCount() {
return this.h;
}
@Override // android.view.ViewGroup, android.view.View
public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
boolean z2;
int paddingLeft;
int paddingRight;
int i5;
int i6;
boolean z3;
if (getChildCount() == 0) {
this.h = 0;
return;
}
boolean z4 = true;
this.h = 1;
if (getLayoutDirection() == 1) {
z2 = true;
} else {
z2 = false;
}
if (z2) {
paddingLeft = getPaddingRight();
} else {
paddingLeft = getPaddingLeft();
}
if (z2) {
paddingRight = getPaddingLeft();
} else {
paddingRight = getPaddingRight();
}
int paddingTop = getPaddingTop();
int i7 = 0;
int i8 = paddingLeft;
int i9 = paddingTop;
while (i7 < getChildCount()) {
View childAt = getChildAt(i7);
if (childAt.getVisibility() == 8) {
childAt.setTag(R.id.row_index_key, -1);
z3 = z4;
} else {
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
i6 = marginLayoutParams.getMarginStart();
i5 = marginLayoutParams.getMarginEnd();
} else {
i5 = 0;
i6 = 0;
}
int measuredWidth = childAt.getMeasuredWidth() + i8 + i6;
int i10 = i3 - i;
int i11 = i10 - paddingRight;
z3 = z4;
if (!this.g && measuredWidth > i11) {
measuredWidth = childAt.getMeasuredWidth() + paddingLeft + i6;
i9 = paddingTop + this.f11811c;
this.h++;
i8 = paddingLeft;
}
childAt.setTag(R.id.row_index_key, Integer.valueOf(this.h - 1));
int measuredHeight = childAt.getMeasuredHeight() + i9;
if (z2) {
childAt.layout(i10 - measuredWidth, i9, (i10 - i8) - i6, measuredHeight);
} else {
childAt.layout(i8 + i6, i9, measuredWidth, measuredHeight);
}
i8 += childAt.getMeasuredWidth() + i6 + i5 + this.f;
paddingTop = measuredHeight;
}
i7++;
z4 = z3;
}
}
@Override // android.view.View
public final void onMeasure(int i, int i2) {
int i3;
int i4;
int i5;
int i6;
int size = View.MeasureSpec.getSize(i);
int mode = View.MeasureSpec.getMode(i);
int size2 = View.MeasureSpec.getSize(i2);
int mode2 = View.MeasureSpec.getMode(i2);
if (mode != Integer.MIN_VALUE && mode != 1073741824) {
i3 = Integer.MAX_VALUE;
} else {
i3 = size;
}
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
int paddingRight = i3 - getPaddingRight();
int i7 = paddingTop;
int i8 = 0;
for (int i9 = 0; i9 < getChildCount(); i9++) {
View childAt = getChildAt(i9);
if (childAt.getVisibility() != 8) {
measureChild(childAt, i, i2);
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
i6 = marginLayoutParams.leftMargin;
i5 = marginLayoutParams.rightMargin;
} else {
i5 = 0;
i6 = 0;
}
int i10 = i5;
if (childAt.getMeasuredWidth() + paddingLeft + i6 > paddingRight && !a()) {
paddingLeft = getPaddingLeft();
i7 = paddingTop + this.f11811c;
}
int measuredWidth = childAt.getMeasuredWidth() + paddingLeft + i6;
int measuredHeight = childAt.getMeasuredHeight() + i7;
if (measuredWidth > i8) {
i8 = measuredWidth;
}
int measuredWidth2 = childAt.getMeasuredWidth() + i6 + i10 + this.f + paddingLeft;
if (i9 == getChildCount() - 1) {
i8 += i10;
}
paddingLeft = measuredWidth2;
paddingTop = measuredHeight;
}
}
int paddingRight2 = getPaddingRight() + i8;
int paddingBottom = getPaddingBottom() + paddingTop;
if (mode != Integer.MIN_VALUE) {
i4 = 1073741824;
if (mode != 1073741824) {
size = paddingRight2;
}
} else {
i4 = 1073741824;
size = Math.min(paddingRight2, size);
}
if (mode2 != Integer.MIN_VALUE) {
if (mode2 != i4) {
size2 = paddingBottom;
}
} else {
size2 = Math.min(paddingBottom, size2);
}
setMeasuredDimension(size, size2);
}
public void setItemSpacing(int i) {
this.f = i;
}
public void setLineSpacing(int i) {
this.f11811c = i;
}
public void setSingleLine(boolean z) {
this.g = z;
}
}