导航菜单

页面标题

页面副标题

微商客 v2.1.2 - WxOne2MoreActivity.java 源代码

正在查看: 微商客 v2.1.2 应用的 WxOne2MoreActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.jianzhen.wsk.v1.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.CompoundButton;
import android.widget.Toast;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import com.auxiliary.library.core.NodeExecutor;
import com.auxiliary.library.node.IfNode;
import com.auxiliary.library.node.WhileNode;
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.widget.ExecutorWindow;
import com.jianzhen.wsk.R;
import com.jianzhen.wsk.bean.TagAndGroupBean;
import com.jianzhen.wsk.databinding.ActivityWxOneToMoreBinding;
import com.jianzhen.wsk.dialog.InteractTimeDialog;
import com.jianzhen.wsk.ui.groupsend.SelectSendObjectToPartGroupActivity;
import com.jianzhen.wsk.utils.ScriptLoadUtil;
import com.jianzhen.wsk.v1.VBaseActivity;
import com.jianzhen.wsk.v1.activity.WxOne2MoreActivity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class WxOne2MoreActivity extends VBaseActivity<ActivityWxOneToMoreBinding> implements View.OnClickListener, InteractTimeDialog.OnCompleteListener, CompoundButton.OnCheckedChangeListener {
    private ActivityResultLauncher<Intent> launcher;
    private InteractTimeDialog mDialog;
    private ExecutorWindow mExecutorWindow;
    private final String funcId = "10081";
    private WxOne2More mParam = new WxOne2More();
    private List<TagAndGroupBean> selectGroupListData = new ArrayList();

    public static class WxOne2More {
        public List<String> friend;
        public List<WxOne2MoreGroupName> groupList = new ArrayList();
        public String interactTime = "[3000,5000]";
        public boolean isVerify;
        public String maxCount;
        public String minCount;
        public String nameStr;
        public String verifyMessage;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_wx_one_to_more;
    }

    @Override
    protected void initPageView() {
    }

    @Override
    protected void initTitle() {
    }

    @Override
    protected boolean isSetBaseTitle() {
        return true;
    }

    @Override
    public void initView(ActivityWxOneToMoreBinding activityWxOneToMoreBinding, Bundle bundle) {
        this.mDialog = new InteractTimeDialog(this, this);
        activityWxOneToMoreBinding.tvTitle.setText(R.string.single_to_more_group);
        initActivityResult();
    }

    @Override
    public void initListener(ActivityWxOneToMoreBinding activityWxOneToMoreBinding, Bundle bundle) {
        activityWxOneToMoreBinding.tvPullGroup.setOnClickListener(this);
        activityWxOneToMoreBinding.tvStart.setOnClickListener(this);
        activityWxOneToMoreBinding.tvInteractTime.setOnClickListener(this);
        activityWxOneToMoreBinding.swVerifyMessage.setOnCheckedChangeListener(this);
    }

    @Override
    public void onClick(View view) {
        InteractTimeDialog interactTimeDialog;
        if (view == ((ActivityWxOneToMoreBinding) this.mViewBinding).tvPullGroup && this.mDialog != null) {
            Intent intent = new Intent((Context) this, (Class<?>) SelectSendObjectToPartGroupActivity.class);
            intent.putExtra("selectGroupData", (Serializable) this.selectGroupListData);
            intent.putExtra(SelectSendObjectToPartGroupActivity.IS_SAVA_DATA, false);
            this.launcher.launch(intent);
            return;
        }
        if (view == ((ActivityWxOneToMoreBinding) this.mViewBinding).tvInteractTime && (interactTimeDialog = this.mDialog) != null) {
            interactTimeDialog.show(this.mParam.interactTime);
            return;
        }
        if (view == ((ActivityWxOneToMoreBinding) this.mViewBinding).tvStart) {
            if (((ActivityWxOneToMoreBinding) this.mViewBinding).tvPullFriend.getText().toString().isEmpty()) {
                showCenterToast("请输入需要拉的好友!");
                return;
            }
            List<TagAndGroupBean> list = this.selectGroupListData;
            if (list == null || list.size() <= 0) {
                showCenterToast("请选择群!");
            } else {
                getFuncLimitWx("10081", true);
            }
        }
    }

    @Override
    public void lambda$setNotYearVipTip$7() {
        super.lambda$setNotYearVipTip$7();
        this.mParam.maxCount = ((ActivityWxOneToMoreBinding) this.mViewBinding).edCountLess.getText().toString();
        this.mParam.minCount = ((ActivityWxOneToMoreBinding) this.mViewBinding).edCountGreater.getText().toString();
        this.mParam.isVerify = ((ActivityWxOneToMoreBinding) this.mViewBinding).swVerifyMessage.isChecked();
        if (((ActivityWxOneToMoreBinding) this.mViewBinding).swVerifyMessage.isChecked()) {
            this.mParam.verifyMessage = "";
        } else {
            this.mParam.verifyMessage = ((ActivityWxOneToMoreBinding) this.mViewBinding).edVerifyMessage.getText().toString();
        }
        this.mParam.groupList = new ArrayList();
        Iterator<TagAndGroupBean> it = this.selectGroupListData.iterator();
        while (it.hasNext()) {
            this.mParam.groupList.add(new WxOne2MoreGroupName(it.next().getTagName()));
        }
        this.mParam.nameStr = ((ActivityWxOneToMoreBinding) this.mViewBinding).tvPullFriend.getText().toString().trim();
        try {
            IAccessibility accessibility = AuxiliaryService.getAccessibility();
            ExecutorWindow executorWindow = this.mExecutorWindow;
            if (executorWindow != null) {
                executorWindow.hideFloatWindow();
            }
            this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, "10081", "wx_one_more_search");
            Filter filter = new Filter();
            this.mExecutorWindow.setArgs(this.mParam);
            this.mExecutorWindow.setIIf(filter);
            this.mExecutorWindow.setIFilter(filter);
            this.mExecutorWindow.showFloatWindow();
            this.mExecutorWindow.addStatusCallback(new NodeExecutor.DefaultStatusCallback() {
                public void onFinish(NodeExecutor nodeExecutor, boolean z) {
                    WxOne2MoreActivity.this.mExecutorWindow.setMessage("拉一人进多群任务完成!", true);
                    WxOne2MoreActivity.this.addFuncLimitCountWithYearVip("10081");
                    super.onFinish(nodeExecutor, z);
                }
            });
            SettingUtil.startClearActivity(this, "com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
        } catch (Exception unused) {
            Toast.makeText((Context) this, (CharSequence) "请先启动辅助服务", 0).show();
        }
    }

    @Override
    public void onTimeComplete(String str, String str2) {
        this.mParam.interactTime = str;
        ((ActivityWxOneToMoreBinding) this.mViewBinding).tvInteractTime.setText(str2);
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        ((ActivityWxOneToMoreBinding) this.mViewBinding).llVerifyMessage.setVisibility(z ? 8 : 0);
    }

    static class Filter implements NodeExecutor.IFilter, NodeExecutor.IIf {
        private Filter() {
        }

        public List<AccessibilityNodeInfo> onFilter(NodeExecutor nodeExecutor, INode iNode, List<AccessibilityNodeInfo> list, Object obj) {
            if ("while_node".equals(iNode.getNodeType()) && "groupList".equals(((WhileNode) iNode).getTag())) {
                final List list2 = (List) ClassUtil.getFieldValue(obj, "groupList");
                return (List) list.stream().filter(new Predicate() {
                    @Override
                    public final boolean test(Object obj2) {
                        return WxOne2MoreActivity.Filter.lambda$onFilter$0(list2, (AccessibilityNodeInfo) obj2);
                    }
                }).collect(Collectors.toList());
            }
            final List list3 = (List) ClassUtil.getFieldValue(obj, "friend");
            return (List) list.stream().filter(new Predicate() {
                @Override
                public final boolean test(Object obj2) {
                    return WxOne2MoreActivity.Filter.lambda$onFilter$1(list3, (AccessibilityNodeInfo) obj2);
                }
            }).collect(Collectors.toList());
        }

        static boolean lambda$onFilter$0(List list, AccessibilityNodeInfo accessibilityNodeInfo) {
            CharSequence text = accessibilityNodeInfo.getText();
            if (text == null) {
                return false;
            }
            String obj = text.toString();
            if (list != null && !list.isEmpty()) {
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    if (((WxOne2MoreGroupName) it.next()).equals(obj)) {
                        return true;
                    }
                }
            }
            return false;
        }

        static boolean lambda$onFilter$1(List list, AccessibilityNodeInfo accessibilityNodeInfo) {
            CharSequence text = accessibilityNodeInfo.getText();
            if (text == null) {
                return false;
            }
            String obj = text.toString();
            if (list == null || list.isEmpty()) {
                return false;
            }
            return list.contains(obj);
        }

        public boolean onIf(IAccessibility iAccessibility, NodeExecutor nodeExecutor, IfNode ifNode, List<AccessibilityNodeInfo> list, Object obj) {
            if (!"tag1".equals(ifNode.getTag())) {
                return (list == null || list.isEmpty()) ? false : true;
            }
            if (list == null || list.isEmpty()) {
                return false;
            }
            CharSequence text = list.get(0).getText();
            if (text == null) {
                text = list.get(0).getContentDescription();
            }
            if (text == null) {
                return false;
            }
            String obj2 = text.toString();
            try {
                String str = (String) ClassUtil.getFieldValue(obj, "maxCount");
                String str2 = (String) ClassUtil.getFieldValue(obj, "minCount");
                int lastIndexOf = obj2.lastIndexOf(40);
                int indexOf = obj2.indexOf(41, lastIndexOf);
                int parseInt = (lastIndexOf == -1 || indexOf == -1) ? 0 : Integer.parseInt(obj2.substring(lastIndexOf + 1, indexOf));
                return (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) ? !TextUtils.isEmpty(str) ? Integer.parseInt(str) >= parseInt : TextUtils.isEmpty(str2) || Integer.parseInt(str2) <= parseInt : Integer.parseInt(str) >= parseInt && Integer.parseInt(str2) <= parseInt;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return true;
        }
    }

    public static class WxOne2MoreGroupName {
        public String groupName;

        public WxOne2MoreGroupName() {
        }

        public WxOne2MoreGroupName(String str) {
            this.groupName = str;
        }

        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (obj instanceof String) {
                return obj.equals(this.groupName);
            }
            return super.equals(obj);
        }
    }

    protected void onResume() {
        super.onResume();
        ExecutorWindow executorWindow = this.mExecutorWindow;
        if (executorWindow != null) {
            executorWindow.hideFloatWindow();
            this.mExecutorWindow.stop();
        }
    }

    public void initActivityResult() {
        this.launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                WxOne2MoreActivity.this.lambda$initActivityResult$0((ActivityResult) obj);
            }
        });
    }

    public void lambda$initActivityResult$0(ActivityResult activityResult) {
        if (activityResult.getResultCode() != -1 || activityResult.getData() == null) {
            return;
        }
        this.selectGroupListData = new ArrayList();
        this.mParam.groupList = new ArrayList();
        List<TagAndGroupBean> list = (List) activityResult.getData().getSerializableExtra("selectGroup");
        this.selectGroupListData = list;
        if (list != null && !list.isEmpty()) {
            ((ActivityWxOneToMoreBinding) this.mViewBinding).tvPullGroup.setText("已选择" + this.selectGroupListData.size() + "个群聊");
        } else {
            ((ActivityWxOneToMoreBinding) this.mViewBinding).tvPullGroup.setText("请选择");
        }
    }
}