导航菜单

页面标题

页面副标题

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

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

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


package com.jianzhen.wsk.ui.groupsend;

import android.content.Intent;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.auxiliary.library.core.NodeExecutor;
import com.auxiliary.library.node.SelectNode;
import com.auxiliary.library.service.AuxiliaryService;
import com.auxiliary.library.service.IAccessibility;
import com.auxiliary.library.widget.ExecutorWindow;
import com.jianzhen.wsk.BaseActivity;
import com.jianzhen.wsk.R;
import com.jianzhen.wsk.adapter.AllGroupAdapter;
import com.jianzhen.wsk.adapter.PartGroupAdapter;
import com.jianzhen.wsk.bean.TagAndGroupBean;
import com.jianzhen.wsk.bean.WxNameDate;
import com.jianzhen.wsk.ui.FunctionPermissionManageActivity;
import com.jianzhen.wsk.ui.groupsend.SelectSendObjectToPartGroupActivity;
import com.jianzhen.wsk.utils.DataSaveUtils;
import com.jianzhen.wsk.utils.ScriptLoadUtil;
import com.jianzhen.wsk.utils.Utils;
import com.umeng.analytics.MobclickAgent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class SelectSendObjectToPartGroupActivity extends BaseActivity implements View.OnClickListener {
    public static String IS_SAVA_DATA = "isSavaData";
    private TextView againGetTagIv;
    private ImageView allSelectTagIv;
    private LinearLayout emptyLay;
    private AllGroupAdapter mAllGroupAdapter;
    private ExecutorWindow mExecutorWindow;
    private PartGroupAdapter mPartGroupAdapter;
    private EditText searchGroup;
    private TextView showSelectGroupNum;
    private LinearLayout tagLay;
    private TextView tagNumTv;
    private RecyclerView tagRv;
    private LinearLayout top_tip_lay;
    private List<TagAndGroupBean> groupListData = new ArrayList();
    private List<TagAndGroupBean> allGroupListData = new ArrayList();
    private final Handler handlerPost = new Handler(Looper.getMainLooper());
    private boolean isALlGroup = false;
    private boolean isSavaData = true;
    private PartGroupAdapter.OnItemClickListener onItemClickListener = new PartGroupAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(int i, boolean z) {
            ((TagAndGroupBean) SelectSendObjectToPartGroupActivity.this.groupListData.get(i)).setSelect(z);
            SelectSendObjectToPartGroupActivity.this.setAllSelectIv();
            SelectSendObjectToPartGroupActivity.this.mPartGroupAdapter.notifyDataSetChanged();
            SelectSendObjectToPartGroupActivity.this.showSelectGroupNum();
        }
    };
    private String myWxName = "";
    private boolean isCheckIng = false;
    private boolean isToCheckTag = false;

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

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

    @Override
    protected void initPageView() {
        this.isALlGroup = getIntent().getBooleanExtra("isALlGroup", false);
        this.isSavaData = getIntent().getBooleanExtra(IS_SAVA_DATA, true);
        this.tagLay = (LinearLayout) findViewById(R.id.tag_info_lay);
        this.emptyLay = (LinearLayout) findViewById(R.id.ll_empty);
        this.tagNumTv = (TextView) findViewById(R.id.get_tag_num_tv);
        this.againGetTagIv = (TextView) findViewById(R.id.again_get_tag_tv);
        this.tagRv = findViewById(R.id.tag_rv);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.tag_all_select_lay);
        this.searchGroup = (EditText) findViewById(R.id.search_group);
        this.showSelectGroupNum = (TextView) findViewById(R.id.show_select_group_num);
        this.top_tip_lay = (LinearLayout) findViewById(R.id.top_tip_lay);
        findViewById(R.id.btn_check_wechat_signs).setOnClickListener(this);
        this.againGetTagIv.setOnClickListener(this);
        this.allSelectTagIv = (ImageView) findViewById(R.id.tag_all_select_iv);
        findViewById(R.id.tv_ok).setOnClickListener(this);
        if (this.isALlGroup) {
            linearLayout.setVisibility(8);
        }
        if (DataSaveUtils.getPartGroupListData(this) != null) {
            List<TagAndGroupBean> partGroupListData = DataSaveUtils.getPartGroupListData(this);
            this.groupListData = partGroupListData;
            this.allGroupListData = partGroupListData;
            if (partGroupListData != null && partGroupListData.size() > 0) {
                this.tagLay.setVisibility(0);
                this.emptyLay.setVisibility(8);
                this.tagNumTv.setText("检测到" + this.groupListData.size() + "个群聊");
            } else {
                this.tagLay.setVisibility(8);
                this.emptyLay.setVisibility(0);
            }
        } else {
            this.tagLay.setVisibility(8);
            this.emptyLay.setVisibility(0);
        }
        if (this.isALlGroup) {
            this.mAllGroupAdapter = new AllGroupAdapter(this, this.groupListData);
            this.tagRv.setLayoutManager(new LinearLayoutManager(this));
            this.tagRv.setAdapter(this.mAllGroupAdapter);
            this.searchGroup.setVisibility(8);
        } else {
            this.mPartGroupAdapter = new PartGroupAdapter(this, this.groupListData);
            this.tagRv.setLayoutManager(new LinearLayoutManager(this));
            this.tagRv.setAdapter(this.mPartGroupAdapter);
            this.mPartGroupAdapter.setOnItemClickListener(this.onItemClickListener);
            setAllSelect();
            setDefaultViewData();
        }
        this.searchGroup.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }

            @Override
            public void afterTextChanged(Editable editable) {
                ArrayList arrayList = new ArrayList();
                for (TagAndGroupBean tagAndGroupBean : SelectSendObjectToPartGroupActivity.this.allGroupListData) {
                    if (tagAndGroupBean.getTagName().contains(SelectSendObjectToPartGroupActivity.this.searchGroup.getText().toString().trim())) {
                        arrayList.add(tagAndGroupBean);
                    }
                }
                SelectSendObjectToPartGroupActivity.this.groupListData = arrayList;
                SelectSendObjectToPartGroupActivity selectSendObjectToPartGroupActivity = SelectSendObjectToPartGroupActivity.this;
                ?? r1 = SelectSendObjectToPartGroupActivity.this;
                selectSendObjectToPartGroupActivity.mPartGroupAdapter = new PartGroupAdapter(r1, ((SelectSendObjectToPartGroupActivity) r1).groupListData);
                SelectSendObjectToPartGroupActivity.this.tagRv.setLayoutManager(new LinearLayoutManager(SelectSendObjectToPartGroupActivity.this));
                SelectSendObjectToPartGroupActivity.this.tagRv.setAdapter(SelectSendObjectToPartGroupActivity.this.mPartGroupAdapter);
                SelectSendObjectToPartGroupActivity.this.mPartGroupAdapter.setOnItemClickListener(SelectSendObjectToPartGroupActivity.this.onItemClickListener);
                SelectSendObjectToPartGroupActivity.this.setAllSelectIv();
            }
        });
    }

    public void setAllSelectIv() {
        Iterator<TagAndGroupBean> it = this.groupListData.iterator();
        int i = 0;
        while (it.hasNext()) {
            if (it.next().isSelect()) {
                i++;
            }
        }
        this.allSelectTagIv.setSelected(i == this.groupListData.size());
    }

    private void setDefaultViewData() {
        List<TagAndGroupBean> list;
        new ArrayList();
        if (this.isSavaData) {
            list = DataSaveUtils.getSelectPartGroupListData(this);
        } else {
            list = (List) getIntent().getSerializableExtra("selectGroupData");
        }
        if (list != null && list.size() > 0) {
            int i = 0;
            for (TagAndGroupBean tagAndGroupBean : list) {
                for (TagAndGroupBean tagAndGroupBean2 : this.groupListData) {
                    if (tagAndGroupBean.getTagName().equals(tagAndGroupBean2.getTagName())) {
                        tagAndGroupBean2.setSelect(true);
                        i++;
                    }
                }
            }
            this.allSelectTagIv.setSelected(i == this.groupListData.size());
        }
        this.mPartGroupAdapter.notifyDataSetChanged();
        showSelectGroupNum();
    }

    private void setAllSelect() {
        this.allSelectTagIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SelectSendObjectToPartGroupActivity.this.lambda$setAllSelect$0(view);
            }
        });
    }

    public void lambda$setAllSelect$0(View view) {
        if (this.allSelectTagIv.isSelected()) {
            Iterator<TagAndGroupBean> it = this.groupListData.iterator();
            while (it.hasNext()) {
                it.next().setSelect(false);
            }
        } else {
            Iterator<TagAndGroupBean> it2 = this.groupListData.iterator();
            while (it2.hasNext()) {
                it2.next().setSelect(true);
            }
        }
        ImageView imageView = this.allSelectTagIv;
        imageView.setSelected(true ^ imageView.isSelected());
        this.mPartGroupAdapter.notifyDataSetChanged();
        showSelectGroupNum();
    }

    public void showSelectGroupNum() {
        Iterator<TagAndGroupBean> it = this.allGroupListData.iterator();
        int i = 0;
        while (it.hasNext()) {
            if (it.next().isSelect()) {
                i++;
            }
        }
        this.showSelectGroupNum.setText("(已选择" + i + "个群)");
    }

    private void checkTag() {
        if (backFromApplyPermission()) {
            MobclickAgent.onEvent(this, "get_all_group_list");
            Utils.openWx(this);
            this.handlerPost.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        IAccessibility accessibility = AuxiliaryService.getAccessibility();
                        SelectSendObjectToPartGroupActivity.this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, "10001", "get_all_group");
                        SelectSendObjectToPartGroupActivity.this.mExecutorWindow.showFloatWindow();
                        WxNameDate wxNameDate = new WxNameDate();
                        SelectSendObjectToPartGroupActivity.this.mExecutorWindow.setArgs(wxNameDate);
                        SelectSendObjectToPartGroupActivity.this.mExecutorWindow.setISelect(new AnonymousClass1(wxNameDate));
                        SelectSendObjectToPartGroupActivity.this.mExecutorWindow.addStatusCallback(new NodeExecutor.StatusCallback() {
                            public void onFail(NodeExecutor nodeExecutor, Throwable th) {
                            }

                            public void onPause(NodeExecutor nodeExecutor) {
                            }

                            public void onResume(NodeExecutor nodeExecutor) {
                            }

                            public void onStart(NodeExecutor nodeExecutor) {
                                SelectSendObjectToPartGroupActivity.this.isCheckIng = false;
                            }

                            public void onFinish(NodeExecutor nodeExecutor, boolean z) {
                                if (SelectSendObjectToPartGroupActivity.this.isCheckIng) {
                                    SelectSendObjectToPartGroupActivity.this.isToCheckTag = true;
                                    SelectSendObjectToPartGroupActivity.this.mExecutorWindow.setMessageShow("已为您找到" + SelectSendObjectToPartGroupActivity.this.groupListData.size() + "个群聊,请返回程序中选择吧!");
                                    SelectSendObjectToPartGroupActivity.this.allGroupListData = SelectSendObjectToPartGroupActivity.this.groupListData;
                                    DataSaveUtils.setPartGroupListData(SelectSendObjectToPartGroupActivity.this, JSON.toJSONString(SelectSendObjectToPartGroupActivity.this.groupListData));
                                    DataSaveUtils.setSelectPartGroupListData(SelectSendObjectToPartGroupActivity.this, "");
                                    SelectSendObjectToPartGroupActivity.this.allSelectTagIv.setSelected(false);
                                }
                            }
                        });
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                class AnonymousClass1 implements NodeExecutor.ISelectMap {
                    final WxNameDate val$wxNameDate;

                    AnonymousClass1(WxNameDate wxNameDate) {
                        this.val$wxNameDate = wxNameDate;
                    }

                    public void onNodeSelect(SelectNode selectNode, List<NodeExecutor.NodeParam> list, Object obj, NodeExecutor nodeExecutor) {
                        char c;
                        List list2 = (List) list.stream().filter(new Predicate() {
                            @Override
                            public final boolean test(Object obj2) {
                                return SelectSendObjectToPartGroupActivity.AnonymousClass3.AnonymousClass1.lambda$onNodeSelect$0((NodeExecutor.NodeParam) obj2);
                            }
                        }).map(new Function() {
                            @Override
                            public final Object apply(Object obj2) {
                                String str;
                                str = ((NodeExecutor.NodeParam) obj2).text;
                                return str;
                            }
                        }).filter(new Predicate() {
                            @Override
                            public final boolean test(Object obj2) {
                                return SelectSendObjectToPartGroupActivity.AnonymousClass3.AnonymousClass1.lambda$onNodeSelect$2((String) obj2);
                            }
                        }).collect(Collectors.toList());
                        String pageName = selectNode.getPageName();
                        pageName.hashCode();
                        switch (pageName.hashCode()) {
                            case 873621663:
                                if (pageName.equals("获取群-我的页面-获取昵称")) {
                                    c = 0;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 1405048776:
                                if (pageName.equals("获取群—更多群聊页面")) {
                                    c = 1;
                                    break;
                                }
                                c = 65535;
                                break;
                            case 1578826915:
                                if (pageName.equals("没有更多群聊页面选择群")) {
                                    c = 2;
                                    break;
                                }
                                c = 65535;
                                break;
                            default:
                                c = 65535;
                                break;
                        }
                        switch (c) {
                            case 0:
                                if (SelectSendObjectToPartGroupActivity.this.myWxName.equals("") && list2.size() > 0) {
                                    SelectSendObjectToPartGroupActivity.this.myWxName = (String) list2.get(0);
                                }
                                this.val$wxNameDate.wx_name = SelectSendObjectToPartGroupActivity.this.myWxName;
                                return;
                            case 1:
                                break;
                            case 2:
                                List list3 = (List) list.stream().filter(new Predicate() {
                                    @Override
                                    public final boolean test(Object obj2) {
                                        return SelectSendObjectToPartGroupActivity.AnonymousClass3.AnonymousClass1.lambda$onNodeSelect$3((NodeExecutor.NodeParam) obj2);
                                    }
                                }).map(new Function() {
                                    @Override
                                    public final Object apply(Object obj2) {
                                        String str;
                                        str = ((NodeExecutor.NodeParam) obj2).text;
                                        return str;
                                    }
                                }).filter(new Predicate() {
                                    @Override
                                    public final boolean test(Object obj2) {
                                        return SelectSendObjectToPartGroupActivity.AnonymousClass3.AnonymousClass1.lambda$onNodeSelect$5((String) obj2);
                                    }
                                }).collect(Collectors.toList());
                                SelectSendObjectToPartGroupActivity.this.isCheckIng = true;
                                SelectSendObjectToPartGroupActivity.this.groupListData.clear();
                                Iterator it = list3.iterator();
                                while (it.hasNext()) {
                                    SelectSendObjectToPartGroupActivity.this.groupListData.add(new TagAndGroupBean((String) it.next()));
                                }
                                return;
                            default:
                                return;
                        }
                        for (int i = 0; i < list2.size(); i++) {
                            int lastIndexOf = ((String) list2.get(i)).lastIndexOf(40);
                            int lastIndexOf2 = ((String) list2.get(i)).lastIndexOf(41);
                            if (lastIndexOf != -1) {
                                list2.set(i, Utils.removeCharacters((String) list2.get(i), lastIndexOf, lastIndexOf2));
                            }
                        }
                        List list4 = (List) list2.stream().distinct().collect(Collectors.toList());
                        SelectSendObjectToPartGroupActivity.this.isCheckIng = true;
                        SelectSendObjectToPartGroupActivity.this.groupListData.clear();
                        Iterator it2 = list4.iterator();
                        while (it2.hasNext()) {
                            SelectSendObjectToPartGroupActivity.this.groupListData.add(new TagAndGroupBean((String) it2.next()));
                        }
                    }

                    static boolean lambda$onNodeSelect$0(NodeExecutor.NodeParam nodeParam) {
                        return nodeParam.text != null;
                    }

                    static boolean lambda$onNodeSelect$2(String str) {
                        return ("微信团队".equals(str) || "文件传输助手".equals(str) || "未设置标签的朋友".equals(str)) ? false : true;
                    }

                    static boolean lambda$onNodeSelect$3(NodeExecutor.NodeParam nodeParam) {
                        return nodeParam.text != null;
                    }

                    static boolean lambda$onNodeSelect$5(String str) {
                        return ("微信团队".equals(str) || "文件传输助手".equals(str) || "未设置标签的朋友".equals(str)) ? false : true;
                    }
                }
            });
            return;
        }
        startIntent(this, FunctionPermissionManageActivity.class);
    }

    protected void onResume() {
        super.onResume();
        if (this.isToCheckTag) {
            if (this.groupListData.size() > 0) {
                this.tagLay.setVisibility(0);
                this.emptyLay.setVisibility(8);
                this.tagNumTv.setText("检测到" + this.groupListData.size() + "个群聊");
                this.allSelectTagIv.setSelected(false);
            } else {
                this.tagLay.setVisibility(8);
                this.emptyLay.setVisibility(0);
            }
            if (this.isALlGroup) {
                this.mAllGroupAdapter.notifyDataSetChanged();
            } else {
                this.mPartGroupAdapter.notifyDataSetChanged();
            }
            showSelectGroupNum();
            this.isToCheckTag = false;
        }
        ExecutorWindow executorWindow = this.mExecutorWindow;
        if (executorWindow != null) {
            executorWindow.hideFloatWindow();
            this.mExecutorWindow.stop();
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131361899 || id == 2131361977) {
            checkTag();
            return;
        }
        if (id != 2131363295) {
            return;
        }
        if (this.isALlGroup) {
            finish();
            return;
        }
        ArrayList arrayList = new ArrayList();
        for (TagAndGroupBean tagAndGroupBean : this.allGroupListData) {
            if (tagAndGroupBean.isSelect()) {
                arrayList.add(tagAndGroupBean);
            }
        }
        if (arrayList.isEmpty()) {
            showCenterToast("请选择群聊!");
            return;
        }
        String jSONString = JSON.toJSONString(arrayList);
        if (this.isSavaData) {
            DataSaveUtils.setSelectPartGroupListData(this, jSONString);
        }
        Intent intent = new Intent();
        intent.putExtra("isSelectObject", 201);
        intent.putExtra("selectGroup", arrayList);
        setResult(-1, intent);
        finish();
    }

    public void onBackPressed() {
        Intent intent = new Intent();
        intent.putExtra("isSelectObject", 201);
        setResult(-1, intent);
        finish();
    }

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

    @Override
    protected void initTitle() {
        if (this.isSavaData) {
            if (this.isALlGroup) {
                setBaseTitle(this, "全部群聊");
                return;
            } else {
                setBaseTitle(this, "发送到部分群聊");
                return;
            }
        }
        setBaseTitle(this, "选择群");
        this.top_tip_lay.setVisibility(8);
    }
}