From 98afb9859ec5685a94ab372a7e8c1ee1c1b5f41e Mon Sep 17 00:00:00 2001 From: klxiaoniu Date: Wed, 19 Jul 2023 08:19:13 +0800 Subject: [PATCH] fix: PttForwardHook for multiuser and optimize dialog --- .../java/cc/ioctl/hook/msg/PttForwardHook.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java b/app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java index 9d96bf4c34..d0d2ab8f77 100644 --- a/app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java +++ b/app/src/main/java/cc/ioctl/hook/msg/PttForwardHook.java @@ -126,6 +126,7 @@ private PttForwardHook() { super(SyncUtils.PROC_MAIN, new DexKitTarget[]{CFaceDe.INSTANCE, CDialogUtil.INSTANCE, AbstractQQCustomMenuItem.INSTANCE}); } + @SuppressLint("SetTextI18n") private static void showSavePttFileDialog(Activity activity, final File ptt) { Context ctx = CommonContextWrapper.createAppCompatContext(activity); final EditText editText = new EditText(ctx); @@ -352,15 +353,15 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { heads.setPadding(pd / 2, pd / 2, pd / 2, pd / 2); TextView ni = new TextView(ctx); ni.setText(cd.nick); - ni.setTextColor(0xFF000000); + ni.setTextColor(HostStyledViewBuilder.getColorSkinBlack()); ni.setPadding(pd, 0, 0, 0); - ni.setTextSize(dip2sp(ctx, 18)); + ni.setTextSize(dip2sp(ctx, 17)); heads.addView(imgview, imglp); heads.addView(ni); } CustomDialog dialog = CustomDialog.create(ctx); final Activity finalCtx = ctx; - dialog.setPositiveButton("确认", (dialog1, which) -> { + dialog.setPositiveButton("发送", (dialog1, which) -> { try { for (ContactDescriptor cd : mTargets) { Parcelable sesssion = SessionInfoImpl.createSessionInfo(cd.uin, cd.uinType); @@ -378,7 +379,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { finalCtx.finish(); }); dialog.setNegativeButton("取消", null); - dialog.setCancelable(true); + dialog.setCancelable(false); dialog.setView(main); dialog.setTitle("发送给"); dialog.show(); @@ -500,11 +501,9 @@ private File getPttFileByMsgNt(Object msg) { } PttElement element = (PttElement) getElement.invoke(msg); String filename = element.getFileName(); - String filePath = - "/storage/emulated/0/Android/data/com.tencent.mobileqq/Tencent/MobileQQ/" + AppRuntimeHelper.getAccount() + "/ptt/" + filename; - // 严谨性有待考证 - File file = new File(filePath); - return file; + String filePath = cc.ioctl.util.HostInfo.getApplication().getExternalFilesDir(null).getParent() + + "/Tencent/MobileQQ/" + AppRuntimeHelper.getAccount() + "/ptt/" + filename; + return new File(filePath); } catch (Throwable e) { traceError(e); return new File("");