Skip to content

Commit

Permalink
fix: RepeaterPlus DoubleClick for QQ 8.9.63
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu committed Jun 30, 2023
1 parent ef06df1 commit 470d2aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public RepeaterPlusIconSettingDialog(Context context) {

// temporary
if (HostInfo.requireMinQQVersion(QQVersion.QQ_8_9_63)) {
check_double_click.setEnabled(false);
check_showUpper.setEnabled(false);
check_showInMenu.setEnabled(false);
}
Expand Down
28 changes: 21 additions & 7 deletions app/src/main/java/cc/hicore/hook/RepeaterPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,8 @@ public Function2<IUiItemAgent, Context, String[]> getExtraSearchKeywordProvider(
@Override
public Function3<IUiItemAgent, Activity, View, Unit> getOnClickListener() {
return (agent, activity, view) -> {
// temporary
// if (HostInfo.requireMinQQVersion(QQVersion.QQ_8_9_63)) {
// Toasts.info(activity, "当前QQ版本暂不支持自定义");
// } else {
RepeaterPlusIconSettingDialog dialog = new RepeaterPlusIconSettingDialog(activity);
dialog.show();
//}
RepeaterPlusIconSettingDialog dialog = new RepeaterPlusIconSettingDialog(activity);
dialog.show();
return Unit.INSTANCE;
};
}
Expand Down Expand Up @@ -164,6 +159,7 @@ public boolean initOnce() throws Exception {
// temporary
XC_MethodHook callback = new XC_MethodHook() {
private ImageView img;
private volatile long click_time = 0;
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
ImageView imageView;
Expand All @@ -177,6 +173,24 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
if (img.getContext().getClass().getName().contains("MultiForwardActivity")) {
return;
}
if (RepeaterPlusIconSettingDialog.getIsDoubleClick()) {
img.setOnClickListener(v -> {
try {
if (System.currentTimeMillis() - 200 > click_time) {
return;
}
} finally {
click_time = System.currentTimeMillis();
}
try {
Object a = Initiator.loadClass("com.tencent.mobileqq.aio.msglist.holder.component.msgfollow.a")
.getDeclaredConstructor(param.thisObject.getClass()).newInstance(param.thisObject);
a.getClass().getMethod("onClick", View.class).invoke(a, v);
} catch (Exception e) {
Log.e(e);
}
});
}
imageView.setVisibility(0);
}
}
Expand Down

0 comments on commit 470d2aa

Please sign in to comment.