From 3744211ff1c84a4238327f4b206c3bddd8e8f104 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 9 Oct 2024 23:45:21 +0800 Subject: [PATCH] UI finsihed --- app/build.gradle | 4 +- .../im/hoho/alipayInstallB/MainActivity.java | 68 +++++++++++++++++-- .../im/hoho/alipayInstallB/PluginMain.java | 9 ++- app/src/main/res/layout/activity_main.xml | 46 ++++++++++++- 4 files changed, 117 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d266687..4f10d62 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "im.hoho.alipayInstallB" minSdkVersion 23 targetSdkVersion 33 - versionCode 103 - versionName "2.5.1" + versionCode 105 + versionName "2.5.3" // testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } namespace 'im.hoho.alipayInstallB' diff --git a/app/src/main/java/im/hoho/alipayInstallB/MainActivity.java b/app/src/main/java/im/hoho/alipayInstallB/MainActivity.java index 010261a..3a84501 100644 --- a/app/src/main/java/im/hoho/alipayInstallB/MainActivity.java +++ b/app/src/main/java/im/hoho/alipayInstallB/MainActivity.java @@ -2,8 +2,10 @@ import android.Manifest; import android.app.Activity; +import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.PackageManager; +import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -22,11 +24,8 @@ import net.lingala.zip4j.exception.ZipException; import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; @@ -50,7 +49,7 @@ public class MainActivity extends Activity { private ProgressBar progressBar; private ExecutorService executorService; private Handler mainHandler; - +// private TextView tvPluginStatus; @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { @@ -64,12 +63,21 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in } } } +// +// @Override +// protected void onResume() { +// super.onResume(); +// updatePluginStatus(); +// } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); +// tvPluginStatus = findViewById(R.id.tvPluginStatus); +// updatePluginStatus(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (!Environment.isExternalStorageManager()) { Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); @@ -116,6 +124,49 @@ public void onClick(View v) { } }); + Button btnOpenResourceFolder = findViewById(R.id.btnOpenResourceFolder); + TextView tvGithubLink = findViewById(R.id.tvGithubLink); + + btnOpenResourceFolder.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + File resourceFolder = new File(EXTRACT_PATH + "000_HOHO_ALIPAY_SKIN"); + if (resourceFolder.exists() && resourceFolder.isDirectory()) { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + Uri uri = Uri.parse(resourceFolder.getAbsolutePath()); + intent.setDataAndType(uri, "*/*"); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); + + try { + startActivity(Intent.createChooser(intent, "选择文件浏览器")); + } catch (ActivityNotFoundException e) { + // 如果没有找到文件管理器应用,尝试使用 ACTION_VIEW + intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(uri, "resource/folder"); + + if (intent.resolveActivityInfo(getPackageManager(), 0) != null) { + startActivity(intent); + } else { + Toast.makeText(MainActivity.this, "没有找到文件浏览器应用", Toast.LENGTH_SHORT).show(); + } + } + } else { + Toast.makeText(MainActivity.this, "Resource package not installed", Toast.LENGTH_SHORT).show(); + } + } + }); + + tvGithubLink.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String url = "https://github.com/nov30th/AlipayHighHeadsomeRichAndroid"; + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(url)); + startActivity(intent); + } + }); + } private void setupButtons() { @@ -163,6 +214,13 @@ private void toggleFile(String filePath) { Toast.makeText(this, "Reopen payment code to take effect", Toast.LENGTH_SHORT).show(); } + @Override + protected void onResume() { + super.onResume(); + updateStatuses(); + updateDownloadButtonText(); + } + private void updateStatuses() { updateStatus(ivExportStatus, EXPORT_FILE); updateStatus(ivDeleteStatus, DELETE_FILE); @@ -178,7 +236,7 @@ private void updateStatus(ImageView imageView, String filePath) { private void updateDownloadButtonText() { File skinFolder = new File(EXTRACT_PATH + "000_HOHO_ALIPAY_SKIN"); - btnDownload.setText(skinFolder.exists() ? "Redownload Resources" : "Download Resources"); + btnDownload.setText(skinFolder.exists() ? "Redownload Resources (GITHUB)" : "Download Resources (GITHUB)"); } private void downloadAndExtract() { diff --git a/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java b/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java index 02a097b..86985c1 100644 --- a/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java +++ b/app/src/main/java/im/hoho/alipayInstallB/PluginMain.java @@ -1,6 +1,7 @@ package im.hoho.alipayInstallB; import android.content.Context; +import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.os.Environment; @@ -18,6 +19,7 @@ import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.XC_MethodHook; +import de.robv.android.xposed.XSharedPreferences; import de.robv.android.xposed.XposedBridge; import de.robv.android.xposed.XposedHelpers; import de.robv.android.xposed.callbacks.XC_LoadPackage; @@ -26,13 +28,15 @@ * Created by qzj_ on 2016/5/9. */ public class PluginMain implements IXposedHookLoadPackage { + public static volatile boolean isModuleLoaded = false; private static final String packageName = "com.eg.android.AlipayGphone"; - public PluginMain() { XposedBridge.log("Now Loading HOHO`` alipay plugin..."); } + + @Override public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { @@ -41,6 +45,9 @@ public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) thr XposedBridge.log("Powered by HOHO`` 20230927 杭州亚运会版 sd source changed 20231129"); final boolean[] isDbUpdated = {false}; + // 设置插件已加载状态 + isModuleLoaded = true; + XposedHelpers.findAndHookMethod("com.alipay.mobilegw.biz.shared.processer.login.UserLoginResult", lpparam.classLoader, "getExtResAttrs", new XC_MethodHook() { protected void afterHookedMethod(MethodHookParam param1MethodHookParam) throws Throwable { XposedBridge.log("Now, let's install B..."); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a3ff29c..fdd50ce 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -5,14 +5,30 @@ android:orientation="vertical" android:padding="16dp"> + + + + + android:text="Download Resources (Github)" /> + +