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

220 lines
7.3 KiB
Java

package com.mycompany.app.quick;
import android.graphics.Canvas;
import android.view.View;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mycompany.app.main.MainApp;
import com.mycompany.app.main.MainUtil;
import com.mycompany.app.quick.QuickAdapter;
/* loaded from: classes3.dex */
public class QuickDragHelper extends ItemTouchHelper.Callback {
public QuickDragListener d;
public final boolean e;
public final int f;
public QuickSubView g;
public View h;
public int i;
public int j;
public boolean k;
/* loaded from: classes3.dex */
public interface QuickDragListener {
void a(int i);
boolean b(int i, int i2);
void c(int i, int i2);
}
public QuickDragHelper(QuickSubView quickSubView, QuickDragListener quickDragListener) {
if (quickSubView != null) {
this.g = quickSubView;
} else {
this.e = true;
this.f = MainApp.E1;
}
this.d = quickDragListener;
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void a(RecyclerView.ViewHolder viewHolder) {
View view;
int c2;
if (this.e && this.j == -1 && (view = this.h) != null && viewHolder != null && view.equals(viewHolder.f1589a) && this.i != (c2 = viewHolder.c())) {
this.j = c2;
}
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void b(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
QuickAdapter.QuickHolder quickHolder;
View view;
o();
this.i = -1;
this.j = -1;
this.k = false;
super.b(recyclerView, viewHolder);
if ((viewHolder instanceof QuickAdapter.QuickHolder) && (view = (quickHolder = (QuickAdapter.QuickHolder) viewHolder).f1589a) != null) {
view.setBackgroundResource(quickHolder.C);
}
QuickSubView quickSubView = this.g;
if (quickSubView != null) {
quickSubView.N = false;
quickSubView.e();
quickSubView.invalidate();
}
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final int e() {
return this.f;
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final int f() {
return ItemTouchHelper.Callback.j(15, 0);
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final boolean h() {
return false;
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final boolean i() {
return false;
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void k(Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float f, float f2, int i, boolean z) {
Object tag;
View view;
if (this.k) {
return;
}
if (!z) {
super.k(canvas, recyclerView, viewHolder, f, f2, i, z);
return;
}
if (i == 2 && this.e) {
View view2 = viewHolder.f1589a;
int i2 = (int) f;
int i3 = (int) f2;
if (view2 != null) {
int width = view2.getWidth();
int height = view2.getHeight();
int left = (width / 2) + view2.getLeft() + i2;
int top = (height / 2) + view2.getTop() + i3;
int childCount = recyclerView.getChildCount();
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = recyclerView.getChildAt(i4);
if (childAt != null && !childAt.equals(view2)) {
int left2 = childAt.getLeft();
int top2 = childAt.getTop();
int i5 = left2 + width;
int i6 = top2 + height;
if (left > left2 && left < i5 && top > top2 && top < i6 && (tag = childAt.getTag()) != null && (tag instanceof QuickAdapter.QuickHolder) && ((QuickAdapter.QuickHolder) tag).v == 0) {
view = childAt;
break;
}
}
}
}
view = null;
if (view == null) {
o();
this.j = -1;
} else {
View view3 = this.h;
if (view3 == null || !view.equals(view3)) {
o();
this.j = -1;
this.h = view;
view.setScaleX(1.2f);
this.h.setScaleY(1.2f);
}
}
}
super.k(canvas, recyclerView, viewHolder, f, f2, i, z);
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void l(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2) {
if (this.d != null) {
int c2 = viewHolder2.c();
if (this.d.b(viewHolder.c(), c2)) {
o();
this.i = c2;
this.j = -1;
this.k = false;
QuickSubView quickSubView = this.g;
if (quickSubView != null) {
quickSubView.setDragPos(c2);
}
}
}
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void m(RecyclerView.ViewHolder viewHolder, int i) {
int i2;
View view;
if (i == 1) {
this.k = false;
} else if (i == 2) {
this.k = false;
if (viewHolder != null) {
this.i = viewHolder.c();
if ((viewHolder instanceof QuickAdapter.QuickHolder) && (view = ((QuickAdapter.QuickHolder) viewHolder).f1589a) != null) {
view.setBackground(null);
}
QuickSubView quickSubView = this.g;
if (quickSubView != null) {
View view2 = viewHolder.f1589a;
int i3 = this.i;
if (view2 != null) {
quickSubView.e();
quickSubView.J = view2;
quickSubView.K = i3;
quickSubView.I = true;
MainUtil.l7(view2);
}
}
}
} else if (i == 0) {
if (this.h != null) {
o();
int i4 = this.i;
if (i4 != -1 && (i2 = this.j) != -1 && i4 != i2) {
this.k = true;
QuickDragListener quickDragListener = this.d;
if (quickDragListener != null) {
quickDragListener.c(i4, i2);
}
}
}
this.i = -1;
this.j = -1;
}
QuickDragListener quickDragListener2 = this.d;
if (quickDragListener2 != null) {
quickDragListener2.a(i);
}
}
public final void o() {
View view = this.h;
if (view == null) {
return;
}
view.setScaleX(1.0f);
this.h.setScaleY(1.0f);
this.h = null;
}
@Override // androidx.recyclerview.widget.ItemTouchHelper.Callback
public final void n() {
}
}