Skip to content

Commit 9703b50

Browse files
authored
Merge pull request #1225 from ferredoxin/qwq233-patch-3
feat: CheckCommonGroup
2 parents 8ecc81f + b2cf22f commit 9703b50

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* QNotified - An Xposed module for QQ/TIM
3+
* Copyright (C) 2019-2022 [email protected]
4+
* https://github.com/ferredoxin/QNotified
5+
*
6+
* This software is non-free but opensource software: you can redistribute it
7+
* and/or modify it under the terms of the GNU Affero General Public License
8+
* as published by the Free Software Foundation; either
9+
* version 3 of the License, or any later version and our eula as published
10+
* by ferredoxin.
11+
*
12+
* This software is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License
18+
* and eula along with this software. If not, see
19+
* <https://www.gnu.org/licenses/>
20+
* <https://github.com/ferredoxin/QNotified/blob/master/LICENSE.md>.
21+
*/
22+
23+
package cc.ioctl.hook;
24+
25+
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
26+
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
27+
import static nil.nadph.qnotified.ui.ViewBuilder.newLinearLayoutParams;
28+
import static nil.nadph.qnotified.util.Utils.dip2px;
29+
30+
import android.app.AlertDialog;
31+
import android.content.Context;
32+
import android.content.Intent;
33+
import android.widget.EditText;
34+
import android.widget.LinearLayout;
35+
import androidx.core.view.ViewCompat;
36+
import nil.nadph.qnotified.ui.CustomDialog;
37+
import nil.nadph.qnotified.ui.drawable.HighContrastBorder;
38+
import nil.nadph.qnotified.util.Toasts;
39+
40+
public class CheckCommonGroup {
41+
42+
public static void onClick(Context ctx) {
43+
CustomDialog dialog = CustomDialog.createFailsafe(ctx);
44+
EditText editText = new EditText(ctx);
45+
editText.setTextSize(16);
46+
int _5 = dip2px(ctx, 5);
47+
editText.setPadding(_5, _5, _5, _5);
48+
ViewCompat.setBackground(editText, new HighContrastBorder());
49+
LinearLayout linearLayout = new LinearLayout(ctx);
50+
linearLayout
51+
.addView(editText, newLinearLayoutParams(MATCH_PARENT, WRAP_CONTENT, _5 * 2));
52+
AlertDialog alertDialog = (AlertDialog) dialog.setTitle("输入对方QQ号")
53+
.setView(linearLayout)
54+
.setCancelable(true)
55+
.setPositiveButton("打开QQ号", null)
56+
.setNegativeButton("取消", null)
57+
.create();
58+
alertDialog.show();
59+
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE)
60+
.setOnClickListener(v -> {
61+
String text = editText.getText().toString();
62+
if (text.equals("")) {
63+
Toasts.error(ctx, "请输入QQ号");
64+
return;
65+
}
66+
long uin = 0;
67+
try {
68+
uin = Long.parseLong(text);
69+
} catch (NumberFormatException ignored) {
70+
}
71+
if (uin < 10000) {
72+
Toasts.error(ctx, "请输入有效的QQ号");
73+
return;
74+
}
75+
alertDialog.dismiss();
76+
Class<?> browser = null;
77+
try {
78+
browser = Class
79+
.forName("com.tencent.mobileqq.activity.QQBrowserDelegationActivity");
80+
Intent intent = new Intent(ctx, browser);
81+
intent.putExtra("fling_action_key", 2);
82+
intent.putExtra("fling_code_key", ctx.hashCode());
83+
intent.putExtra("useDefBackText", true);
84+
intent.putExtra("param_force_internal_browser", true);
85+
intent.putExtra("url", "https://ti.qq.com/friends/recall?uin=" + uin);
86+
ctx.startActivity(intent);
87+
} catch (ClassNotFoundException e) {
88+
e.printStackTrace();
89+
}
90+
});
91+
}
92+
93+
}

app/src/main/java/me/singleneuron/qn_kernel/ui/fragment/Others.kt

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import cc.ioctl.activity.ExfriendListActivity
2626
import cc.ioctl.activity.FriendlistExportActivity
2727
import cc.ioctl.dialog.RepeaterIconSettingDialog
2828
import cc.ioctl.hook.AddAccount
29+
import cc.ioctl.hook.CheckCommonGroup
2930
import cc.ioctl.hook.OpenProfileCard
3031
import me.singleneuron.qn_kernel.ui.gen.getAnnotatedUiItemClassList
3132
import nil.nadph.qnotified.activity.BetaTestFuncActivity
@@ -64,6 +65,14 @@ val Others = uiScreen {
6465
true
6566
}
6667
},
68+
uiClickableItem {
69+
title = "查看共同群聊"
70+
summary = "查看指定用户与你的共同群聊 无需为好友"
71+
onClickListener = {
72+
CheckCommonGroup.onClick(it)
73+
true
74+
}
75+
},
6776
uiClickableItem {
6877
title = "历史好友"
6978
onClickListener = ClickToActivity(ExfriendListActivity::class.java)

0 commit comments

Comments
 (0)