导航菜单

页面标题

页面副标题

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

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

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


package com.jianzhen.wsk.ui.groupsend;

import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import com.auxiliary.library.core.NodeExecutor;
import com.auxiliary.library.node.ViewNode;
import com.auxiliary.library.node.base.INode;
import com.auxiliary.library.node.base.PageNode;
import com.auxiliary.library.service.AuxiliaryService;
import com.auxiliary.library.service.IAccessibility;
import com.jianzhen.wsk.R;
import com.jianzhen.wsk.bean.AllFriendSend;
import com.jianzhen.wsk.bean.NameList;
import com.jianzhen.wsk.bean.SendTagListData;
import com.jianzhen.wsk.dialog.SelectStartLocationDialog;
import com.jianzhen.wsk.net.api.Constant;
import com.jianzhen.wsk.utils.ScriptLoadUtil;
import com.jianzhen.wsk.utils.SharedPreferencesUtil;
import com.jianzhen.wsk.utils.Utils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class FriendsByFriendsSendActivity extends MessageSendActivity implements View.OnClickListener, NodeExecutor.StatusCallback {
    private final Handler handlerPost = new Handler(Looper.getMainLooper());
    private int allStart = 0;
    private int allSendNum = 0;
    private String friendNickStr = "";

    public void onFail(NodeExecutor nodeExecutor, Throwable th) {
    }

    public void onPause(NodeExecutor nodeExecutor) {
    }

    public void onResume(NodeExecutor nodeExecutor) {
    }

    public void onStart(NodeExecutor nodeExecutor) {
    }

    public static void startActivity(Activity activity, String str) {
        Intent intent = new Intent(activity, (Class<?>) FriendsByFriendsSendActivity.class);
        intent.putExtra("funcId", str);
        activity.startActivity(intent);
    }

    @Override
    protected void initView() {
        findViewById(R.id.send_ok).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                FriendsByFriendsSendActivity.this.lambda$initView$0(view);
            }
        });
    }

    public void lambda$initView$0(View view) {
        String edText = getEdText();
        if (!this.sendCollectIv.isSelected()) {
            if (edText.isEmpty() && !isSendImg()) {
                showCenterToast("请输入发送的内容,或选择图片!");
                return;
            } else if (this.sendObjectTv.getText().toString().equals("请选择") || this.isSelectObject == 0) {
                showCenterToast("请选择群发对象!");
                return;
            }
        }
        getFuncLimit(this.funcId);
    }

    @Override
    public void lambda$setNotYearVipTip$7() {
        super.lambda$setNotYearVipTip$7();
        if (isSendImg()) {
            saveImg();
        }
        this.handlerPost.post(new Runnable() {
            @Override
            public final void run() {
                FriendsByFriendsSendActivity.this.lambda$SendWxStart$1();
            }
        });
    }

    public void lambda$SendWxStart$1() {
        if (this.isSelectObject == 100 || this.isSelectObject == 102) {
            new SelectStartLocationDialog(this) {
                @Override
                protected void okData(String str) {
                    super.okData(str);
                    if (str != null && !str.isEmpty()) {
                        if (Integer.parseInt(str) > 0) {
                            FriendsByFriendsSendActivity.this.allStart = Integer.parseInt(str) - 1;
                        } else {
                            FriendsByFriendsSendActivity.this.allStart = 0;
                        }
                    } else {
                        FriendsByFriendsSendActivity.this.allStart = 0;
                    }
                    Utils.openWx(FriendsByFriendsSendActivity.this);
                    FriendsByFriendsSendActivity.this.sendAllFriendOrNotSendFriend();
                }
            }.show();
        } else if (this.isSelectObject == 101) {
            Utils.openWx(this);
            sendSelectTagFriend();
        }
    }

    public void sendAllFriendOrNotSendFriend() {
        try {
            this.mExecutorWindow = ScriptLoadUtil.loadWx(AuxiliaryService.getAccessibility(), this.funcId, "send_all_friend");
            this.mExecutorWindow.showFloatWindow();
            AllFriendSend allFriendSend = new AllFriendSend();
            if (this.useNickNameIv.isSelected()) {
                allFriendSend.setSendText("," + getEdText());
            } else {
                allFriendSend.setSendText(getEdText());
            }
            allFriendSend.setSend_img_list(this.imgListDataList);
            allFriendSend.setTime(this.sendTime);
            allFriendSend.setIs_first_img(!this.firstSendTextIv.isSelected());
            allFriendSend.setIs_have_text(!this.sendTextEd.getText().toString().isEmpty());
            allFriendSend.setIs_have_img(isSendImg());
            allFriendSend.setIs_send_collect(this.sendCollectIv.isSelected());
            allFriendSend.setIs_use_nickname(this.useNickNameIv.isSelected());
            allFriendSend.setStart(this.allStart);
            this.notSendData.add(new NameList("微信团队"));
            this.notSendData.add(new NameList("文件传输助手"));
            this.notSendData.add(new NameList("未设置标签的朋友"));
            this.notSendData.add(new NameList("企业联系人"));
            this.mExecutorWindow.setIFilter(new NodeExecutor.IFilter() {
                public List<AccessibilityNodeInfo> onFilter(NodeExecutor nodeExecutor, INode iNode, List<AccessibilityNodeInfo> list, Object obj) {
                    ArrayList arrayList = new ArrayList();
                    arrayList.addAll(list);
                    if (!FriendsByFriendsSendActivity.this.notSendData.isEmpty()) {
                        for (NameList nameList : FriendsByFriendsSendActivity.this.notSendData) {
                            Iterator<AccessibilityNodeInfo> it = list.iterator();
                            while (true) {
                                if (!it.hasNext()) {
                                    break;
                                }
                                AccessibilityNodeInfo next = it.next();
                                if (next != null && next.getText() != null && nameList.nameText.equals(next.getText().toString())) {
                                    arrayList.remove(next);
                                    break;
                                }
                            }
                        }
                    }
                    return arrayList;
                }
            });
            this.mExecutorWindow.setIProgress(new NodeExecutor.IProgress() {
                public final boolean onProgress(IAccessibility iAccessibility, INode iNode, Object[] objArr, int i, NodeExecutor nodeExecutor) {
                    boolean lambda$sendAllFriendOrNotSendFriend$2;
                    lambda$sendAllFriendOrNotSendFriend$2 = FriendsByFriendsSendActivity.this.lambda$sendAllFriendOrNotSendFriend$2(iAccessibility, iNode, objArr, i, nodeExecutor);
                    return lambda$sendAllFriendOrNotSendFriend$2;
                }
            });
            this.mExecutorWindow.setCallback(new NodeExecutor.DefaultCallback(this) {
                public boolean onNodeFound(PageNode pageNode, ViewNode viewNode, NodeExecutor nodeExecutor) {
                    if (pageNode.getPageName() != null && pageNode.getPageName().equals("逐个好友群发-选择好友")) {
                        FriendsByFriendsSendActivity.this.allSendNum++;
                        FriendsByFriendsSendActivity.this.mExecutorWindow.setProgress("正在操作第" + FriendsByFriendsSendActivity.this.allSendNum + "位好友");
                    }
                    return super.onNodeFound(pageNode, viewNode, nodeExecutor);
                }
            });
            this.mExecutorWindow.setArgs(allFriendSend);
            this.mExecutorWindow.addStatusCallback(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean lambda$sendAllFriendOrNotSendFriend$2(IAccessibility iAccessibility, INode iNode, Object[] objArr, int i, NodeExecutor nodeExecutor) {
        if (!this.isVipOrFree && i > Constant.sendMessageNum - 1) {
            this.mExecutorWindow.stop();
        }
        return true;
    }

    private void sendSelectTagFriend() {
        String edText;
        if (this.sendTagListData1 == null || this.sendTagListData1.getTag_list() == null || this.sendTagListData1.getTag_list().isEmpty()) {
            return;
        }
        String edText2 = getEdText();
        if (this.useNickNameIv.isSelected()) {
            edText = "," + edText2;
        } else {
            edText = getEdText();
        }
        for (SendTagListData.FriendTagList friendTagList : this.sendTagListData1.getTag_list()) {
            friendTagList.setSend_text(edText);
            friendTagList.setSend_time(this.sendTime);
            friendTagList.setSend_img_list(this.imgListDataList);
            friendTagList.setIs_send_collect(this.sendCollectIv.isSelected());
            friendTagList.setIs_use_nickname(this.useNickNameIv.isSelected());
        }
        if (!this.isVipOrFree && this.sendTagListData1.getTag_list().size() > Constant.sendMessageNum) {
            this.sendTagListData1.setTag_list(this.sendTagListData1.getTag_list().subList(0, Constant.sendMessageNum));
        }
        try {
            IAccessibility accessibility = AuxiliaryService.getAccessibility();
            if (isSendImg()) {
                if (this.sendTextEd.getText().toString().isEmpty()) {
                    this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, this.funcId, "send_select_friend_send_img");
                } else if (this.firstSendTextIv.isSelected()) {
                    this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, this.funcId, "send_select_friend_first_text");
                } else {
                    this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, this.funcId, "send_select_friend_first_img");
                }
            } else {
                this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, this.funcId, "send_select_friend_send_text");
            }
            this.mExecutorWindow.showFloatWindow();
            this.mExecutorWindow.setArgs(this.sendTagListData1);
            this.mExecutorWindow.setCallback(new NodeExecutor.DefaultCallback(this) {
                public boolean onNodeNotFound(PageNode pageNode, ViewNode viewNode, NodeExecutor nodeExecutor) {
                    if (pageNode.getPageName() != null && pageNode.getPageName().equals("逐个好友群发-点击好友")) {
                        FriendsByFriendsSendActivity.this.mExecutorWindow.setMessageShow("发送异常中断,请返回到当前标签好友列表页面,继续开始");
                    }
                    return super.onNodeFound(pageNode, viewNode, nodeExecutor);
                }
            });
            this.mExecutorWindow.addStatusCallback(this);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onFinish(NodeExecutor nodeExecutor, boolean z) {
        addFuncLimitCount(this.funcId);
        if (this.isSelectObject == 100 || this.isSelectObject == 102) {
            SharedPreferencesUtil.putInt(this, "savaSendAllLocation", this.allStart + this.allSendNum);
            this.allStart = 0;
            this.allSendNum = 0;
            this.friendNickStr = "";
        }
        if (!this.isVipOrFree) {
            this.mExecutorWindow.setMessageShow("群发任务已成功完成,你的免费体验已结束,继续使用请返回应用,开通会员!");
        } else if (this.isSelectObject == 100 || this.isSelectObject == 102) {
            this.mExecutorWindow.setMessageShow("群发完成!");
        } else {
            this.mExecutorWindow.setMessageShow("群发完成!");
        }
    }

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

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (this.mExecutorWindow != null) {
            this.mExecutorWindow.hideFloatWindow();
            this.mExecutorWindow.stop();
        }
    }
}