正在查看: 微商客 v2.1.2 应用的 SelectSendObjectToSaveGroupActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 微商客 v2.1.2 应用的 SelectSendObjectToSaveGroupActivity.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.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.auxiliary.library.widget.ExecutorWindow;
import com.jianzhen.wsk.BaseActivity;
import com.jianzhen.wsk.R;
import com.jianzhen.wsk.adapter.TagAdapter;
import com.jianzhen.wsk.bean.TagAndGroupBean;
import com.jianzhen.wsk.ui.FunctionPermissionManageActivity;
import com.jianzhen.wsk.ui.groupsend.SelectSendObjectToSaveGroupActivity;
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 SelectSendObjectToSaveGroupActivity extends BaseActivity implements View.OnClickListener {
private TextView againGetTagIv;
private ImageView allSelectTagIv;
private LinearLayout emptyLay;
private ExecutorWindow mExecutorWindow;
private TagAdapter mTagAdapter;
private EditText searchGroup;
private TextView showSelectGroupNum;
private LinearLayout tagLay;
private TextView tagNumTv;
private RecyclerView tagRv;
private List<TagAndGroupBean> groupListData = new ArrayList();
private List<TagAndGroupBean> allGroupListData = new ArrayList();
private final Handler handlerPost = new Handler(Looper.getMainLooper());
private TagAdapter.OnItemClickListener onItemClickListener = new TagAdapter.OnItemClickListener() {
@Override
public void onItemClick(int i, boolean z) {
((TagAndGroupBean) SelectSendObjectToSaveGroupActivity.this.groupListData.get(i)).setSelect(z);
SelectSendObjectToSaveGroupActivity.this.setAllSelectIv();
SelectSendObjectToSaveGroupActivity.this.mTagAdapter.notifyDataSetChanged();
SelectSendObjectToSaveGroupActivity.this.showSelectGroupNum();
}
};
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.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);
this.searchGroup = (EditText) findViewById(R.id.search_group);
this.showSelectGroupNum = (TextView) findViewById(R.id.show_select_group_num);
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 (DataSaveUtils.getSaveGroupListData(this) != null) {
List<TagAndGroupBean> saveGroupListData = DataSaveUtils.getSaveGroupListData(this);
this.groupListData = saveGroupListData;
this.allGroupListData = saveGroupListData;
if (saveGroupListData != null && saveGroupListData.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);
}
this.mTagAdapter = new TagAdapter(this, this.groupListData);
this.tagRv.setLayoutManager(new LinearLayoutManager(this));
this.tagRv.setAdapter(this.mTagAdapter);
this.mTagAdapter.setOnItemClickListener(this.onItemClickListener);
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 : SelectSendObjectToSaveGroupActivity.this.allGroupListData) {
if (tagAndGroupBean.getTagName().contains(SelectSendObjectToSaveGroupActivity.this.searchGroup.getText().toString().trim())) {
arrayList.add(tagAndGroupBean);
}
}
SelectSendObjectToSaveGroupActivity.this.groupListData = arrayList;
SelectSendObjectToSaveGroupActivity selectSendObjectToSaveGroupActivity = SelectSendObjectToSaveGroupActivity.this;
?? r1 = SelectSendObjectToSaveGroupActivity.this;
selectSendObjectToSaveGroupActivity.mTagAdapter = new TagAdapter(r1, ((SelectSendObjectToSaveGroupActivity) r1).groupListData);
SelectSendObjectToSaveGroupActivity.this.tagRv.setLayoutManager(new LinearLayoutManager(SelectSendObjectToSaveGroupActivity.this));
SelectSendObjectToSaveGroupActivity.this.tagRv.setAdapter(SelectSendObjectToSaveGroupActivity.this.mTagAdapter);
SelectSendObjectToSaveGroupActivity.this.mTagAdapter.setOnItemClickListener(SelectSendObjectToSaveGroupActivity.this.onItemClickListener);
SelectSendObjectToSaveGroupActivity.this.setAllSelectIv();
}
});
setAllSelect();
setDefaultViewData();
}
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> selectSaveGroupListData = DataSaveUtils.getSelectSaveGroupListData(this);
if (selectSaveGroupListData != null && selectSaveGroupListData.size() > 0) {
int i = 0;
for (TagAndGroupBean tagAndGroupBean : selectSaveGroupListData) {
for (TagAndGroupBean tagAndGroupBean2 : this.groupListData) {
if (tagAndGroupBean.getTagName().equals(tagAndGroupBean2.getTagName())) {
tagAndGroupBean2.setSelect(true);
i++;
}
}
}
this.allSelectTagIv.setSelected(i == this.groupListData.size());
}
this.mTagAdapter.notifyDataSetChanged();
showSelectGroupNum();
}
private void setAllSelect() {
this.allSelectTagIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (SelectSendObjectToSaveGroupActivity.this.allSelectTagIv.isSelected()) {
Iterator it = SelectSendObjectToSaveGroupActivity.this.groupListData.iterator();
while (it.hasNext()) {
((TagAndGroupBean) it.next()).setSelect(false);
}
} else {
Iterator it2 = SelectSendObjectToSaveGroupActivity.this.groupListData.iterator();
while (it2.hasNext()) {
((TagAndGroupBean) it2.next()).setSelect(true);
}
}
SelectSendObjectToSaveGroupActivity.this.allSelectTagIv.setSelected(true ^ SelectSendObjectToSaveGroupActivity.this.allSelectTagIv.isSelected());
SelectSendObjectToSaveGroupActivity.this.mTagAdapter.notifyDataSetChanged();
SelectSendObjectToSaveGroupActivity.this.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_save_group_list");
Utils.openWx(this);
this.handlerPost.post(new Runnable() {
@Override
public void run() {
try {
IAccessibility accessibility = AuxiliaryService.getAccessibility();
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow = ScriptLoadUtil.loadWx(accessibility, "10001", "get_save_group");
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.showFloatWindow();
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.setISelect(new AnonymousClass1());
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.setCallback(new NodeExecutor.DefaultCallback(SelectSendObjectToSaveGroupActivity.this) {
public boolean onNodeNotFound(PageNode pageNode, ViewNode viewNode, NodeExecutor nodeExecutor) {
if (pageNode.getPageName() != null && "获取通讯录群聊-点击通讯录".equals(pageNode.getPageName())) {
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.setMessageShow("请点击通讯录按钮,切换到通讯录页面后继续开始!");
}
return super.onNodeNotFound(pageNode, viewNode, nodeExecutor);
}
public boolean onPageNotFound(IAccessibility iAccessibility, INode iNode, String str, NodeExecutor nodeExecutor) {
PageNode pageNode = (PageNode) iNode;
if (pageNode.getPageName() != null && "获取通讯录群聊-点击通讯录".equals(pageNode.getPageName())) {
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.setMessageShow("请点击通讯录按钮,切换到通讯录页面后继续开始!");
}
return super.onPageNotFound(iAccessibility, iNode, str, nodeExecutor);
}
});
SelectSendObjectToSaveGroupActivity.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) {
SelectSendObjectToSaveGroupActivity.this.isCheckIng = false;
}
public void onFinish(NodeExecutor nodeExecutor, boolean z) {
if (SelectSendObjectToSaveGroupActivity.this.isCheckIng) {
SelectSendObjectToSaveGroupActivity.this.isToCheckTag = true;
SelectSendObjectToSaveGroupActivity.this.mExecutorWindow.setMessageShow("已为您找到" + SelectSendObjectToSaveGroupActivity.this.groupListData.size() + "个群聊,请返回程序中选择吧!");
SelectSendObjectToSaveGroupActivity.this.allGroupListData = SelectSendObjectToSaveGroupActivity.this.groupListData;
DataSaveUtils.setSaveGroupListData(SelectSendObjectToSaveGroupActivity.this, JSON.toJSONString(SelectSendObjectToSaveGroupActivity.this.groupListData));
DataSaveUtils.setSelectSaveGroupListData(SelectSendObjectToSaveGroupActivity.this, "");
SelectSendObjectToSaveGroupActivity.this.allSelectTagIv.setSelected(false);
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
class AnonymousClass1 implements NodeExecutor.ISelectMap {
AnonymousClass1() {
}
public void onNodeSelect(SelectNode selectNode, List<NodeExecutor.NodeParam> list, Object obj, NodeExecutor nodeExecutor) {
if (selectNode.getPageName().equals("保存的群聊页面")) {
List list2 = (List) ((List) list.stream().filter(new Predicate() {
@Override
public final boolean test(Object obj2) {
return SelectSendObjectToSaveGroupActivity.AnonymousClass4.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 SelectSendObjectToSaveGroupActivity.AnonymousClass4.AnonymousClass1.lambda$onNodeSelect$2((String) obj2);
}
}).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
SelectSendObjectToSaveGroupActivity.this.isCheckIng = true;
SelectSendObjectToSaveGroupActivity.this.groupListData.clear();
Iterator it = list2.iterator();
while (it.hasNext()) {
SelectSendObjectToSaveGroupActivity.this.groupListData.add(new TagAndGroupBean((String) it.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;
}
}
});
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() + "个群聊");
} else {
this.tagLay.setVisibility(8);
this.emptyLay.setVisibility(0);
}
this.mTagAdapter.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;
}
ArrayList arrayList = new ArrayList();
for (TagAndGroupBean tagAndGroupBean : this.allGroupListData) {
if (tagAndGroupBean.isSelect()) {
arrayList.add(tagAndGroupBean);
}
}
if (arrayList.size() <= 0) {
showCenterToast("请选择群聊!");
return;
}
DataSaveUtils.setSelectSaveGroupListData(this, JSON.toJSONString(arrayList));
Intent intent = new Intent();
intent.putExtra("isSelectObject", 202);
setResult(-1, intent);
finish();
}
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("isSelectObject", 202);
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() {
setBaseTitle(this, "发送到通讯录群聊");
}
}