soul-browser/sources/java/androidx/appcompat/view/menu/ListMenuItemView.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

297 lines
11 KiB
Java

package androidx.appcompat.view.menu;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.view.menu.MenuView;
import androidx.appcompat.widget.TintTypedArray;
@RestrictTo
/* loaded from: classes.dex */
public class ListMenuItemView extends LinearLayout implements MenuView.ItemView, AbsListView.SelectionBoundsAdjuster {
/* renamed from: c, reason: collision with root package name */
public MenuItemImpl f172c;
public ImageView f;
public RadioButton g;
public TextView h;
public CheckBox i;
public TextView j;
public ImageView k;
public ImageView l;
public LinearLayout m;
public final Drawable n;
public final int o;
public final Context p;
public boolean q;
public final Drawable r;
public final boolean s;
public LayoutInflater t;
public boolean u;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ListMenuItemView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
int i = R.attr.listMenuViewStyle;
TintTypedArray e = TintTypedArray.e(getContext(), attributeSet, R.styleable.MenuView, i);
this.n = e.b(R.styleable.MenuView_android_itemBackground);
int i2 = R.styleable.MenuView_android_itemTextAppearance;
TypedArray typedArray = e.b;
this.o = typedArray.getResourceId(i2, -1);
this.q = typedArray.getBoolean(R.styleable.MenuView_preserveIconSpacing, false);
this.p = context;
this.r = e.b(R.styleable.MenuView_subMenuArrow);
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, new int[]{android.R.attr.divider}, R.attr.dropDownListViewStyle, 0);
this.s = obtainStyledAttributes.hasValue(0);
e.f();
obtainStyledAttributes.recycle();
}
private LayoutInflater getInflater() {
if (this.t == null) {
this.t = LayoutInflater.from(getContext());
}
return this.t;
}
private void setSubMenuArrowVisible(boolean z) {
int i;
ImageView imageView = this.k;
if (imageView != null) {
if (z) {
i = 0;
} else {
i = 8;
}
imageView.setVisibility(i);
}
}
@Override // android.widget.AbsListView.SelectionBoundsAdjuster
public final void adjustListItemSelectionBounds(Rect rect) {
ImageView imageView = this.l;
if (imageView != null && imageView.getVisibility() == 0) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.l.getLayoutParams();
rect.top = this.l.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin + rect.top;
}
}
/* JADX WARN: Code restructure failed: missing block: B:20:0x0055, code lost:
if (r0 == false) goto L28;
*/
/* JADX WARN: Removed duplicated region for block: B:13:0x003b */
/* JADX WARN: Removed duplicated region for block: B:22:0x005b */
/* JADX WARN: Removed duplicated region for block: B:49:0x0111 */
@Override // androidx.appcompat.view.menu.MenuView.ItemView
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void c(androidx.appcompat.view.menu.MenuItemImpl r11) {
/*
Method dump skipped, instructions count: 305
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.menu.ListMenuItemView.c(androidx.appcompat.view.menu.MenuItemImpl):void");
}
@Override // androidx.appcompat.view.menu.MenuView.ItemView
public MenuItemImpl getItemData() {
return this.f172c;
}
@Override // android.view.View
public final void onFinishInflate() {
super.onFinishInflate();
setBackground(this.n);
TextView textView = (TextView) findViewById(R.id.title);
this.h = textView;
int i = this.o;
if (i != -1) {
textView.setTextAppearance(this.p, i);
}
this.j = (TextView) findViewById(R.id.shortcut);
ImageView imageView = (ImageView) findViewById(R.id.submenuarrow);
this.k = imageView;
if (imageView != null) {
imageView.setImageDrawable(this.r);
}
this.l = (ImageView) findViewById(R.id.group_divider);
this.m = (LinearLayout) findViewById(R.id.content);
}
@Override // android.widget.LinearLayout, android.view.View
public final void onMeasure(int i, int i2) {
if (this.f != null && this.q) {
ViewGroup.LayoutParams layoutParams = getLayoutParams();
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.f.getLayoutParams();
int i3 = layoutParams.height;
if (i3 > 0 && layoutParams2.width <= 0) {
layoutParams2.width = i3;
}
}
super.onMeasure(i, i2);
}
public void setCheckable(boolean z) {
CompoundButton compoundButton;
View view;
if (z || this.g != null || this.i != null) {
if ((this.f172c.x & 4) != 0) {
if (this.g == null) {
RadioButton radioButton = (RadioButton) getInflater().inflate(R.layout.abc_list_menu_item_radio, (ViewGroup) this, false);
this.g = radioButton;
LinearLayout linearLayout = this.m;
if (linearLayout != null) {
linearLayout.addView(radioButton, -1);
} else {
addView(radioButton, -1);
}
}
compoundButton = this.g;
view = this.i;
} else {
if (this.i == null) {
CheckBox checkBox = (CheckBox) getInflater().inflate(R.layout.abc_list_menu_item_checkbox, (ViewGroup) this, false);
this.i = checkBox;
LinearLayout linearLayout2 = this.m;
if (linearLayout2 != null) {
linearLayout2.addView(checkBox, -1);
} else {
addView(checkBox, -1);
}
}
compoundButton = this.i;
view = this.g;
}
if (z) {
compoundButton.setChecked(this.f172c.isChecked());
if (compoundButton.getVisibility() != 0) {
compoundButton.setVisibility(0);
}
if (view != null && view.getVisibility() != 8) {
view.setVisibility(8);
return;
}
return;
}
CheckBox checkBox2 = this.i;
if (checkBox2 != null) {
checkBox2.setVisibility(8);
}
RadioButton radioButton2 = this.g;
if (radioButton2 != null) {
radioButton2.setVisibility(8);
}
}
}
public void setChecked(boolean z) {
CompoundButton compoundButton;
if ((this.f172c.x & 4) != 0) {
if (this.g == null) {
RadioButton radioButton = (RadioButton) getInflater().inflate(R.layout.abc_list_menu_item_radio, (ViewGroup) this, false);
this.g = radioButton;
LinearLayout linearLayout = this.m;
if (linearLayout != null) {
linearLayout.addView(radioButton, -1);
} else {
addView(radioButton, -1);
}
}
compoundButton = this.g;
} else {
if (this.i == null) {
CheckBox checkBox = (CheckBox) getInflater().inflate(R.layout.abc_list_menu_item_checkbox, (ViewGroup) this, false);
this.i = checkBox;
LinearLayout linearLayout2 = this.m;
if (linearLayout2 != null) {
linearLayout2.addView(checkBox, -1);
} else {
addView(checkBox, -1);
}
}
compoundButton = this.i;
}
compoundButton.setChecked(z);
}
public void setForceShowIcon(boolean z) {
this.u = z;
this.q = z;
}
public void setGroupDividerEnabled(boolean z) {
int i;
ImageView imageView = this.l;
if (imageView != null) {
if (!this.s && z) {
i = 0;
} else {
i = 8;
}
imageView.setVisibility(i);
}
}
public void setIcon(Drawable drawable) {
MenuBuilder menuBuilder = this.f172c.n;
boolean z = this.u;
if (z || this.q) {
ImageView imageView = this.f;
if (imageView != null || drawable != null || this.q) {
if (imageView == null) {
ImageView imageView2 = (ImageView) getInflater().inflate(R.layout.abc_list_menu_item_icon, (ViewGroup) this, false);
this.f = imageView2;
LinearLayout linearLayout = this.m;
if (linearLayout != null) {
linearLayout.addView(imageView2, 0);
} else {
addView(imageView2, 0);
}
}
if (drawable == null && !this.q) {
this.f.setVisibility(8);
return;
}
ImageView imageView3 = this.f;
if (!z) {
drawable = null;
}
imageView3.setImageDrawable(drawable);
if (this.f.getVisibility() != 0) {
this.f.setVisibility(0);
}
}
}
}
public void setTitle(CharSequence charSequence) {
if (charSequence != null) {
this.h.setText(charSequence);
if (this.h.getVisibility() != 0) {
this.h.setVisibility(0);
return;
}
return;
}
if (this.h.getVisibility() != 8) {
this.h.setVisibility(8);
}
}
}