正在查看: 微商客 v2.1.2 应用的 WxAcceptGroupActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 微商客 v2.1.2 应用的 WxAcceptGroupActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.jianzhen.wsk.v1.activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.CompoundButton;
import com.auxiliary.library.core.NodeExecutor;
import com.auxiliary.library.node.IfNode;
import com.auxiliary.library.node.SelectNode;
import com.auxiliary.library.node.ViewNode;
import com.auxiliary.library.node.base.INode;
import com.auxiliary.library.service.AuxiliaryService;
import com.auxiliary.library.service.IAccessibility;
import com.auxiliary.library.util.ClassUtil;
import com.auxiliary.library.util.SettingUtil;
import com.auxiliary.library.util.ViewNodeUtil;
import com.auxiliary.library.widget.ExecutorWindow;
import com.jianzhen.wsk.R;
import com.jianzhen.wsk.databinding.ActivityWxAcceptGroupBinding;
import com.jianzhen.wsk.dialog.InteractTimeDialog;
import com.jianzhen.wsk.dialog.NumberRangeDialog;
import com.jianzhen.wsk.utils.ScriptLoadUtil;
import com.jianzhen.wsk.v1.VBaseActivity;
import com.jianzhen.wsk.v1.activity.WxAcceptGroupActivity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class WxAcceptGroupActivity extends VBaseActivity<ActivityWxAcceptGroupBinding> implements View.OnClickListener, InteractTimeDialog.OnCompleteListener, CompoundButton.OnCheckedChangeListener, NumberRangeDialog.OnRangeListener {
private InteractTimeDialog mDialog;
private NumberRangeDialog mDialog2;
private ExecutorWindow mExecutorWindow;
private final WxAcceptGroup mParam = new WxAcceptGroup();
private final String funcId = "10086";
public static class WxAcceptGroup {
public Integer addCount;
public List<String> adds;
public boolean extOperate;
public boolean fold;
public List<String> nicks;
public List<String> notAdds;
public boolean notDisturb;
public boolean saveBook;
public String targetName;
public String addRange = "0-500";
public String interactTime = "[5000,10000]";
}
@Override
public void initView(ActivityWxAcceptGroupBinding activityWxAcceptGroupBinding, Bundle bundle) {
activityWxAcceptGroupBinding.tvTitle.setText(R.string.accept_group);
this.mDialog = new InteractTimeDialog(this, this);
this.mDialog2 = new NumberRangeDialog(this, this);
}
@Override
public void initListener(ActivityWxAcceptGroupBinding activityWxAcceptGroupBinding, Bundle bundle) {
activityWxAcceptGroupBinding.tvMaxNum.setOnClickListener(this);
activityWxAcceptGroupBinding.tvStart.setOnClickListener(this);
activityWxAcceptGroupBinding.tvInteractTime.setOnClickListener(this);
activityWxAcceptGroupBinding.swGoGroup.setOnCheckedChangeListener(this);
activityWxAcceptGroupBinding.swNotGoGroup.setOnCheckedChangeListener(this);
}
@Override
public void onTimeComplete(String str, String str2) {
this.mParam.interactTime = str;
((ActivityWxAcceptGroupBinding) this.mViewBinding).tvInteractTime.setText(str2);
}
@Override
public void onRangeComplete(String str) {
((ActivityWxAcceptGroupBinding) this.mViewBinding).tvMaxNum.setText(str);
}
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
if (compoundButton == ((ActivityWxAcceptGroupBinding) this.mViewBinding).swGoGroup) {
((ActivityWxAcceptGroupBinding) this.mViewBinding).edGoGroup.setVisibility(z ? 0 : 8);
} else if (compoundButton == ((ActivityWxAcceptGroupBinding) this.mViewBinding).swNotGoGroup) {
((ActivityWxAcceptGroupBinding) this.mViewBinding).edNotGoGroup.setVisibility(z ? 0 : 8);
}
}
@Override
public void onClick(View view) {
InteractTimeDialog interactTimeDialog;
NumberRangeDialog numberRangeDialog;
if (view == ((ActivityWxAcceptGroupBinding) this.mViewBinding).tvMaxNum && (numberRangeDialog = this.mDialog2) != null) {
numberRangeDialog.show(this.mParam.addRange);
return;
}
if (view == ((ActivityWxAcceptGroupBinding) this.mViewBinding).tvInteractTime && (interactTimeDialog = this.mDialog) != null) {
interactTimeDialog.show(this.mParam.interactTime);
} else if (view == ((ActivityWxAcceptGroupBinding) this.mViewBinding).tvStart && setParam()) {
getFuncLimitWx("10086", true);
}
}
@Override
public void lambda$setNotYearVipTip$7() {
super.lambda$setNotYearVipTip$7();
try {
IAccessibility accessibility = AuxiliaryService.getAccessibility();
ExecutorWindow executorWindow = this.mExecutorWindow;
if (executorWindow != null) {
executorWindow.hideFloatWindow();
}
this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, "10086", "wx_accept_group");
Filter filter = new Filter(this.mExecutorWindow);
this.mExecutorWindow.setIFilter(filter);
this.mExecutorWindow.setIIf(filter);
this.mExecutorWindow.addStatusCallback(filter);
this.mExecutorWindow.setISelect(filter);
this.mExecutorWindow.setIProgress(filter);
this.mExecutorWindow.setArgs(this.mParam);
this.mExecutorWindow.showFloatWindow();
SettingUtil.startClearActivity(this, "com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
this.mExecutorWindow.addStatusCallback(new NodeExecutor.DefaultStatusCallback() {
public void onFinish(NodeExecutor nodeExecutor, boolean z) {
WxAcceptGroupActivity.this.mExecutorWindow.setMessage("操作完成!", true);
WxAcceptGroupActivity.this.addFuncLimitCountWithYearVip("10086");
super.onFinish(nodeExecutor, z);
}
});
} catch (Exception unused) {
showCenterToast("请先启动辅助服务");
}
}
private boolean setParam() {
String obj = ((ActivityWxAcceptGroupBinding) this.mViewBinding).edGoNum.getText().toString();
if (TextUtils.isEmpty(obj)) {
showCenterToast("进群数量不能为空");
return false;
}
this.mParam.notDisturb = ((ActivityWxAcceptGroupBinding) this.mViewBinding).swNotDisturb.isChecked();
this.mParam.fold = ((ActivityWxAcceptGroupBinding) this.mViewBinding).swFold.isChecked();
this.mParam.saveBook = ((ActivityWxAcceptGroupBinding) this.mViewBinding).swSaveBook.isChecked();
WxAcceptGroup wxAcceptGroup = this.mParam;
wxAcceptGroup.extOperate = wxAcceptGroup.notDisturb || this.mParam.fold || this.mParam.saveBook;
this.mParam.addCount = Integer.valueOf(obj);
String obj2 = ((ActivityWxAcceptGroupBinding) this.mViewBinding).tvMaxNum.getText().toString();
String obj3 = ((ActivityWxAcceptGroupBinding) this.mViewBinding).edFriendNick.getText().toString();
String obj4 = ((ActivityWxAcceptGroupBinding) this.mViewBinding).edNotGoGroup.getText().toString();
String obj5 = ((ActivityWxAcceptGroupBinding) this.mViewBinding).edGoGroup.getText().toString();
WxAcceptGroup wxAcceptGroup2 = this.mParam;
if (TextUtils.isEmpty(obj2)) {
obj2 = null;
}
wxAcceptGroup2.addRange = obj2;
if (TextUtils.isEmpty(obj5) || !((ActivityWxAcceptGroupBinding) this.mViewBinding).swGoGroup.isChecked()) {
this.mParam.adds = null;
} else if (obj5.contains(",")) {
this.mParam.adds = Arrays.asList(obj5.split(","));
} else {
this.mParam.adds = Arrays.asList(obj5.split(","));
}
if (TextUtils.isEmpty(obj3)) {
this.mParam.nicks = null;
} else if (obj3.contains(",")) {
this.mParam.nicks = Arrays.asList(obj3.split(","));
} else {
this.mParam.nicks = Arrays.asList(obj3.split(","));
}
if (TextUtils.isEmpty(obj4) || !((ActivityWxAcceptGroupBinding) this.mViewBinding).swNotGoGroup.isChecked()) {
this.mParam.notAdds = null;
} else if (obj4.contains(",")) {
this.mParam.notAdds = Arrays.asList(obj4.split(","));
} else {
this.mParam.notAdds = Arrays.asList(obj4.split(","));
}
return true;
}
public static class Filter implements NodeExecutor.IFilter, NodeExecutor.IIf, NodeExecutor.ISelectOriginal, NodeExecutor.IProgress, NodeExecutor.DefaultStatusCallback {
private final ExecutorWindow mWindow;
private final List<AccessibilityNodeInfo> lastNodes = new ArrayList();
private final List<String> clickList = new ArrayList();
private final List<String> completedList = new ArrayList();
public Filter(ExecutorWindow executorWindow) {
this.mWindow = executorWindow;
}
public void onStart(NodeExecutor nodeExecutor) {
this.lastNodes.clear();
this.completedList.clear();
this.clickList.clear();
}
public List<AccessibilityNodeInfo> onFilter(NodeExecutor nodeExecutor, INode iNode, List<AccessibilityNodeInfo> list, Object obj) {
if (list == null) {
return null;
}
final ViewNode id = ViewNode.id("android.widget.TextView", "com.tencent.mm:id/bj2");
List list2 = (List) ((List) list.stream().map(new Function() {
@Override
public final Object apply(Object obj2) {
AccessibilityNodeInfo findOneNode2;
findOneNode2 = ViewNodeUtil.findOneNode2((AccessibilityNodeInfo) obj2, id);
return findOneNode2;
}
}).filter(new Predicate() {
@Override
public final boolean test(Object obj2) {
boolean nonNull;
nonNull = Objects.nonNull((AccessibilityNodeInfo) obj2);
return nonNull;
}
}).collect(Collectors.toList())).stream().filter(new Predicate() {
@Override
public final boolean test(Object obj2) {
boolean lambda$onFilter$1;
lambda$onFilter$1 = WxAcceptGroupActivity.Filter.this.lambda$onFilter$1((AccessibilityNodeInfo) obj2);
return lambda$onFilter$1;
}
}).collect(Collectors.toList());
final List list3 = (List) ClassUtil.getFieldValue(obj, "nicks");
final List list4 = (List) ClassUtil.getFieldValue(obj, "adds");
final List list5 = (List) ClassUtil.getFieldValue(obj, "notAdds");
List<AccessibilityNodeInfo> list6 = (List) list2.stream().filter(new Predicate() {
@Override
public final boolean test(Object obj2) {
boolean lambda$onFilter$2;
lambda$onFilter$2 = WxAcceptGroupActivity.Filter.this.lambda$onFilter$2(list3, list4, list5, (AccessibilityNodeInfo) obj2);
return lambda$onFilter$2;
}
}).collect(Collectors.toList());
if (list6.isEmpty()) {
ArrayList arrayList = new ArrayList();
for (AccessibilityNodeInfo accessibilityNodeInfo : list) {
if (!this.lastNodes.contains(accessibilityNodeInfo)) {
arrayList.add(accessibilityNodeInfo);
}
}
this.lastNodes.clear();
this.lastNodes.addAll(list);
if (arrayList.isEmpty()) {
return null;
}
}
return list6;
}
public boolean lambda$onFilter$1(AccessibilityNodeInfo accessibilityNodeInfo) {
CharSequence text;
if (accessibilityNodeInfo == null || (text = accessibilityNodeInfo.getText()) == null) {
return false;
}
return !this.clickList.contains(text.toString());
}
public boolean lambda$onFilter$2(List list, List list2, List list3, AccessibilityNodeInfo accessibilityNodeInfo) {
final String str;
final String str2;
boolean z;
boolean z2;
boolean z3;
String[] matcher = matcher(accessibilityNodeInfo);
if (matcher == null || (str = matcher[0]) == null || (str2 = matcher[1]) == null) {
return false;
}
if (list == null || list.isEmpty()) {
z = true;
} else {
Stream stream = list.stream();
Objects.requireNonNull(str);
z = stream.anyMatch(new Predicate() {
@Override
public final boolean test(Object obj) {
boolean contains;
contains = str.contains((String) obj);
return contains;
}
});
}
if (list2 == null || list2.isEmpty()) {
z2 = true;
} else {
Stream stream2 = list2.stream();
Objects.requireNonNull(str2);
z2 = stream2.anyMatch(new Predicate() {
@Override
public final boolean test(Object obj) {
boolean contains;
contains = str2.contains((String) obj);
return contains;
}
});
}
if (list3 == null || list3.isEmpty()) {
z3 = false;
} else {
Stream stream3 = list3.stream();
Objects.requireNonNull(str2);
z3 = stream3.anyMatch(new Predicate() {
@Override
public final boolean test(Object obj) {
boolean contains;
contains = str2.contains((String) obj);
return contains;
}
});
}
return z && z2 && !z3;
}
public boolean contains(List<String> list, String str) {
if (list == null || list.isEmpty()) {
return false;
}
return list.contains(str);
}
public String[] matcher(AccessibilityNodeInfo accessibilityNodeInfo) {
CharSequence text;
if (accessibilityNodeInfo == null || (text = accessibilityNodeInfo.getText()) == null) {
return null;
}
Matcher matcher = Pattern.compile("^\"(.*?)\"邀请你加入群聊\"(.*?)\",进入可查看详情。$").matcher(text.toString());
if (matcher.find()) {
return new String[]{matcher.group(1), matcher.group(2)};
}
return null;
}
private int matcherMember(String str) {
int parseInt;
Matcher matcher = Pattern.compile("^(.*?),(\\d+)人$").matcher(str);
if (matcher.find()) {
try {
String group = matcher.group(2);
if (group == null) {
return 0;
}
parseInt = Integer.parseInt(group);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
Matcher matcher2 = Pattern.compile("^(.*?)\\((\\d+)\\)$").matcher(str);
if (!matcher2.find()) {
return 0;
}
try {
String group2 = matcher2.group(2);
if (group2 == null) {
return 0;
}
parseInt = Integer.parseInt(group2);
} catch (Exception e2) {
e2.printStackTrace();
return 0;
}
}
return parseInt;
}
public boolean onIf(IAccessibility iAccessibility, NodeExecutor nodeExecutor, IfNode ifNode, List<AccessibilityNodeInfo> list, Object obj) {
String str;
AccessibilityNodeInfo accessibilityNodeInfo;
CharSequence text;
int i;
int i2;
boolean z;
if (!"group_member".equals(ifNode.getTag())) {
return (list == null || list.isEmpty()) ? false : true;
}
if (list == null || list.isEmpty() || (str = (String) ClassUtil.getFieldValue(obj, "addRange")) == null || str.isEmpty() || (accessibilityNodeInfo = list.get(0)) == null || (text = accessibilityNodeInfo.getText()) == null) {
return false;
}
int matcherMember = matcherMember(text.toString());
try {
String[] split = str.split("-");
i = Integer.parseInt(split[0]);
try {
i2 = Integer.parseInt(split[1]);
} catch (Exception e) {
e = e;
e.printStackTrace();
i2 = 9999;
if (matcherMember < i) {
}
if (z) {
List<String> list2 = this.completedList;
List<String> list3 = this.clickList;
list2.add(list3.get(list3.size() - 1));
}
Log.e("onIf", "所需区间:" + str + ",本群人数:" + matcherMember + ",本次匹配 = " + (matcherMember < i && matcherMember <= i2));
return z;
}
} catch (Exception e2) {
e = e2;
i = 0;
}
z = matcherMember < i && matcherMember <= i2;
if (z && !this.clickList.isEmpty()) {
List<String> list22 = this.completedList;
List<String> list32 = this.clickList;
list22.add(list32.get(list32.size() - 1));
}
Log.e("onIf", "所需区间:" + str + ",本群人数:" + matcherMember + ",本次匹配 = " + (matcherMember < i && matcherMember <= i2));
return z;
}
public void onOriginalSelect(SelectNode selectNode, List<AccessibilityNodeInfo> list, Object obj, NodeExecutor nodeExecutor) {
if (list == null || list.isEmpty()) {
return;
}
ClassUtil.setFieldValue(obj, "targetName", new ViewNode(list.get(0)).getText());
}
public boolean onProgress(IAccessibility iAccessibility, INode iNode, Object[] objArr, int i, NodeExecutor nodeExecutor) {
ExecutorWindow executorWindow;
Integer num = (Integer) ClassUtil.getFieldValue(nodeExecutor.getArgs(), "addCount");
if (num != null && (executorWindow = this.mWindow) != null) {
executorWindow.setProgress(String.format("当前已通过%d个邀请,需通过%d个", Integer.valueOf(this.completedList.size()), num));
}
return num == null || this.completedList.size() <= num.intValue();
}
public boolean onSingletonProgress(IAccessibility iAccessibility, INode iNode, Object[] objArr, int i, NodeExecutor nodeExecutor) {
this.clickList.add(((NodeExecutor.NodeParam) objArr[i]).text);
return super.onSingletonProgress(iAccessibility, iNode, objArr, i, nodeExecutor);
}
}
protected void onResume() {
super.onResume();
ExecutorWindow executorWindow = this.mExecutorWindow;
if (executorWindow != null) {
executorWindow.hideFloatWindow();
this.mExecutorWindow.stop();
}
}
}