mOperations = new ArrayList<>();
+ ContentResolver resolver = mcontext.getContentResolver();
+ int rawContactInsertIndex;
+ // 循环添加
+ for (int i = 0; i < phoneNumber.size(); i++) {
+ Uri uri = Uri.parse("content://com.android.contacts/raw_contacts");
+ rawContactInsertIndex = mOperations.size();// 这句好很重要,有了它才能给真正的实现批量添加。
+ // 向raw_contact表添加一条记录
+ // 此处.withValue("account_name", null)一定要加,不然会抛NullPointerException
+ ContentProviderOperation operation1 = ContentProviderOperation.newInsert(uri)
+ .withValue("account_name", null).build();
+ mOperations.add(operation1);
+ // 向data添加数据
+ uri = Uri.parse("content://com.android.contacts/data");
+ // 添加姓名
+ ContentProviderOperation operation2 = ContentProviderOperation.newInsert(uri)
+ .withValueBackReference("raw_contact_id", rawContactInsertIndex)
+ // withValueBackReference的第二个参数表示引用operations[0]的操作的返回id作为此值
+ .withValue("mimetype", "vnd.android.cursor.item/name").withValue("data2", phoneNumber.get(i).getName())
+ .withYieldAllowed(true).build();
+ mOperations.add(operation2);
+ // 添加手机数据
+ ContentProviderOperation operation3 = ContentProviderOperation.newInsert(uri)
+ .withValueBackReference("raw_contact_id", rawContactInsertIndex)
+ .withValue("mimetype", "vnd.android.cursor.item/phone_v2").withValue("data2", "2")
+ .withValue("data1", phoneNumber.get(i).getPhone()).withYieldAllowed(true).build();
+ mOperations.add(operation3);
+
+ }
+ try {
+ // 这里才调用的批量添加
+ resolver.applyBatch("com.android.contacts", mOperations);
+
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (OperationApplicationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/BaseActivity.java b/app/src/main/java/com/fisherbone/fuzhu/BaseActivity.java
new file mode 100644
index 0000000..6732956
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/BaseActivity.java
@@ -0,0 +1,253 @@
+package com.fisherbone.fuzhu;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.net.Uri;
+import android.os.Bundle;
+import android.text.TextPaint;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.ColorRes;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.FragmentActivity;
+
+import com.blankj.utilcode.util.ToastUtils;
+import com.fisherbone.fuzhu.abllib.AblStepHandler;
+import com.fisherbone.fuzhu.abllib.utils.AblUtil;
+import com.fisherbone.fuzhu.utils.StatusBarUtil;
+
+
+/**
+ * @author: qndroid
+ * @function: 所有Activity的基类,用来处理一些公共事件,如:数据统计
+ * @date: 16/3/10
+ */
+public abstract class BaseActivity extends FragmentActivity {
+
+ public static final int REQUEST_CALL_PERMISSION = 10111; //拨号请求码
+ protected final String TAG = this.getClass().getSimpleName();
+ public String VALUE_ZERO="0";
+ public String VALUE_ONE="1";
+ public String VALUE_TWO="2";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ reverseStatusColor();
+ StatusBarUtil.transparencyBar(this); //设置状态栏全透明
+ StatusBarUtil.StatusBarLightMode(this); //设置白底黑字
+ StatusBarUtil.setStatusBarColor(this, R.color.colortitlebar);
+ initFontScale();
+
+ DisplayMetrics dm = getResources().getDisplayMetrics();
+ int screenWidth = dm.widthPixels;
+ int screenHeight = dm.heightPixels;
+ Log.e("屏幕分辨率", "宽"+screenWidth+"=="+"高"+screenHeight);
+
+ }
+
+
+
+
+ /**
+ * 拨打电话(直接拨打)
+ *
+ * @param telPhone 电话
+ */
+ public void call(String telPhone) {
+ if (checkReadPermission(Manifest.permission.CALL_PHONE, REQUEST_CALL_PERMISSION)) {
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_CALL);
+ Uri phoneNum = Uri.parse("tel:" + telPhone);
+ intent.setData(phoneNum);
+ startActivity(intent);
+ }
+
+ }
+
+ /**
+ * 判断是否有某项权限
+ *
+ * @param string_permission 权限
+ * @param request_code 请求码
+ * @return
+ */
+ public boolean checkReadPermission(String string_permission, int request_code) {
+ boolean flag = false;
+ if (ContextCompat.checkSelfPermission(this, string_permission) == PackageManager.PERMISSION_GRANTED) {//已有权限
+ flag = true;
+ } else {//申请权限
+ ActivityCompat.requestPermissions(this, new String[]{string_permission}, request_code);
+ }
+ return flag;
+ }
+
+ private void initFontScale() {
+ Configuration configuration = getResources().getConfiguration();
+ configuration.fontScale = (float) 1;
+ //0.85 小, 1 标准大小, 1.15 大,1.3 超大 ,1.45 特大
+ DisplayMetrics metrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ metrics.scaledDensity = configuration.fontScale * metrics.density;
+ getBaseContext().getResources().updateConfiguration(configuration, metrics);
+ }
+
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ }
+
+ /**
+ * 申请指定的权限.
+ */
+ public void requestPermission(int code, String... permissions) {
+
+ ActivityCompat.requestPermissions(this, permissions, code);
+ }
+
+
+ /**
+ * 判断是否有指定的权限
+ */
+ public boolean hasPermission(String... permissions) {
+
+ for (String permisson : permissions) {
+ if (ContextCompat.checkSelfPermission(this, permisson)
+ != PackageManager.PERMISSION_GRANTED) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * 处理整个应用用中的SDCard业务
+ */
+ public void doSDCardPermission() {
+ }
+
+ /**
+ * 隐藏状态栏
+ */
+ public void hiddenStatusBar() {
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ /**
+ * 开启一个Activity
+ *
+ * @param clz
+ */
+ public void startActivity(Class extends Activity> clz) {
+ startActivity(new Intent(this, clz));
+ }
+ /**
+ * 改变状态栏颜色
+ *
+ * @param color
+ */
+ public void changeStatusBarColor(@ColorRes int color) {
+ // StatusBarUtil.setStatusBarColor(this, color);
+ }
+
+ /**
+ * 调整状态栏为亮模式,这样状态栏的文字颜色就为深模式了。
+ */
+ private void reverseStatusColor() {
+// StatusBarUtil.statusBarLightMode(this);
+ }
+
+ public void toast(String msg) {
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+ }
+ /**
+ * 字体加粗
+ */
+ protected void Thickening(TextView mLayTopTitle) {
+ TextPaint tp = mLayTopTitle.getPaint();
+ tp.setFakeBoldText(true);
+ }
+ protected void Thickeningtwo(TextView mLayTopTitle) {
+ TextPaint tp = mLayTopTitle.getPaint();
+ tp.setFakeBoldText(false);
+ }
+
+ /**
+ * 初始化一般返回按钮事件
+ */
+ public void initNormalBack() {
+
+ ImageView iv_back = (ImageView) findViewById(R.id.iv_left_btn);
+
+
+ if (iv_back != null) {
+ iv_back.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ }
+ }
+
+ /**
+ * 开始执行
+ */
+ public void StartExecution(Context context,int arg) {
+ if (AblUtil.isAccessibilityServiceOpen(context)) {
+ AblStepHandler.getInstance().setStop(false);
+ AblStepHandler.sendMsg(arg);
+ } else {
+ ToastUtils.showShort("点到了");
+ ToastUtils.showShort("请先开启辅助服务");
+ AblUtil.openAccessibilitySettings();
+ }
+
+ }
+
+ /**
+ * 获取该系统版本号
+ *
+ * @return
+ */
+ public String getVersionn() {
+ try {
+ PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
+// return "Ver." + pi.versionName;
+ return pi.versionName;
+ } catch (PackageManager.NameNotFoundException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+ public void displayBriefMemory() {
+ final ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
+ ActivityManager.MemoryInfo info = new ActivityManager.MemoryInfo();
+ activityManager.getMemoryInfo(info);
+ Log.i("内存tag", "系统剩余内存:" + (info.availMem >> 10) + "k");
+ Log.i("内存tag", "系统是否处于低内存运行:" + info.lowMemory);
+ Log.i("内存tag", "当系统剩余内存低于" + info.threshold + "时就看成低内存运行");
+ }
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/BootBroadcastReceiver.java b/app/src/main/java/com/fisherbone/fuzhu/BootBroadcastReceiver.java
new file mode 100644
index 0000000..6c693d9
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/BootBroadcastReceiver.java
@@ -0,0 +1,29 @@
+package com.fisherbone.fuzhu;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.fisherbone.fuzhu.activity.MainActivity;
+
+public class BootBroadcastReceiver extends BroadcastReceiver {
+
+ static final String ACTION="android.intent.action.BOOT_COMPLETED";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // TODO: This method is called when the BroadcastReceiver is receiving
+ // an Intent broadcast.
+ if(intent.getAction().equals(ACTION)){
+
+ Log.d("ciky","接收器接受到开启完成广播!"+intent.getAction());
+ System.out.println("自启动程序即将执行!");
+
+ Intent mainActivityIntent=new Intent(context, MainActivity.class);
+ mainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(mainActivityIntent);
+
+ }
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/ChangLiang.java b/app/src/main/java/com/fisherbone/fuzhu/ChangLiang.java
new file mode 100644
index 0000000..ce972a1
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/ChangLiang.java
@@ -0,0 +1,238 @@
+package com.fisherbone.fuzhu;
+
+public class ChangLiang
+{
+ public static String qidong="F";
+ public static String qidongtwo="F";
+
+
+ /**
+ * 一键取关的常量
+ */
+ public static boolean cancelclosed; //取消已关
+ public static boolean cancelcrosscor; //取消互关
+ public static String passnumber="2"; //取关数
+ public static String swiinterval; //取关间隔
+ public static String minthrthr; //最小开始取关数
+ public static String minfans; //互关保留粉丝数
+ public static int quguannum; //取关数
+ public static String ishuodong="T";
+
+
+ /**
+ * 推荐加关的常量
+ */
+
+ public static String Runtime; //运行时长
+ public static String Videotime; //视频观看时长
+ public static String maxVideotime; //视频观看最大时长
+ public static String Randomlikes; //随机点赞
+ public static String Randomreview; //随机评论
+ public static String Randomattention; //随机关注
+ public static String Maximumofconcerns; //最大关注数
+
+ public static String Numberofcon; //加关关注数
+ public static String Addfans; //加关粉丝数
+ public static String Minimumofworks="0"; //最小作品数
+ public static String Maximumprotime; //最大作品时间
+
+ public static String maxmumlikes="3500"; //最大加关关注数
+ public static String maximumcon="20000" ; //最大粉丝数
+ public static String maxmumzuopin="10000" ; //最大作品数
+
+ public static int tasknum=1;
+ public static int guanzhunum=0;//当前关注数
+ public static String condition="0";//是否满足条件:0:满足 1:不满足
+ public static String getMaximumprotime; //获得的最大作品时间
+
+
+ /**
+ * 登录的手机号码
+ */
+ public static String phonenum="18133922183";
+ /**
+ * 登录的手机验证码
+ */
+ public static String code="3856";
+
+
+ /**
+ * 幢号加关注
+ */
+ public static String zishuodong="T";
+ public static String account_duration="";
+ public static String touch_num="";
+ public static String if_quguan="";
+
+
+
+
+
+
+
+ /**
+ * 适配手机型号
+ * 0是红米7a(Redmi 7A) 1是华为畅享20 2是红米10手机(M2103K19C)
+ */
+ public static String phonetype="0";
+
+
+ /**
+ * 浮窗运行状态(推荐加关)
+ */
+ public static boolean isrun=true;
+
+ /**
+ * 浮窗运行状态(一键取关)
+ */
+ // public static boolean isrun_two=true;
+ /**
+ * 浮窗打开状态(推荐加关)
+ */
+ public static boolean isopoen=true;
+ /**
+ * 浮窗打开状态(一键取关)
+ */
+ public static boolean isopoen_two=true;
+
+
+
+
+ /**
+ * 当前执行任务抖音id
+ */
+ public static String short_id="";
+ /**
+ * 当前执行任务id
+ */
+ public static String task_id="";
+ /**
+ * 当前执行任务功能id
+ */
+ public static String id="";
+ //_____________________________________________
+ /**
+ * 未处理完成的执行任务抖音id
+ */
+ public static String short_id_f="";
+ //_____________________________________________
+ /**
+ * 未处理完成的执行任务id
+ */
+ public static String task_id_f="";
+ //_____________________________________________
+ /**
+ * 未处理完成的执行任务功能id
+ */
+ public static String id_f="";
+ //_____________________________________________
+ /**
+ * 未处理完成的紧急执行任务抖音id
+ */
+ public static String short_id_jf="";
+ //_____________________________________________
+ /**
+ * 未处理完成的紧急执行任务id
+ */
+ public static String task_id_jf="";
+ //_____________________________________________
+ /**
+ * 未处理完成的紧急执行任务功能id
+ */
+ public static String id_jf="";
+
+
+ //_____________________________________________
+
+ /**
+ * 当前执行任务抖音昵称
+ */
+ public static String short_name="";
+ /**
+ * 执行任务的抖音昵称
+ */
+ public static String task_short_name="";
+
+ /**
+ * 当前执行任务类型
+ */
+ public static String task_type="";//1:代表账号登录 2:停任务 3:代表紧急任务,4:代表固定任务
+ public static String func_type="";
+
+ /**
+ * 无障碍是否开启
+ */
+ public static String isopenAccessib="F";
+ /**
+ *
+ *抖音版本号
+ **/
+ public static String douyinversion="2"; //1.代表13.10 13.20 2代表14.60版本
+
+ /**
+ * 1:云端 0:本地
+ */
+ public static String control_status="";
+
+
+ /**
+ * 认领任务的常量(
+ */
+ public static boolean istask = false; //当前是否有认领的任务
+ public static String isstart = "0"; //0代表没有运行 1代表正在运行
+ public static String isstarttwo = "0"; //0代表停任务没有运行 1代表停任务正在运行
+ // public static int tasktype = 0; //当前认领的任务类型//success=-1:代表报错;success=0:代表暂无任务;success=1:代表账号登录;success=2:代表停止任务;success=3:代表紧急任务;success=4:代表固定任务)
+ public static String douyinzhaohao = ""; //当前认领的任务执行任务的抖音号
+
+
+
+ /**
+ * 粉丝互动的常量
+ */
+ public static String interaContent=""; //互动内容
+ public static String interanum; //互动粉丝数
+
+
+ /**
+ * 大V粉丝截流的常量
+ */
+ public static String dav_runningtime=""; //运行时长
+ public static String dav_maxnumcon=""; //运行时长
+ public static String dav_douyinhao="Ting998888"; //抖音号
+ public static String dav_guanjianci=""; //关键词
+ public static String dav_minimumlikes=""; //最小加关关注数
+ public static String dav_minimumcon=""; //最小加关粉丝数
+ public static String dav_minimumzuopin=""; //最小作品数
+ public static String dav_maxmumzuopin=""; //最大作品数
+ public static String dav_maxmumlikes=""; //最大加关关注数
+ public static String dav_maximumcon=""; //最大粉丝数
+ public static String dav_ishuadong="T";//大V粉丝滑动开关
+ public static String dav_condition="0";//是否满足条件:0:满足 1:不满足
+
+ /**
+ * 潜在客户加关
+ */
+ public static String dav_douyinname="地产S姐";//大V都应名称
+ public static String dav_douyinname_id="地产S姐";//大V都应名称
+ public static String dav_keyword="二手房";//大V都应名称
+ public static String dav_qianzai="T";
+
+
+
+
+ //_______________________________________________________________________________________________
+ /**
+ * 跟单的开关
+ */
+ public static int gendanopen=0;//0为关 1为开
+ public static String genfaneirong="";//跟发内容
+ public static String fudaineirong="";//强福带发送的内容
+
+ //_______________________________________________________________________________________________
+ /**
+ * 粉丝通知
+ */
+ public static int bnumber=0;//发送私信的循环次数
+
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/FZConfig.java b/app/src/main/java/com/fisherbone/fuzhu/FZConfig.java
new file mode 100644
index 0000000..1845253
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/FZConfig.java
@@ -0,0 +1,20 @@
+package com.fisherbone.fuzhu;
+
+/**
+ * FZ配置参数
+ * Created by XiaoQiang on 2017/6/24.
+ */
+public class FZConfig {
+
+ /**
+ * 设备id
+ */
+ public static String KEY_DEVICE_ID = "device_id";
+
+ /**
+ * 设备是否已激活
+ * 设备是否已激活 0是激活 1是未激活
+ */
+ public static String IS_ACTIVATION = "activation";
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/FuzhuApplication.java b/app/src/main/java/com/fisherbone/fuzhu/FuzhuApplication.java
new file mode 100644
index 0000000..a21cdc4
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/FuzhuApplication.java
@@ -0,0 +1,165 @@
+package com.fisherbone.fuzhu;
+
+import android.app.Application;
+import android.content.Context;
+
+import com.fisherbone.fuzhu.db.dao.DataBaseHelper;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.cache.CacheEntity;
+import com.lzy.okgo.cache.CacheMode;
+import com.lzy.okgo.cookie.CookieJarImpl;
+import com.lzy.okgo.cookie.store.DBCookieStore;
+import com.lzy.okgo.https.HttpsUtils;
+import com.lzy.okgo.interceptor.HttpLoggingInterceptor;
+import com.lzy.okgo.model.HttpHeaders;
+import com.lzy.okgo.model.HttpParams;
+import com.tencent.bugly.crashreport.CrashReport;
+import com.xiangxue.common.network.base.NetworkApi;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.X509TrustManager;
+
+import okhttp3.OkHttpClient;
+
+
+/**
+ * Created by: xudiwei
+ *
+ * on: 2017/3/13.
+ *
+ * 描述:Base Application
+ * 123
+ */
+
+public class FuzhuApplication extends Application {
+
+ private static Context mContext;
+ private static FuzhuApplication baseApplication;
+ public static FuzhuApplication getInstance() {
+ return baseApplication;
+ }
+
+ public static Context getContext() {
+ return mContext;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ baseApplication = this;
+ mContext = this;
+ CrashReport.initCrashReport(getApplicationContext(), "e940e41c92", false);
+ //用户资料存储工具
+ ProfileSpUtils.init(this);
+ DataBaseHelper.initOrmLite(this);
+ initOkGo();
+ MyCrashHandler.getInstance().init(this);
+ NetworkApi.init(new XiangxueNetwork(this));
+
+
+
+ }
+
+ private void initOkGo() {
+ //---------这里给出的是示例代码,告诉你可以这么传,实际使用的时候,根据需要传,不需要就不传-------------//
+ HttpHeaders headers = new HttpHeaders();
+ headers.put("commonHeaderKey1", "commonHeaderValue1"); //header不支持中文,不允许有特殊字符
+ headers.put("commonHeaderKey2", "commonHeaderValue2");
+ HttpParams params = new HttpParams();
+ params.put("commonParamsKey1", "commonParamsValue1"); //param支持中文,直接传,不要自己编码
+ params.put("commonParamsKey2", "这里支持中文参数");
+ //----------------------------------------------------------------------------------------//
+
+ OkHttpClient.Builder builder = new OkHttpClient.Builder();
+ //log相关
+ HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("OkGo");
+ loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY); //log打印级别,决定了log显示的详细程度
+ loggingInterceptor.setColorLevel(Level.INFO); //log颜色级别,决定了log在控制台显示的颜色
+ builder.addInterceptor(loggingInterceptor); //添加OkGo默认debug日志
+ //第三方的开源库,使用通知显示当前请求的log,不过在做文件下载的时候,这个库好像有问题,对文件判断不准确
+ //builder.addInterceptor(new ChuckInterceptor(this));
+
+ //超时时间设置,默认60秒
+ builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的读取超时时间
+ builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的写入超时时间
+ builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS); //全局的连接超时时间
+
+ //自动管理cookie(或者叫session的保持),以下几种任选其一就行
+ //builder.cookieJar(new CookieJarImpl(new SPCookieStore(this))); //使用sp保持cookie,如果cookie不过期,则一直有效
+ builder.cookieJar(new CookieJarImpl(new DBCookieStore(this))); //使用数据库保持cookie,如果cookie不过期,则一直有效
+ //builder.cookieJar(new CookieJarImpl(new MemoryCookieStore())); //使用内存保持cookie,app退出后,cookie消失
+
+ //https相关设置,以下几种方案根据需要自己设置
+ //方法一:信任所有证书,不安全有风险
+ HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory();
+ //方法二:自定义信任规则,校验服务端证书
+ HttpsUtils.SSLParams sslParams2 = HttpsUtils.getSslSocketFactory(new SafeTrustManager());
+ //方法三:使用预埋证书,校验服务端证书(自签名证书)
+ //HttpsUtils.SSLParams sslParams3 = HttpsUtils.getSslSocketFactory(getAssets().open("srca.cer"));
+ //方法四:使用bks证书和密码管理客户端证书(双向认证),使用预埋证书,校验服务端证书(自签名证书)
+ //HttpsUtils.SSLParams sslParams4 = HttpsUtils.getSslSocketFactory(getAssets().open("xxx.bks"), "123456", getAssets().open("yyy.cer"));
+ builder.sslSocketFactory(sslParams1.sSLSocketFactory, sslParams1.trustManager);
+ //配置https的域名匹配规则,详细看demo的初始化介绍,不需要就不要加入,使用不当会导致https握手失败
+ builder.hostnameVerifier(new SafeHostnameVerifier());
+
+ // 其他统一的配置
+ // 详细说明看GitHub文档:https://github.com/jeasonlzy/
+ OkGo.getInstance().init(this) //必须调用初始化
+ .setOkHttpClient(builder.build()) //建议设置OkHttpClient,不设置会使用默认的
+ .setCacheMode(CacheMode.NO_CACHE) //全局统一缓存模式,默认不使用缓存,可以不传
+ .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE) //全局统一缓存时间,默认永不过期,可以不传
+ .setRetryCount(3); //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0
+// .addCommonHeaders(headers) //全局公共头
+// .addCommonParams(params); //全局公共参数
+ }
+
+ /**
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 重要的事情说三遍,以下代码不要直接使用
+ */
+ private class SafeTrustManager implements X509TrustManager {
+ @Override
+ public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+ try {
+ for (X509Certificate certificate : chain) {
+ certificate.checkValidity(); //检查证书是否过期,签名是否通过等
+ }
+ } catch (Exception e) {
+ throw new CertificateException(e);
+ }
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
+ }
+
+ /**
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 这里只是我谁便写的认证规则,具体每个业务是否需要验证,以及验证规则是什么,请与服务端或者leader确定
+ * 重要的事情说三遍,以下代码不要直接使用
+ */
+ private class SafeHostnameVerifier implements HostnameVerifier {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ //验证主机名是否匹配
+ //return hostname.equals("server.jeasonlzy.com");
+ return true;
+ }
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/InfoMessage.java b/app/src/main/java/com/fisherbone/fuzhu/InfoMessage.java
new file mode 100644
index 0000000..6615f1c
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/InfoMessage.java
@@ -0,0 +1,25 @@
+package com.fisherbone.fuzhu;
+
+public interface InfoMessage {
+ void mesagesuccess(String str);
+
+ void mesagezhuang(String str);
+
+ /**
+ * 登录
+ * @param str
+ */
+ void mesagefinish(String str);
+
+ /**
+ * 潜在客户加关
+ * @param str
+ */
+ void potfinish(String id, String str, String type);
+
+ /**
+ * 粉丝通知
+ * @param str
+ */
+ void potgegin(String str);
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/LiveActivity.java b/app/src/main/java/com/fisherbone/fuzhu/LiveActivity.java
new file mode 100644
index 0000000..ca81ab1
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/LiveActivity.java
@@ -0,0 +1,67 @@
+package com.fisherbone.fuzhu;
+
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.databinding.DataBindingUtil;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+
+import com.fisherbone.fuzhu.abllib.utils.AblUtil;
+import com.fisherbone.fuzhu.databinding.ActivityLiveBinding;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.entity.LiveBean;
+import com.fisherbone.fuzhu.fragment.LiwuFragment;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+
+import de.greenrobot.event.EventBus;
+
+
+public class LiveActivity extends BaseActivity{
+ private TitleBar mTitleBar;
+ private ActivityLiveBinding binding;
+ private LiveBean liveBean1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_live);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("指定直播间加热");
+ initNormalBack();
+ liveBean1 = ProfileSpUtils.getInstance().getLiveBean();
+ binding.setLivebean(liveBean1);
+ //创建fragment管理类
+ FragmentManager fm = getSupportFragmentManager();
+ //查找当前容器中是否有fragment
+ Fragment fragment = fm.findFragmentById(R.id.news_content_fragment);
+ if (fragment == null) {
+ //如果没有,创建fragment
+ fragment = new LiwuFragment(liveBean1);
+ Bundle bundle = new Bundle();
+ bundle.putString("visitor_id", "");
+ fragment.setArguments(bundle);
+ //添加fragment到activity中
+ fm.beginTransaction().add(R.id.news_content_fragment, fragment).commit();
+ }
+ binding.rlStart.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ ProfileSpUtils.getInstance().saveLiveBean(liveBean1);
+ if("0".equals(ChangLiang.phonetype)) {
+ EventBus.getDefault().post(new FourEvent("success", "6"));
+ }else if("3".equals(ChangLiang.phonetype)) {
+ EventBus.getDefault().post(new FourEvent("success", "6"));
+ }
+ else {
+ if (AblUtil.isAccessibilityServiceOpen(LiveActivity.this)) {
+ AblUtil.openAccessibilitySettings();
+ } else {
+ AblUtil.openAccessibilitySettings();
+ }
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/LiveSuiJiActivity.java b/app/src/main/java/com/fisherbone/fuzhu/LiveSuiJiActivity.java
new file mode 100644
index 0000000..bef4347
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/LiveSuiJiActivity.java
@@ -0,0 +1,38 @@
+package com.fisherbone.fuzhu;
+
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.fisherbone.fuzhu.databinding.ActivityLiveSuiJiBinding;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.entity.LiveSuiJiBean;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+
+import de.greenrobot.event.EventBus;
+
+public class LiveSuiJiActivity extends BaseActivity {
+ private TitleBar mTitleBar;
+ private ActivityLiveSuiJiBinding binding;
+ private LiveSuiJiBean liveSuiJiBean;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_live_sui_ji);
+ liveSuiJiBean = ProfileSpUtils.getInstance().getLiveSuiJiBean();
+ binding.setLivesuijibean(liveSuiJiBean);
+ binding.setPresenter(new Presenter());
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("随机直播间抢福袋");
+ initNormalBack();
+ }
+ public class Presenter {
+ public void onClick(View view){
+ ProfileSpUtils.getInstance().saveLiveSuiJiBean(liveSuiJiBean);
+ EventBus.getDefault().post(new FourEvent("success","7"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/Main2Activity.java b/app/src/main/java/com/fisherbone/fuzhu/Main2Activity.java
new file mode 100644
index 0000000..26cb8c8
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/Main2Activity.java
@@ -0,0 +1,18 @@
+package com.fisherbone.fuzhu;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+
+import com.xiangxue.arouter_annotation.ARouter;
+import com.fisherbone.fuzhu.R;
+
+@ARouter(path = "/app/Main2Activity")
+public class Main2Activity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main2);
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/MainActivityy.java b/app/src/main/java/com/fisherbone/fuzhu/MainActivityy.java
new file mode 100644
index 0000000..0b1b794
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/MainActivityy.java
@@ -0,0 +1,102 @@
+package com.fisherbone.fuzhu;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.xiangxue.arouter_annotation.ARouter;
+import com.xiangxue.arouter_annotation.Parameter;
+import com.xiangxue.arouter_api.ParameterManager;
+import com.xiangxue.arouter_api.RouterManager;
+import com.xiangxue.common.bean.Student;
+import com.xiangxue.common.order.OrderDrawable;
+import com.xiangxue.common.order.user.IUser;
+import com.xiangxue.common.utils.Cons;
+
+@ARouter(path = "/app/MainActivityy")
+public class MainActivityy extends AppCompatActivity {
+
+ @Parameter(name = "/order/getDrawable")
+ OrderDrawable orderDrawable; // 公共基础库common
+
+ @Parameter(name = "/order/getUserInfo")
+ IUser iUser; // 公共基础库common
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main1);
+
+ if (BuildConfig.isRelease) {
+ Log.e(Cons.TAG, "当前为:集成化模式,除app可运行,其他子模块都是Android Library");
+ } else {
+ Log.e(Cons.TAG, "当前为:组件化模式,app/order/personal子模块都可独立运行");
+ }
+
+ // 懒加载方式,跳到哪加载哪个类
+ ParameterManager.getInstance().loadParameter(this);
+
+ // app模块本来就可以直接加载其他模块的资源 personal
+ // 拿到 order模块的图片 在app模块展示
+ int drawableId = orderDrawable.getDrawable();
+ ImageView img = findViewById(R.id.img);
+ img.setImageResource(drawableId);
+
+ // 我输出 order模块的Bean休息
+ Log.d(Cons.TAG, "order的Bean onCreate: " + iUser.getUserInfo().toString());
+ }
+
+ public void jumpOrder(View view) {
+ /*Intent intent = new Intent(this, Order_MainActivity.class);
+ intent.putExtra("name", "derry");
+ startActivity(intent);*/
+
+ // 使用我们自己写的路由 跳转交互
+ RouterManager.getInstance()
+ .build("/order/Order_MainActivity")
+ .withString("name", "杜子腾")
+ .navigation(this); // 组件和组件通信
+ }
+
+ public void jumpPersonal(View view) {
+ // 以前是这样跳转
+ /*Intent intent = new Intent(this, Personal_MainActivity.class);
+ intent.putExtra("name", "derry");
+ startActivity(intent);*/
+
+ // 现在是这样跳转 目前还要写这么多代码,是不是非常累
+
+ // TODO 最终的成效:用户 一行代码搞定,同时还可以传递参数,同时还可以懒加载
+ /*ARouter$$Group$$personal group$$personal = new ARouter$$Group$$personal();
+ Map> groupMap = group$$personal.getGroupMap();
+ Class extends ARouterPath> myClass = groupMap.get("personal");
+
+ try {
+ ARouter$$Path$$personal path = (ARouter$$Path$$personal) myClass.newInstance();
+ Map pathMap = path.getPathMap();
+ RouterBean bean = pathMap.get("/personal/Personal_MainActivity");
+
+ if (bean != null) {
+ Intent intent = new Intent(this, bean.getMyClass());
+ startActivity(intent);
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }*/
+
+ Student student = new Student("Derry大大", "男", 99);
+
+ // 使用我们自己写的路由 跳转交互
+ RouterManager.getInstance()
+ .build("/personal/Personal_MainActivity")
+ .withString("name", "史甄湘")
+ .withString("sex", "男")
+ .withInt("age", 99)
+ .withSerializable("student", student)
+ .navigation(this);
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/MyCrashHandler.java b/app/src/main/java/com/fisherbone/fuzhu/MyCrashHandler.java
new file mode 100644
index 0000000..7b7e517
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/MyCrashHandler.java
@@ -0,0 +1,63 @@
+package com.fisherbone.fuzhu;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.fisherbone.fuzhu.okgonet.HttpConstants;
+import com.fisherbone.fuzhu.okgonet.NetApi;
+import com.lzy.okgo.model.HttpParams;
+import com.lzy.okgo.model.Response;
+
+class MyCrashHandler implements Thread.UncaughtExceptionHandler {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ againStart();
+ Log.e("TIAOSHI###", "闪退了");
+// Intent intent = new Intent(mContext, MainActivity.class);
+// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+// mContext.startActivity(intent);
+ System.exit(0);// 关闭已奔溃的app进程
+
+ }
+
+ public static MyCrashHandler getInstance() {
+ return INSTANCE;
+ }
+ // CrashHandler实例
+ private static MyCrashHandler INSTANCE = new MyCrashHandler();
+ // 程序的Context对象
+ private Context mContext;
+
+ /**
+ * 初始化
+ *
+ * @param context
+ */
+ public void init(Context context) {
+ mContext = context;
+ // 获取系统默认的UncaughtException处理
+ // mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
+ // 设置该CrashHandler为程序的默认处理
+ Thread.setDefaultUncaughtExceptionHandler(this);
+ }
+
+ private void againStart() {
+ final HttpParams paramsPost = new HttpParams();
+ paramsPost.put("task_status", "0");
+ paramsPost.put("task_id", ChangLiang.task_id);
+ paramsPost.put("task_type", ChangLiang.task_type);
+ new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appscanlogin_againStart).subscribe(new com.fisherbone.fuzhu.okgonet.Observer() {
+ @Override
+ public void onNext(Response response) {
+ String body = (String) response.body();
+ Log.e("需通知后台重新启动", body);
+ }
+
+ @Override
+ public void onError(Exception e) {
+ e.printStackTrace();
+
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/MyFileProvider.java b/app/src/main/java/com/fisherbone/fuzhu/MyFileProvider.java
new file mode 100644
index 0000000..a0343ef
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/MyFileProvider.java
@@ -0,0 +1,6 @@
+package com.fisherbone.fuzhu;
+
+import androidx.core.content.FileProvider;
+
+public class MyFileProvider extends FileProvider {
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/MyProvider.java b/app/src/main/java/com/fisherbone/fuzhu/MyProvider.java
new file mode 100644
index 0000000..81e6722
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/MyProvider.java
@@ -0,0 +1,11 @@
+package com.fisherbone.fuzhu;
+
+import androidx.core.content.FileProvider;
+
+/**
+ * Time: 2020/6/1
+ * Author: jianbo
+ * Description:
+ */
+public class MyProvider extends FileProvider {
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/Neirong.java b/app/src/main/java/com/fisherbone/fuzhu/Neirong.java
new file mode 100644
index 0000000..426fbc3
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/Neirong.java
@@ -0,0 +1,6 @@
+package com.fisherbone.fuzhu;
+
+public class Neirong {
+ public static String neirong="";
+ public static boolean hasNeirong=false;
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/PhoneActivity.java b/app/src/main/java/com/fisherbone/fuzhu/PhoneActivity.java
new file mode 100644
index 0000000..8d2f6be
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/PhoneActivity.java
@@ -0,0 +1,625 @@
+package com.fisherbone.fuzhu;
+
+import android.content.ContentProviderOperation;
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.OperationApplicationException;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.RemoteException;
+import android.provider.ContactsContract;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.fisherbone.fuzhu.config.Callback;
+import com.fisherbone.fuzhu.utils.MyToast;
+import com.fisherbone.fuzhu.utils.PrefUtils;
+import com.fisherbone.fuzhu.views.ConfirmDialog;
+import com.fisherbone.fuzhu.views.LoadingDialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+/**
+ * Created by Eren on 2017/6/23.
+ *
+ * 通讯录
+ */
+public class PhoneActivity extends BaseActivity implements RadioGroup.OnCheckedChangeListener {
+ @BindView(R.id.iv_back)
+ ImageView mIvBack;
+ @BindView(R.id.tv_content_city)
+ TextView mTvContentCity;
+ @BindView(R.id.rl_city)
+ RelativeLayout mRlCity;
+ @BindView(R.id.rv_phone)
+ RecyclerView mRvPhone;
+ @BindView(R.id.but_begin)
+ Button mButBegin;
+ @BindView(R.id.clean_phone)
+ RelativeLayout mCleanPhone;
+ @BindView(R.id.open_phone)
+ RelativeLayout mOpenPhone;
+ @BindView(R.id.import_phone)
+ RelativeLayout mImportPhone;
+ @BindView(R.id.smash_phone)
+ RelativeLayout mSmashPhone;
+ @BindView(R.id.mobile)
+ RadioButton mMobile;
+ @BindView(R.id.telecom)
+ RadioButton mTelecom;
+ @BindView(R.id.unicom)
+ RadioButton mUnicom;
+ @BindView(R.id.rg_opera)
+ RadioGroup mRgOpera;
+ // private MyApplication mApp;
+ /**
+ * 自定义对话框
+ */
+ private ConfirmDialog mConfirmDialog;
+ /**
+ * 跳转返回时的flag
+ */
+ private static final int REQUEST_CODE_PICK_CITY = 0;
+ /**
+ * 选中的城市
+ */
+ private String city;
+ /**
+ * 获取所有符合号段集合
+ */
+ // private List mCityPhoneList;
+
+ private List phoneNumber = new ArrayList<>();
+ // private PhoneRvAdapter mRvAdapter;
+
+ private LoadingDialog mLoadingDialog;
+
+ /**
+ * 导入通讯录
+ */
+ public static final int IMPORT_PHONE = 0;
+ /**
+ * 导入完成
+ */
+ public static final int IMPORT_PHONE_OVER = 1;
+ /**
+ * 清空号码段
+ */
+ public static final int CLEAN_PHONE = 2;
+ /**
+ * 清空通讯录
+ */
+ public static final int CLEAN_PHONE_BOOK = 3;
+ /**
+ * 通讯录清空完成
+ */
+ public static final int CLEAN_PHONE_OVER = 4;
+
+
+ private Handler myHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case IMPORT_PHONE:
+ //加载进度
+ mLoadingDialog = new LoadingDialog(PhoneActivity.this);
+ mLoadingDialog.setContent("正在导入通讯录...");
+ mLoadingDialog.setCancelable(false);
+ mLoadingDialog.show();
+ break;
+
+ case IMPORT_PHONE_OVER:
+ mLoadingDialog.dismiss();
+
+ MyToast.show(PhoneActivity.this, "导入成功");
+ break;
+
+ case CLEAN_PHONE:
+ MyToast.show(PhoneActivity.this, "清空成功");
+
+ break;
+
+ case CLEAN_PHONE_BOOK:
+ //清空通讯录
+ mLoadingDialog = new LoadingDialog(PhoneActivity.this);
+ mLoadingDialog.setContent("正在清空通讯录...");
+ mLoadingDialog.setCancelable(false);
+ mLoadingDialog.show();
+ break;
+
+ case CLEAN_PHONE_OVER:
+ mLoadingDialog.dismiss();
+ MyToast.show(PhoneActivity.this, "清空成功");
+ break;
+ default:
+ }
+ }
+ };
+ // private CityNumberBean.AutoCityBean mCityNumberBean = new CityNumberBean.AutoCityBean();
+
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_phone);
+ ButterKnife.bind(this);
+// mApp = (MyApplication) getApplication();
+// initRg();
+// initRv();
+
+
+ findViewById(R.id.clean_phone).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ phoneNumber.add("18133922189");
+ phoneNumber.add("18133922190");
+ phoneNumber.add("18133922191");
+ phoneNumber.add("18133922192");
+ phoneNumber.add("18133922193");
+ phoneNumber.add("18133922194");
+
+ if (phoneNumber.size() == 0) {
+ MyToast.show(PhoneActivity.this, "号码不能为空");
+ } else {
+ mConfirmDialog = new ConfirmDialog(PhoneActivity.this, new Callback() {
+ @Override
+ public void Positive() {
+ new Thread( new Runnable() {
+ @Override
+ public void run() {
+ myHandler.sendEmptyMessage(IMPORT_PHONE);
+ try {
+ testAddContactsInTransaction();
+ // writeContact();
+ // addContacts("ddd","18133988585");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ myHandler.sendEmptyMessage(IMPORT_PHONE_OVER);
+ }
+ }).start();
+ }
+ @Override
+ public void Negative() {
+ mConfirmDialog.dismiss();
+ }
+ });
+ mConfirmDialog.setContent("提示:" + "\n是否导入通讯录");
+ mConfirmDialog.setCancelable(true);
+ mConfirmDialog.show();
+ }
+ }
+ });
+ }
+
+ /**
+ * 初始化运营商
+ */
+// private void initRg() {
+// if (mApp.mCityNumberList.size() > 0 && mApp.mCityNumberList != null) { //如果网络获取成功
+// mCityNumberBean = mApp.mCityNumberList.get(0);
+// //从网络里获取城市
+// city = mCityNumberBean.getCity();
+// mTvContentCity.setText(city);
+//
+// PrefUtils.putString(PhoneActivity.this, "phone_area", city);
+//
+// //从网络里获取运营商
+// String operator = mCityNumberBean.getOperator();
+// Log.i("123", operator);
+// PrefUtils.putString(PhoneActivity.this, "phone_opera", operator); //如果网络获取成功,设置成网络运营商
+// } else {
+// PrefUtils.putString(PhoneActivity.this, "phone_opera", "移动"); //如果网络获取失败,第一次默认是移动,不设置会出现空白状态
+// PrefUtils.putString(PhoneActivity.this, "phone_area", "无锡");
+// city = "无锡";
+// mTvContentCity.setText("无锡");
+// Log.i("123", "AAAA");
+// }
+// //从网络获取的运营商选中状态
+// switch (PrefUtils.getString(PhoneActivity.this, "phone_opera", "移动")) {
+// case "移动":
+// mMobile.setChecked(true);
+// break;
+//
+// case "电信":
+// mTelecom.setChecked(true);
+// break;
+//
+// case "联通":
+// mUnicom.setChecked(true);
+// break;
+// }
+// mRgOpera.setOnCheckedChangeListener(this);
+// }
+
+ /**
+ * 初始化RecyclerView
+ */
+// private void initRv() {
+// mRvPhone.setLayoutManager(new GridLayoutManager(this, 2));
+// mRvAdapter = new PhoneRvAdapter(PhoneActivity.this, phoneNumber);
+// mRvPhone.setAdapter(mRvAdapter);
+// mRvPhone.addItemDecoration(new SpaceItemDecoration(10));
+//
+// }
+
+ @OnClick({R.id.iv_back, R.id.rl_city, R.id.but_begin, R.id.clean_phone, R.id.open_phone, R.id.import_phone, R.id.smash_phone})
+ public void onViewClicked(View view) {
+ switch (view.getId()) {
+ case R.id.iv_back: //返回按钮
+ // outAnimation();
+ break;
+ case R.id.rl_city: //选择城市
+// startActivityForResult(new Intent(PhoneActivity.this, CityPickerActivity.class), REQUEST_CODE_PICK_CITY);
+// overridePendingTransition(R.anim.anim_in, R.anim.anim_out);
+ break;
+ case R.id.but_begin: //生成号码段
+// phoneNumber.clear();
+// if (city == null) { // 判断有没有选择城市
+// MyToast.show(PhoneActivity.this, "未选择城市");
+// } else {
+// mRvPhone.setVisibility(View.VISIBLE);
+// CityPhoneDao cityPhoneDao = new CityPhoneDao(PhoneActivity.this);
+// mCityPhoneList = cityPhoneDao.findAll();
+// // 循环加入集合,后四位随机生成
+// for (int i = 0; i < mCityPhoneList.size(); i++) {
+// for (int j = 0; j < 5; j++) {
+// String phoneNum = mCityPhoneList.get(i).getName() + (int) (Math.random() * 9000 + 1000);
+// phoneNumber.add(phoneNum);
+// }
+// }
+// //刷新适配器
+// mRvAdapter = new PhoneRvAdapter(PhoneActivity.this, phoneNumber);
+// mRvPhone.setAdapter(mRvAdapter);
+// }
+ break;
+
+ case R.id.clean_phone: //导入通讯录
+ phoneNumber.add("18133922190");
+ phoneNumber.add("18133922188");
+
+ if (phoneNumber.size() == 0) {
+ MyToast.show(PhoneActivity.this, "号码不能为空");
+ } else {
+ mConfirmDialog = new ConfirmDialog(PhoneActivity.this, new Callback() {
+ @Override
+ public void Positive() {
+ new Thread( new Runnable() {
+ @Override
+ public void run() {
+ myHandler.sendEmptyMessage(IMPORT_PHONE);
+ try {
+ testAddContactsInTransaction();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ myHandler.sendEmptyMessage(IMPORT_PHONE_OVER);
+ }
+ }).start();
+ }
+ @Override
+ public void Negative() {
+ mConfirmDialog.dismiss();
+ }
+ });
+ mConfirmDialog.setContent("提示:" + "\n是否导入通讯录");
+ mConfirmDialog.setCancelable(true);
+ mConfirmDialog.show();
+ }
+ break;
+
+ case R.id.open_phone: // 打开联系人界面
+
+ Intent intent = new Intent();
+ intent.setClassName("com.android.contacts", "com.android.contacts.activities.PeopleActivity");
+ startActivity(intent);
+ break;
+ case R.id.import_phone: //清空号码段
+ if (phoneNumber.size() == 0) {
+ MyToast.show(PhoneActivity.this, "号码为空");
+ } else {
+ mConfirmDialog = new ConfirmDialog(PhoneActivity.this, new Callback() {
+ @Override
+ public void Positive() {
+ phoneNumber.clear();
+ mRvPhone.setVisibility(View.GONE);
+ myHandler.sendEmptyMessage(CLEAN_PHONE);
+ }
+ @Override
+ public void Negative() {
+ mConfirmDialog.dismiss();
+ }
+ });
+ mConfirmDialog.setContent("提示:" + "\n是否清空电话号码");
+ mConfirmDialog.setCancelable(true);
+ mConfirmDialog.show();
+ }
+ break;
+ case R.id.smash_phone: //清空通讯录
+ mConfirmDialog = new ConfirmDialog(PhoneActivity.this, new Callback() {
+ @Override
+ public void Positive() {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ myHandler.sendEmptyMessage(CLEAN_PHONE_BOOK);
+ clearContent();
+// cleanphone();
+ myHandler.sendEmptyMessage(CLEAN_PHONE_OVER);
+ }
+ }).start();
+ }
+
+ @Override
+ public void Negative() {
+ mConfirmDialog.dismiss();
+ }
+ });
+ mConfirmDialog.setContent("提示:" + "\n是否清空通讯录");
+ mConfirmDialog.setCancelable(true);
+ mConfirmDialog.show();
+ break;
+ default:
+ }
+
+ }
+
+// @Override
+// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+// if (requestCode == REQUEST_CODE_PICK_CITY && resultCode == RESULT_OK) {
+// if (data != null) {
+// city = data.getStringExtra(CityPickerActivity.KEY_PICKED_CITY);
+// mTvContentCity.setText(city);
+// PrefUtils.putString(PhoneActivity.this, "phone_area", city);
+// }
+// }
+// }
+//
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ switch (checkedId) {
+ case R.id.mobile:
+ PrefUtils.putString(PhoneActivity.this, "phone_opera", "移动");
+ break;
+
+ case R.id.telecom:
+ PrefUtils.putString(PhoneActivity.this, "phone_opera", "电信");
+ break;
+
+ case R.id.unicom:
+ PrefUtils.putString(PhoneActivity.this, "phone_opera", "联通");
+ break;
+ default:
+ }
+ }
+
+
+ /**
+ * 清空系统通信录数据
+ */
+ public void clearContent() {
+ ContentResolver cr = PhoneActivity.this.getContentResolver();// 获取
+ // ContentResolver对象查询在ContentProvider里定义的共享对象
+ // 根据URI对象ContactsContract.Contacts.CONTENT_URI查询所有联系人
+ Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
+ try {
+ // 如果记录不为空
+ if (cursor != null) {
+ // 游标初始指向查询结果的第一条记录的上方,执行moveToNext函数会判断
+ // 下一条记录是否存在,如果存在,指向下一条记录。否则,返回false。
+ // 循环
+ while (cursor.moveToNext()) {
+ String name = cursor
+ .getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
+ // 根据姓名求id
+ Uri uri = Uri.parse("content://com.android.contacts/raw_contacts");
+
+ Cursor cursor1 = cr.query(uri, new String[]{ContactsContract.Data._ID}, "display_name=?", new String[]{name},
+ null);
+ // 除去姓名对应的号码
+ if (cursor1.moveToFirst()) {
+ int id = cursor1.getInt(0);
+ cr.delete(uri, "display_name=?", new String[]{name});
+ // 根据id删除data中的相应数据
+ uri = Uri.parse("content://com.android.contacts/data");
+ cr.delete(uri, "raw_contact_id=?", new String[]{id + ""});
+ }
+ cursor1.close();// Cursor循环内再申请Cursor,记得将内部申请的每个Cursor都加上close
+ }
+ cursor.close();
+
+ } else {
+ Toast.makeText(PhoneActivity.this, "通讯录为空", Toast.LENGTH_SHORT).show();
+ }
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ }
+
+// private void cleanphone(){
+// ContentResolver cr = PhoneActivity.this.getContentResolver();// 获取
+// Cursor contactsCur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
+// while(contactsCur.moveToNext()){
+// //获取ID
+// String rawId = contactsCur.getString(contactsCur.getColumnIndex(ContactsContract.Contacts._ID));
+// //删除
+// String where = ContactsContract.Data._ID + " =?";
+// String[] whereparams = new String[]{rawId};
+// getContentResolver().delete(ContactsContract.RawContacts.CONTENT_URI, where, whereparams);
+// }
+// }
+
+
+ /**
+ * 批量添加联系人到通讯录中
+ *
+ * @throws Exception
+ */
+ public void testAddContactsInTransaction() throws Exception {
+ ArrayList mOperations = new ArrayList<>();
+ ContentResolver resolver = PhoneActivity.this.getContentResolver();
+ int rawContactInsertIndex;
+ // 循环添加
+ for (int i = 0; i < phoneNumber.size(); i++) {
+ Uri uri = Uri.parse("content://com.android.contacts/raw_contacts");
+ rawContactInsertIndex = mOperations.size();// 这句好很重要,有了它才能给真正的实现批量添加。
+ // 向raw_contact表添加一条记录
+ // 此处.withValue("account_name", null)一定要加,不然会抛NullPointerException
+ ContentProviderOperation operation1 = ContentProviderOperation.newInsert(uri)
+ .withValue("account_name", null).build();
+ mOperations.add(operation1);
+ // 向data添加数据
+ uri = Uri.parse("content://com.android.contacts/data");
+ // 添加姓名
+ ContentProviderOperation operation2 = ContentProviderOperation.newInsert(uri)
+ .withValueBackReference("raw_contact_id", rawContactInsertIndex)
+ // withValueBackReference的第二个参数表示引用operations[0]的操作的返回id作为此值
+ .withValue("mimetype", "vnd.android.cursor.item/name").withValue("data2", phoneNumber.get(i))
+ .withYieldAllowed(true).build();
+ mOperations.add(operation2);
+ // 添加手机数据
+ ContentProviderOperation operation3 = ContentProviderOperation.newInsert(uri)
+ .withValueBackReference("raw_contact_id", rawContactInsertIndex)
+ .withValue("mimetype", "vnd.android.cursor.item/phone_v2").withValue("data2", "2")
+ .withValue("data1", phoneNumber.get(i)).withYieldAllowed(true).build();
+ mOperations.add(operation3);
+
+ }
+ try {
+ // 这里才调用的批量添加
+ resolver.applyBatch("com.android.contacts", mOperations);
+
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (OperationApplicationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ myHandler.removeCallbacksAndMessages(null);
+ }
+
+
+
+ /**
+ * 导入到通讯录
+ */
+ public void addContacts(String name , String tel){
+ name = name+"@客户管理";
+ //插入raw_contacts表,并获取_id属性
+ Uri uri = Uri.parse("content://com.android.contacts/raw_contacts");
+ ContentResolver resolver = getContentResolver();
+ ContentValues values = new ContentValues();
+ long contact_id = ContentUris.parseId(resolver.insert(uri, values));
+ //插入data表
+ uri = Uri.parse("content://com.android.contacts/data");
+ //add Name
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE,"vnd.android.cursor.item/name");
+ values.put("data2", name);
+ values.put("data1", name);
+ resolver.insert(uri, values);
+ values.clear();
+ //add Phone
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE,"vnd.android.cursor.item/phone_v2");
+ values.put("data2", "2"); //手机
+ values.put("data1", tel);
+ resolver.insert(uri, values);
+ values.clear();
+ /*//add email
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE,"vnd.android.cursor.item/email_v2");
+ values.put("data2", "2"); //单位
+ values.put("data1", "xzdong@xzdong.com");
+ resolver.insert(uri, values);*/
+ }
+
+
+ /**
+ * 写入手机联系人
+ */
+ private void writeContact() {
+ String name = "test";
+ String number = "13666668888";
+
+ //先查询要添加的号码是否已存在通讯录中, 不存在则添加. 存在则提示用户
+ Uri uri = Uri.parse("content://com.android.contacts/data/phones/filter/" + number);
+ ContentResolver resolver = getContentResolver();
+ //从raw_contact表中返回display_name
+ Cursor cursor = resolver.query(uri, new String[]{ContactsContract.Data.DISPLAY_NAME}, null, null, null);
+ if (cursor == null)
+ return;
+
+ if (cursor.moveToFirst()) {
+ Log.i("nn", "name=" + cursor.getString(0));
+ Toast.makeText(this, "存在相同号码", Toast.LENGTH_SHORT).show();
+ } else {
+ uri = Uri.parse("content://com.android.contacts/raw_contacts");
+ ContentValues values = new ContentValues();
+ long contact_id = ContentUris.parseId(resolver.insert(uri, values));
+ //插入data表
+ uri = Uri.parse("content://com.android.contacts/data");
+ //add Name
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/name");
+ values.put("data2", "qq");
+ values.put("data1", name);
+ resolver.insert(uri, values);
+ values.clear();
+
+ //add Phone
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/phone_v2");
+ values.put("data2", "2"); //手机
+ values.put("data1", number);
+ resolver.insert(uri, values);
+ values.clear();
+
+ //add email
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/email_v2");
+ values.put("data2", "1"); //邮箱
+ values.put("data1", "xxxx@qq.com");
+ resolver.insert(uri, values);
+ values.clear();
+
+ //add organization
+ values.put("raw_contact_id", contact_id);
+ values.put(ContactsContract.Data.MIMETYPE, "vnd.android.cursor.item/organization");
+ values.put("data4", "产品经理"); //职务
+ values.put("data1", "腾讯科技"); //公司
+ resolver.insert(uri, values);
+ values.clear();
+
+ Toast.makeText(this, "插入号码成功", Toast.LENGTH_SHORT).show();
+ }
+ cursor.close();
+ }
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/RandumInt.java b/app/src/main/java/com/fisherbone/fuzhu/RandumInt.java
new file mode 100644
index 0000000..d22de08
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/RandumInt.java
@@ -0,0 +1,20 @@
+package com.fisherbone.fuzhu;
+
+import java.util.Random;
+
+/*产生一个1~4之间的随机数*/
+public class RandumInt {
+ public static int getRandumInt4(){
+ return new Random().nextInt(4)+1;
+ }
+ public static int getRandumInt3(){
+ return new Random().nextInt(3)+1;
+ }
+ public static int getRandumInt2(){
+ return new Random().nextInt(2)+1;
+ }
+ public static int getRandumInt10to20(){
+ return new Random().nextInt(15)+1;
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/TaskChangLiang.java b/app/src/main/java/com/fisherbone/fuzhu/TaskChangLiang.java
new file mode 100644
index 0000000..e1ee5f7
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/TaskChangLiang.java
@@ -0,0 +1,8 @@
+package com.fisherbone.fuzhu;
+
+public class TaskChangLiang {
+
+
+
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/TestTwoService.java b/app/src/main/java/com/fisherbone/fuzhu/TestTwoService.java
new file mode 100644
index 0000000..3acd3cf
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/TestTwoService.java
@@ -0,0 +1,58 @@
+package com.fisherbone.fuzhu;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.util.Log;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+
+/**
+ * Created by Kathy on 17-2-6.
+ */
+
+public class TestTwoService extends Service {
+ protected final String TAG = this.getClass().getSimpleName();
+ //client 可以通过Binder获取Service实例
+ public class MyBinder extends Binder {
+ public TestTwoService getService() {
+ return TestTwoService.this;
+ }
+ }
+ //通过binder实现调用者client与Service之间的通信
+ private MyBinder binder = new MyBinder();
+
+ @Override
+ public void onCreate() {
+ Log.i("Kathy","TestTwoService - onCreate - Thread = " + Thread.currentThread().getName());
+ super.onCreate();
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.i("Kathy", "TestTwoService - onStartCommand - startId = " + startId + ", Thread = " + Thread.currentThread().getName());
+ return START_NOT_STICKY;
+ }
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ Log.i("Kathy", "TestTwoService - onBind - Thread = " + Thread.currentThread().getName());
+ Toast.makeText(this, "服务已经启动", Toast.LENGTH_LONG).show();
+ return binder;
+ }
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ Log.i("Kathy", "TestTwoService - onUnbind - from = " + intent.getStringExtra("from"));
+ return false;
+ }
+
+ @Override
+ public void onDestroy() {
+ Log.i("Kathy", "TestTwoService - onDestroy - Thread = " + Thread.currentThread().getName());
+ super.onDestroy();
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/XiangxueNetwork.java b/app/src/main/java/com/fisherbone/fuzhu/XiangxueNetwork.java
new file mode 100644
index 0000000..8baa6af
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/XiangxueNetwork.java
@@ -0,0 +1,31 @@
+package com.fisherbone.fuzhu;//package com.fisherbone.fuzhu;
+
+import android.app.Application;
+
+import com.xiangxue.common.network.base.INetworkRequiredInfo;
+
+public class XiangxueNetwork implements INetworkRequiredInfo {
+ private Application mApplication;
+ public XiangxueNetwork(Application application){
+ this.mApplication = application;
+ }
+ @Override
+ public String getAppVersionName() {
+ return BuildConfig.VERSION_NAME;
+ }
+
+ @Override
+ public String getAppVersionCode() {
+ return String.valueOf(BuildConfig.VERSION_CODE);
+ }
+
+ @Override
+ public boolean isDebug() {
+ return BuildConfig.DEBUG;
+ }
+
+ @Override
+ public Application getApplicationContext() {
+ return mApplication;
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblConfig.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblConfig.java
new file mode 100644
index 0000000..291774b
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblConfig.java
@@ -0,0 +1,87 @@
+package com.fisherbone.fuzhu.abllib;
+
+import com.blankj.utilcode.util.LogUtils;
+
+/**
+ * 2019/4/21
+ * 17:49
+ * Levine
+ * wechat 1483232332
+ */
+public class AblConfig {
+
+ private String mLogTag;
+ private boolean mIsLog;
+ private long mStepMsgDelayMillis;//消息延迟发送时间
+ private long findViewMillisInFuture;//查找view倒计时总时长
+ private long findViewCountDownInterval;//查找view检查间隔时间
+ /**
+ * 所监测的APP包名,如果不设置将会监听整个系统的界面变化,如果设置后只会监听指定包名的APP
+ * 【暂时不用】
+ */
+ public static String[] sMonitoringPackageNames;
+
+ private AblConfig(Builder builder) {
+ mLogTag = builder.mLogTag;
+ mIsLog = builder.mIsLog;
+ sMonitoringPackageNames = builder.mMonitoringPackageNames;
+ mStepMsgDelayMillis = builder.mStepMsgDelayMillis;
+ findViewCountDownInterval = builder.findViewCountDownInterval;
+ findViewMillisInFuture = builder.findViewMillisInFuture;
+ }
+
+ public void init() {
+ LogUtils.getConfig().setGlobalTag(mLogTag);
+ LogUtils.getConfig().setLogSwitch(mIsLog);
+ AblStepHandler.getInstance().setStepMsgDelayMillis(mStepMsgDelayMillis);
+ FindViewCountDown.countDownInterval = findViewCountDownInterval;
+ FindViewCountDown.millisInFuture = findViewMillisInFuture;
+ }
+
+ public static Builder Builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String mLogTag = "abllib";
+ private boolean mIsLog = true;
+ private String[] mMonitoringPackageNames;
+ private long mStepMsgDelayMillis = 2000;//步骤延迟发送时间
+ private long findViewMillisInFuture = 10000;//查找view倒计时总时长
+ private long findViewCountDownInterval = 500;//查找view检查间隔时间
+
+ public Builder setLogTag(String logTag) {
+ mLogTag = logTag;
+ return this;
+ }
+
+ public Builder setLog(boolean log) {
+ mIsLog = log;
+ return this;
+ }
+
+ public Builder setMonitoringPackageNames(String... monitoringPackageNames) {
+ mMonitoringPackageNames = monitoringPackageNames;
+ return this;
+ }
+
+ public Builder setStepMsgDelayMillis(long stepMsgDelayMillis) {
+ mStepMsgDelayMillis = stepMsgDelayMillis;
+ return this;
+ }
+
+ public Builder setFindViewMillisInFuture(long findViewMillisInFuture) {
+ this.findViewMillisInFuture = findViewMillisInFuture;
+ return this;
+ }
+
+ public Builder setFindViewCountDownInterval(long findViewCountDownInterval) {
+ this.findViewCountDownInterval = findViewCountDownInterval;
+ return this;
+ }
+
+ public AblConfig build() {
+ return new AblConfig(this);
+ }
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblService.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblService.java
new file mode 100644
index 0000000..01dbd2a
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblService.java
@@ -0,0 +1,653 @@
+package com.fisherbone.fuzhu.abllib;
+
+import android.accessibilityservice.AccessibilityService;
+import android.accessibilityservice.GestureDescription;
+import android.annotation.TargetApi;
+import android.content.Intent;
+import android.graphics.Path;
+import android.graphics.Rect;
+import android.os.Build;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import androidx.annotation.RequiresApi;
+
+import com.blankj.utilcode.util.LogUtils;
+import com.fisherbone.fuzhu.ChangLiang;
+import com.fisherbone.fuzhu.FuzhuApplication;
+import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
+import com.fisherbone.fuzhu.db.CommentBeanData;
+import com.fisherbone.fuzhu.db.dao.CommentDao;
+import com.fisherbone.fuzhu.entity.SixEvent;
+import com.jeremyliao.liveeventbus.LiveEventBus;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import de.greenrobot.event.EventBus;
+import io.reactivex.disposables.Disposable;
+
+/**
+ * 2019/4/21
+ * 11:29
+ * Levine
+ * wechat 1483232332
+ */
+public class AblService extends AccessibilityService {
+
+ private static AblService mAblService;
+ private Disposable mdDisposable;
+ private String TAG = "commongendan";
+ public String SHEBEITIPE_VILUETHREE = "3";
+
+ public static AblService getInstance() {
+ if (mAblService == null) {
+ throw new NullPointerException("AblService辅助服务未开启");
+ }
+ return mAblService;
+ }
+
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ public void inputClickId(String clickId) {
+ AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
+ if (nodeInfo != null) {
+ List list = nodeInfo.findAccessibilityNodeInfosByText(clickId);
+ for (AccessibilityNodeInfo item : list) {
+ clickcommontwo(item, clickId);
+ }
+ }
+ }
+
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mAblService = this;
+ init();
+ }
+
+ private void init() {
+
+ }
+
+ /**
+ * 系统成功绑定该服务时被触发,也就是当你在设置中开启相应的服务,
+ * 系统成功的绑定了该服务时会触发,通常我们可以在这里做一些初始化操作
+ */
+ @Override
+ protected void onServiceConnected() {
+ super.onServiceConnected();
+ LogUtils.v("onServiceConnected");
+ Log.e("TIAOSHI", "无障碍服务开启");
+ LiveEventBus.get("ablservice").post("无障碍服务开启");
+ }
+
+ private ArrayList objects = new ArrayList<>();
+
+ @Override
+ public void onAccessibilityEvent(AccessibilityEvent event) {
+// if("2".equals(ChangLiang.phonetype)) {
+// if ("T".equals(ChangLiang.qidong)) {
+// ChangLiang.qidong = "F";
+// AblViewUtil.startApplication();
+// AblViewUtil.mySleep(10);
+// DianSou();
+// AblViewUtil.mySleep(3);
+// AccessibilityNodeInfo findcomentt = findEditText();
+// String content = "178421572";
+// Log.e("TIAOSHI###", "获得的关键词内容" + content);
+// AblViewUtil.mySleep(1);
+// if ("0".equals(ChangLiang.phonetype)) {
+// AblViewUtil.sayInput(content, findcomentt);
+// } else {
+// //华为畅享20
+// AblViewUtil.sayInput(content, findcomentt);
+// }
+// AblViewUtil.mySleep(3);
+// DianSou();
+// AblViewUtil.mySleep(5);
+// //进入直播间
+// if ("0".equals(ChangLiang.phonetype) || "1".equals(ChangLiang.phonetype)) {
+// AblService.getInstance().clickPoint(705, 198, 300);
+// } else {
+// AblService.getInstance().clickPoint(1058, 300, 300);
+// }
+// AblViewUtil.mySleep(3);
+// if ("0".equals(ChangLiang.phonetype)) {
+// AblService.getInstance().clickPoint(100, 300, 300);
+// } else {
+// //华为畅享20
+// AblService.getInstance().clickPoint(200, 400, 300);
+// }
+// AblViewUtil.mySleep(1);
+// ansy();
+// }
+// }
+
+
+ LogUtils.v(event.getPackageName() + "");
+ if (ChangLiang.gendanopen == 1) {
+ scroll2PositionClick(this, "6");
+ }
+
+
+ int eventType = event.getEventType();
+
+ switch (eventType) {
+ //当通知栏发生改变的时候
+ case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
+ Log.w("TIAOSHI", "有弹出======11111" + "==classname==");
+ break;
+ //当窗口状态发生改变的时候
+ case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
+ String classname = event.getClassName().toString();
+ Log.e("TIAOSHI", "有弹出==22222" + "==classname==" + classname);
+ List text = event.getText();
+ if (text.size() > 0) {
+ CharSequence charSequence = text.get(0);
+ String str = charSequence.toString();
+ // Log.w("TIAOSHI", "有弹出==" + str + "==classname==" + classname);
+ String s = charSequence.toString();
+ Log.w("TIAOSHI", "有弹出==" + s + "==classname==" + classname);
+ if (!TextUtils.isEmpty(s)) {
+ EventBus.getDefault().post(new SixEvent("success", s));
+ }
+ if (classname.equals("android.app.AlertDialog")) {
+
+ } else if (classname.equals("com.android.packageinstaller.permission.ui.GrantPermissionsActivity")) {
+// //点击安装
+// AblViewUtil.mySleep(2);
+// inputClickId("始终允许");
+ } else if (classname.equals("com.android.packageinstaller.PackageInstallerActivity")) {
+ //点击安装
+ inputClickId("安装");
+ } else if (classname.equals("com.android.packageinstaller.InstallAppProgress")) {
+ //点击打开
+ AblViewUtil.mySleep(5);
+ inputClickId("打开");
+ } else if (classname.equals("android.app.Dialog")) {//测试可以用
+ if (str.contains("朋友推荐")) {
+ AblViewUtil.mySleep(2);
+ performGlobalAction(GLOBAL_ACTION_BACK); // 返回安装页面
+ Log.e("TIAOSHI###", "关闭了好友推荐的弹框");
+ }
+ } else if (classname.equals("androidx.appcompat.app.AlertDialog")) {
+ if (str.contains("为呵护未成")) {
+ AblViewUtil.mySleep(2);
+ performGlobalAction(GLOBAL_ACTION_BACK); // 返回安装页面
+ Log.e("TIAOSHI###", "关闭了为呵护未成年人健康成长的弹框");
+ }
+ } else if (str.contains("检测到更新")) {//测试可以用
+ LiveEventBus.get("runningstate").post("0");
+ AblViewUtil.mySleep(2);
+ inputClickId("以后再说");
+ Log.e("TIAOSHI###", "关闭了检测到更新的弹框");
+ } else if (str.contains("发现通讯录朋友")) {//测试可以用
+ LiveEventBus.get("runningstate").post("0");
+ AblViewUtil.mySleep(2);
+ inputClickId("暂时不要");
+ Log.e("TIAOSHI###", "AblService关闭了发现通讯录好友的弹框");
+ } else if (str.contains("由于该用户隐私设置")) {
+
+ } else if (str.contains("个人信息保护指引")) {
+ LiveEventBus.get("runningstate").post("0");
+ } else if (str.contains("欢迎体验抖音浅色模式")) {
+ LiveEventBus.get("runningstate").post("0");
+ } else if (str.contains("朋友推荐")) {
+ LiveEventBus.get("runningstate").post("0");
+ } else if (str.contains("设置抖音号")) {
+ LiveEventBus.get("runningstate").post("0");
+ }
+
+ break;
+ }
+ default:
+ }
+ }
+
+
+ public void scroll2PositionClick(AccessibilityService service, String text) {
+ try {
+ Thread.sleep(5000); //隔200 ms 滚动一次
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { //必须android4.3以上的版本
+ getdouyindsf();
+ }
+ }
+
+ private void getdouyindsf() {
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ Log.e("TIAOSHI###跟", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ for (int y = 0; y < child.getChildCount(); y++) {
+ AccessibilityNodeInfo child1 = child.getChild(y);
+ Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
+ if ("androidx.recyclerview.widget.RecyclerView".equals(child1.getClassName())) {
+ for (int j = 0; j < child1.getChildCount(); j++) {
+ AccessibilityNodeInfo child2 = child1.getChild(j);
+ Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
+ for (int x = 0; x < child2.getChildCount(); x++) {
+ AccessibilityNodeInfo child3 = child2.getChild(x);
+ Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
+ if ("android.widget.TextView".equals(child3.getClassName())) {
+ String content = child3.getText().toString();
+ if (!TextUtils.isEmpty(content)) {
+ //检索内容里面是否有数字
+ String[] buff = content.split(":");
+ String sdfsd = buff[buff.length - 1];
+ Log.e("获得结果----", sdfsd + "");
+ fasongpinglun(sdfsd);
+ if (sdfsd.length() == 1) {
+ Log.e("获得结果----", sdfsd + "");
+ if (Compliance(sdfsd)) {
+ ChangLiang.genfaneirong = sdfsd;
+ ChangLiang.gendanopen = 0;
+ Log.d(TAG, "获得结果----有数字=====" + content);
+ //跟发数字
+ fasongpinglun(ChangLiang.genfaneirong);
+ break;
+ } else {
+ Log.d(TAG, "获得结果----中没有数字");
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public boolean Compliance(String substring) {
+ if (substring.contains("0") || substring.contains("1") || substring.contains("2") || substring.contains("3") || substring.contains("4") || substring.contains("5") || substring.contains("6") || substring.contains("7") || substring.contains("8") || substring.contains("9")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ private void fasongpinglun(String conment) {
+ //直播间话术
+ AblViewUtil.mySleep(2);
+ clickmoreli("1");
+ AblViewUtil.mySleep(2);
+ //复制文本粘贴在留言板
+ AccessibilityNodeInfo getedittext = getedittext();
+ Log.e("TIAOSHI###", "获得的关键词内容" + conment);
+ AblViewUtil.mySleep(2);
+ AblViewUtil.sayInput(conment, getedittext);
+ AblViewUtil.mySleep(1);
+ AccessibilityNodeInfo geouyintdd = geouyintdd();
+ AblService.getInstance().clickcommontwo(geouyintdd, "点击发送");
+ AblViewUtil.mySleep(2);
+ }
+
+ /**
+ * 输入框
+ *
+ * @return
+ */
+ public AccessibilityNodeInfo getedittext() {
+ AccessibilityNodeInfo nodeinfo = null;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ if ("android.widget.EditText".equals(child.getClassName())) {
+ nodeinfo = child;
+ }
+ }
+ return nodeinfo;
+ }
+
+ /**
+ * 发送节点
+ *
+ * @return
+ */
+ public AccessibilityNodeInfo geouyintdd() {
+ AccessibilityNodeInfo nodeinfo = null;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ if ("android.widget.Button".equals(child.getClassName())) {
+ if (child.getContentDescription() != null) {
+ if (child.getContentDescription().toString().equals("发送")) {
+ nodeinfo = child;
+ }
+ }
+ }
+ }
+ return nodeinfo;
+ }
+
+ /**
+ * 点击直播间下方的更多按钮(备注:通过搜索点击直播进去的可用)
+ * 1.说点什么
+ * 2.更多
+ * 3.礼物
+ */
+ public void clickmoreli(String type) {
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ for (int y = 0; y < child.getChildCount(); y++) {
+ AccessibilityNodeInfo child1 = child.getChild(y);
+ // Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
+ for (int j = 0; j < child1.getChildCount(); j++) {
+ AccessibilityNodeInfo child2 = child1.getChild(j);
+ // Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child1.getContentDescription());
+ for (int x = 0; x < child2.getChildCount(); x++) {
+ AccessibilityNodeInfo child3 = child2.getChild(x);
+ // Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child1.getContentDescription());
+ for (int r = 0; r < child3.getChildCount(); r++) {
+ AccessibilityNodeInfo child4 = child3.getChild(r);
+ // Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText() + ":" + child4.getContentDescription());
+ switch (type) {
+ case "1"://说点什么
+ if ("android.widget.TextView".equals(child4.getClassName())) {
+ if (child4.getText() != null) {
+ if (child4.getText().toString().equals("说点什么...")) {
+ AblService.getInstance().clickcommontwo(child4, "");
+ }
+ }
+ }
+ break;
+ case "2"://更多
+ if ("android.widget.Button".equals(child4.getClassName())) {
+ if (child4.getContentDescription().equals("更多")) {
+ AblService.getInstance().clickcommontwo(child4, "点击了更多");
+ }
+ }
+ break;
+ case "3"://礼物
+ if ("android.widget.Button".equals(child4.getClassName())) {
+ if (child4.getContentDescription().equals("礼物")) {
+ AblService.getInstance().clickcommontwo(child4, "");
+ }
+ }
+ break;
+ default:
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.e("TIAOSHI###", "无障碍服务被销毁");
+ LiveEventBus.get("ablservice").post("无障碍服务被销毁");
+ // sendAction(false);
+ }
+
+// private void sendAction(boolean state) {
+// intent.putExtra("state", state);
+// sendBroadcast(intent);
+// }
+
+
+ /**
+ * 当服务要被中断时调用.会被调用多次
+ */
+ @Override
+ public void onInterrupt() {
+ Log.e("TIAOSHI###", "无障碍服务被中断");
+ LiveEventBus.get("ablservice").post("无障碍服务被中断");
+ }
+
+ @Override
+ public boolean onUnbind(Intent intent) {
+ Log.e("TIAOSHI###", "无障碍服务关闭");
+ LiveEventBus.get("ablservice").post("无障碍服务关闭");
+ return super.onUnbind(intent);
+ }
+
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickPoint(float x1, float y1, long duration) {
+
+ Path path = new Path();
+ path.moveTo(x1, y1);
+ GestureDescription.Builder builder = new GestureDescription.Builder();
+ GestureDescription gestureDescription = builder
+ .addStroke(new GestureDescription.StrokeDescription(path, 0, duration))
+ .build();
+ boolean b = dispatchGesture(gestureDescription, new GestureResultCallback() {
+ @Override
+ public void onCompleted(GestureDescription gestureDescription) {
+ super.onCompleted(gestureDescription);
+ // Log.e("TIAOSHI###", "点击结束..." + gestureDescription.getStrokeCount());
+ }
+
+ @Override
+ public void onCancelled(GestureDescription gestureDescription) {
+ super.onCancelled(gestureDescription);
+ Log.e("TIAOSHI###", "点击取消");
+ }
+ }, null);
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickcommon(List idsd, String s) {
+ if (idsd.size() > 0) {
+ AccessibilityNodeInfo accessibilityNodeInfo = idsd.get(0);
+ Rect rect = new Rect();
+ accessibilityNodeInfo.getBoundsInScreen(rect);
+ this.clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
+ Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ } else {
+ Log.e("TIAOSHI###", "没有找到" + s + "按钮,直接退出了。。。。");
+ return;
+ }
+ }
+
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickcommontwo(AccessibilityNodeInfo accessibilityNodeInfo, String s) {
+ if (accessibilityNodeInfo != null) {
+ Rect rect = new Rect();
+ accessibilityNodeInfo.getBoundsInScreen(rect);
+ this.clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
+ Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ } else {
+ Log.e("TIAOSHI###", "没有找到" + s + "按钮,直接退出了。。。。");
+ return;
+ }
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickcommonthree(AccessibilityNodeInfo accessibilityNodeInfo, String s) {
+ if (accessibilityNodeInfo != null) {
+ Rect rect = new Rect();
+ accessibilityNodeInfo.getBoundsInScreen(rect);
+ this.clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
+ Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ // ToastUtils.showShort("点击"+s+"按钮"+ "("+ (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ } else {
+ Log.e("TIAOSHI###", "没有找到" + s + "按钮,直接退出了。。。。");
+ AblViewUtil.back();
+ return;
+ }
+ }
+
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void randomSwipe() {
+ int a = 270 + RandumInt.getRandumInt4() * 8;
+ int b = 270 - RandumInt.getRandumInt4() * 10;
+// int c=1700-RandumInt.getRandumInt4()*8; // 1920分辨率起步的滑动方式,原为1800
+ int c = 1200 - RandumInt.getRandumInt4() * 8; // 1280分辨率起步的滑动方式
+// int c=1250-RandumInt.getRandumInt4()*8; // 1440分辨率的滑动方式:红米6A的方式,感觉屏幕没有1440高
+
+ int d = 300 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400
+ // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的
+ swipe(a, c, b, d, 320); //延迟330毫秒
+// mySleep(200);
+// swipe(c,b,a,d,50);
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void randomSwipetwo() {
+ if (SHEBEITIPE_VILUETHREE.equals(ChangLiang.phonetype)) {
+ int a = 700 + RandumInt.getRandumInt4() * 8;
+ int b = 700 - RandumInt.getRandumInt4() * 10;
+ int c = 1700 - RandumInt.getRandumInt4() * 8; // 1920分辨率起步的滑动方式,原为1800
+ int d = 500 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400
+ // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的
+ swipe(a, c, b, d, 500); //延迟330毫秒
+ } else {
+ int a = 270 + RandumInt.getRandumInt4() * 8;
+ int b = 270 - RandumInt.getRandumInt4() * 10;
+// int c=1700-RandumInt.getRandumInt4()*8; // 1920分辨率起步的滑动方式,原为1800
+ int c = 1200 - RandumInt.getRandumInt4() * 8; // 1280分辨率起步的滑动方式
+// int c=1250-RandumInt.getRandumInt4()*8; // 1440分辨率的滑动方式:红米6A的方式,感觉屏幕没有1440高
+ int d = 200 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400
+ // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的
+ swipe(a, c, b, d, 500); //延迟330毫秒
+ }
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void randomSwipethree() {
+ if (SHEBEITIPE_VILUETHREE.equals(ChangLiang.phonetype)) {
+ int a = 700 + RandumInt.getRandumInt4() * 8;
+ int b = 700 - RandumInt.getRandumInt4() * 10;
+ int c = 1700 - RandumInt.getRandumInt4() * 8; // 1920分辨率起步的滑动方式,原为1800
+ int d = 500 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400
+ // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的
+ swipe(b, d, a, c, 500); //延迟330毫秒
+ } else {
+ int a = 270 + RandumInt.getRandumInt4() * 8;
+ int b = 270 - RandumInt.getRandumInt4() * 10;
+// int c=1700-RandumInt.getRandumInt4()*8; // 1920分辨率起步的滑动方式,原为1800
+ int c = 1200 - RandumInt.getRandumInt4() * 8; // 1280分辨率起步的滑动方式
+// int c=1250-RandumInt.getRandumInt4()*8; // 1440分辨率的滑动方式:红米6A的方式,感觉屏幕没有1440高
+ int d = 200 - RandumInt.getRandumInt4() * 9; // 刚才是300, 延迟350~400
+ // 800毫秒的时候,有时候有点卡,但是能用,再试试其他的
+ swipe(b, d, a, c, 500); //延迟330毫秒
+
+ }
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void swipe(float x1, float y1, float x2, float y2, long duration) {
+ Path path = new Path();
+ path.moveTo(x1, y1);
+ path.lineTo(x2, y2);
+
+ Log.e("TIAOSHI###", "MyAccessibilityService中滑动swipe()方法滑动点,reset:(" + x1 + "," + y1 + "),(" + x2 + "," + y2 + ")" + "滑动的时长是:" + duration);
+ GestureDescription.Builder builder = new GestureDescription.Builder();
+ GestureDescription gestureDescription = builder
+ .addStroke(new GestureDescription.StrokeDescription(path, 0, duration))
+ .build();
+ boolean b = dispatchGesture(gestureDescription, new GestureResultCallback() {
+ @Override
+ public void onCompleted(GestureDescription gestureDescription) {
+ super.onCompleted(gestureDescription);
+ Log.e("TIAOSHI###", "滑动结束..." + gestureDescription.getStrokeCount());
+ }
+
+ @Override
+ public void onCancelled(GestureDescription gestureDescription) {
+ super.onCancelled(gestureDescription);
+ Log.e("TIAOSHI###", "滑动取消");
+ }
+ }, null);
+ }
+
+ //点击右上角搜索
+ public void DianSou() {
+
+ switch (ChangLiang.phonetype) {
+ case "0":
+ //红米7a
+ AblService.getInstance().clickPoint(656, 99, 300);
+ break;
+ case "1":
+ //华为畅享20
+ AblService.getInstance().clickPoint(659, 99, 300);
+ break;
+ case "2":
+ //华为畅享20
+ AblService.getInstance().clickPoint(990, 163, 300);
+ break;
+ default:
+ }
+ Log.e("TIAOSHI###", "点击搜索按钮");
+ }
+
+
+ /**
+ * 寻找搜索输入框
+ */
+ public AccessibilityNodeInfo findEditText() {
+ AccessibilityNodeInfo infooos = null;
+ AccessibilityNodeInfo rootttt = AblService.getInstance().getRootInActiveWindow();
+ for (int j = 0; j < rootttt.getChildCount(); j++) {
+ AccessibilityNodeInfo child = rootttt.getChild(j);
+ // Log.e("TIAOSHI###", "----1Node:" + child.getClassName() + ":" + child.getText());
+ if ("android.widget.EditText".equals(child.getClassName())) {
+ infooos = child;
+ }
+ }
+ return infooos;
+ }
+
+
+ /**
+ * 直播间点赞(红米10)
+ *
+ * @param mun
+ */
+ private void hongDianzan(int mun) {
+ for (int i = 0; i < mun; i++) {
+ int a = 500 + RandumInt.getRandumInt4() * 20;
+ int b = 1000 - RandumInt.getRandumInt4() * 20;
+ int c = 600 - RandumInt.getRandumInt4() * 50;
+ AblService.getInstance().clickPoint(a, b, 200);
+ try {
+ //隔200 ms 滚动一次
+ Thread.sleep(c);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // Log.e("TIAOSHI###", "点击了");
+ }
+ }
+
+ /**
+ * 随机获取评论话术
+ */
+ private String getConment() {
+ CommentDao commentDao = new CommentDao(FuzhuApplication.getContext());
+ List CommentBeanDatas = commentDao.queryInByCustom("type", "3");
+ if (CommentBeanDatas.size() == 0) {
+ return "哈哈";
+ } else if (CommentBeanDatas.size() == 1) {
+ CommentBeanData commentBeanData = CommentBeanDatas.get(0);
+ String comment = commentBeanData.getComment();
+ return comment;
+ } else {
+ int i = new Random().nextInt(CommentBeanDatas.size() - 1);
+ CommentBeanData commentBeanData = CommentBeanDatas.get(i);
+ String comment = commentBeanData.getComment();
+ return comment;
+ }
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblStepHandler.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblStepHandler.java
new file mode 100644
index 0000000..4e332c6
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblStepHandler.java
@@ -0,0 +1,212 @@
+package com.fisherbone.fuzhu.abllib;
+
+
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+
+import androidx.annotation.NonNull;
+
+import com.blankj.utilcode.util.LogUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 2019/4/21
+ * 14:36
+ * Levine
+ * wechat 1483232332
+ */
+public class AblStepHandler extends Handler {
+
+ private static AblStepHandler instance;
+ private List mStepListeners = new ArrayList<>();
+ private boolean isStop = true;//是否停止
+ private String[] mDatas;//数据
+ private long mStepMsgDelayMillis = 2000;//消息延迟发送时间
+ private List mInitializedSteps = new ArrayList<>();//已经初始化过的步骤
+
+ private AblStepHandler() {
+ super(Looper.getMainLooper());
+ }
+
+ public static AblStepHandler getInstance() {
+ if (instance == null) {
+ synchronized (AblStepHandler.class) {
+ if (instance == null) {
+ instance = new AblStepHandler();
+ }
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * 发送handler执行消息
+ *
+ * @param step 步骤
+ * @param delayMillis 延迟时间
+ * @param datas 数据
+ */
+ public static void sendMsg(int step, long delayMillis, String... datas) {
+ AblStepHandler ablStepHandler = AblStepHandler.getInstance();
+ if (datas != null && datas.length > 0) {
+ ablStepHandler.setDatas(datas);
+ }
+ ablStepHandler.sendEmptyMessageDelayed(step, delayMillis);
+ }
+
+ /**
+ * 发送handler执行消息
+ *
+ * @param step 步骤
+ * @param delayMillis 延迟时间
+ */
+ public static void sendMsg(int step, long delayMillis) {
+ sendMsg(step, delayMillis, new String[]{});
+ }
+
+ /**
+ * 发送handler执行消息
+ *
+ * @param step 步骤
+ * @param datas 数据
+ */
+ public static void sendMsg(int step, String... datas) {
+ sendMsg(step, AblStepHandler.getInstance().getStepMsgDelayMillis(), datas);
+ }
+
+ /**
+ * 发送handler执行消息
+ *
+ * @param step 步骤
+ */
+ public static void sendMsg(int step) {
+ sendMsg(step, AblStepHandler.getInstance().getStepMsgDelayMillis(), new String[]{});
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param millisInFuture view查找超时时间
+ * @param countDownInterval 查找间隔时间
+ * @param step 步骤
+ */
+ public static void sendMsgByView(
+ long millisInFuture,
+ long countDownInterval,
+ int step,
+ String... nextMsgViewIdOrText
+ ) {
+ FindViewCountDown.start(millisInFuture, countDownInterval, step, nextMsgViewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param millisInFuture view查找超时时间
+ * @param countDownInterval 查找间隔时间
+ * @param callBack 回调,注:如果回调不为空将不发送消息,要发送消息就自己在成功的回调里发送
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void sendMsgByView(
+ long millisInFuture,
+ long countDownInterval,
+ @NonNull FindViewCountDown.CallBack callBack,
+ String... viewIdOrText
+ ) {
+ FindViewCountDown.start(millisInFuture, countDownInterval, callBack, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param step 步骤
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void sendMsgByView(
+ int step,
+ String... viewIdOrText
+ ) {
+ FindViewCountDown.start(step, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param callBack 回调,注:如果回调不为空将不发送消息,要发送消息就自己在成功的回调里发送
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void sendMsgByView(
+ @NonNull FindViewCountDown.CallBack callBack,
+ String... viewIdOrText
+ ) {
+ FindViewCountDown.start(callBack, viewIdOrText);
+ }
+
+
+ public String[] getDatas() {
+ return mDatas;
+ }
+
+ public void setDatas(String... datas) {
+ mDatas = datas;
+ }
+
+ public long getStepMsgDelayMillis() {
+ return mStepMsgDelayMillis;
+ }
+
+ public void setStepMsgDelayMillis(long msgDelayMillis) {
+ mStepMsgDelayMillis = msgDelayMillis;
+ }
+
+ public boolean isStop() {
+
+ return isStop;
+ }
+
+ public void setStop(boolean stop) {
+ isStop = stop;
+ }
+
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ if (isStop) return;
+ LogUtils.v("step", msg.what);
+ for (StepListener stepListener : mStepListeners) {
+ stepListener.onStep(msg.what, msg);
+ }
+ }
+
+ private void addStepListener(StepListener handleMessageListener) {
+ mStepListeners.add(handleMessageListener);
+ }
+
+ public void removeStepListener(StepListener handleMessageListener) {
+ mStepListeners.remove(handleMessageListener);
+ }
+
+ /**
+ * 初始化步骤实现类
+ *
+ * @param ablStepBases 继承了StepBase的实现类
+ */
+ public void initStepClass(BaseAblStep... ablStepBases) {
+ for (BaseAblStep ablStepBase : ablStepBases) {
+ if (mInitializedSteps.contains(ablStepBase.getClass().getName())) {
+ LogUtils.e(ablStepBase.getClass().getName() + "已经初始化,请勿重复初始化");
+ continue;
+ }
+ addStepListener(ablStepBase);
+ mInitializedSteps.add(ablStepBase.getClass().getName());
+ }
+ }
+
+ public interface StepListener {
+ void onStep(int step, Message msg);
+ }
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java
new file mode 100644
index 0000000..98fbaad
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/AblSteps.java
@@ -0,0 +1,306 @@
+package com.fisherbone.fuzhu.abllib;
+
+/**
+ * 2019/4/21
+ * 18:33
+ * Levine
+ * wechat 1483232332
+ */
+public class AblSteps {
+
+ /**
+ * 全局静态常量步骤标识1~200,不够自己再加,从200开始加,基本应该都是够的了
+ */
+ public final static int STEP_1 = 1;
+ public final static int STEP_2 = 2;
+ public final static int STEP_3 = 3;
+ public final static int STEP_4 = 4;
+ public final static int STEP_5 = 5;
+ public final static int STEP_6 = 6;
+ public final static int STEP_7 = 7;
+ public final static int STEP_8 = 8;
+ public final static int STEP_9 = 9;
+ /*****************************************/
+ public final static int STEP_10 = 10;
+ public final static int STEP_11 = 11;
+ public final static int STEP_12 = 12;
+ public final static int STEP_13 = 13;
+ public final static int STEP_14 = 14;
+ public final static int STEP_15 = 15;
+ public final static int STEP_16 = 16;
+ public final static int STEP_17 = 17;
+ public final static int STEP_18 = 18;
+ public final static int STEP_19 = 19;
+ /*****************************************/
+ public final static int STEP_20 = 20;
+ public final static int STEP_21 = 21;
+ public final static int STEP_22 = 22;
+ public final static int STEP_23 = 23;
+ public final static int STEP_24 = 24;
+ public final static int STEP_25 = 25;
+ public final static int STEP_26 = 26;
+ public final static int STEP_27 = 27;
+ public final static int STEP_28 = 28;
+ public final static int STEP_29 = 29;
+ /*****************************************/
+ public final static int STEP_30 = 30;
+ public final static int STEP_31 = 31;
+ public final static int STEP_32 = 32;
+ public final static int STEP_33 = 33;
+ public final static int STEP_34 = 34;
+ public final static int STEP_35 = 35;
+ public final static int STEP_36 = 36;
+ public final static int STEP_37 = 37;
+ public final static int STEP_38 = 38;
+ public final static int STEP_39 = 39;
+ /*****************************************/
+ public final static int STEP_40 = 40;
+ public final static int STEP_41 = 41;
+ public final static int STEP_42 = 42;
+ public final static int STEP_43 = 43;
+ public final static int STEP_44 = 44;
+ public final static int STEP_45 = 45;
+ public final static int STEP_46 = 46;
+ public final static int STEP_47 = 47;
+ public final static int STEP_48 = 48;
+ public final static int STEP_49 = 49;
+ /*****************************************/
+ public final static int STEP_50 = 50;
+ public final static int STEP_51 = 51;
+ public final static int STEP_52 = 52;
+ public final static int STEP_53 = 53;
+ public final static int STEP_54 = 54;
+ public final static int STEP_55 = 55;
+ public final static int STEP_56 = 56;
+ public final static int STEP_57 = 57;
+ public final static int STEP_58 = 58;
+ public final static int STEP_59 = 59;
+ /*****************************************/
+ public final static int STEP_60 = 60;
+ public final static int STEP_61 = 61;
+ public final static int STEP_62 = 62;
+ public final static int STEP_63 = 63;
+ public final static int STEP_64 = 64;
+ public final static int STEP_65 = 65;
+ public final static int STEP_66 = 66;
+ public final static int STEP_67 = 67;
+ public final static int STEP_68 = 68;
+ public final static int STEP_69 = 69;
+ /*****************************************/
+ public final static int STEP_70 = 70;
+ public final static int STEP_71 = 71;
+ public final static int STEP_72 = 72;
+ public final static int STEP_73 = 73;
+ public final static int STEP_74 = 74;
+ public final static int STEP_75 = 75;
+ public final static int STEP_76 = 76;
+ public final static int STEP_77 = 77;
+ public final static int STEP_78 = 78;
+ public final static int STEP_79 = 79;
+ /*****************************************/
+ public final static int STEP_80 = 80;
+ public final static int STEP_81 = 81;
+ public final static int STEP_82 = 82;
+ public final static int STEP_83 = 83;
+ public final static int STEP_84 = 84;
+ public final static int STEP_85 = 85;
+ public final static int STEP_86 = 86;
+ public final static int STEP_87 = 87;
+ public final static int STEP_88 = 88;
+ public final static int STEP_89 = 89;
+ /*****************************************/
+ public final static int STEP_90 = 90;
+ public final static int STEP_91 = 91;
+ public final static int STEP_92 = 92;
+ public final static int STEP_93 = 93;
+ public final static int STEP_94 = 94;
+ public final static int STEP_95 = 95;
+ public final static int STEP_96 = 96;
+ public final static int STEP_97 = 97;
+ public final static int STEP_98 = 98;
+ public final static int STEP_99 = 99;
+ /*****************************************/
+ public final static int STEP_100 = 100;
+ public final static int STEP_101 = 101;
+ public final static int STEP_102 = 102;
+ public final static int STEP_103 = 103;
+ public final static int STEP_104 = 104;
+ public final static int STEP_105 = 105;
+ public final static int STEP_106 = 106;
+ public final static int STEP_107 = 107;
+ public final static int STEP_108 = 108;
+ public final static int STEP_109 = 109;
+ /*****************************************/
+ public final static int STEP_110 = 110;
+ public final static int STEP_111 = 111;
+ public final static int STEP_112 = 112;
+ public final static int STEP_113 = 113;
+ public final static int STEP_114 = 114;
+ public final static int STEP_115 = 115;
+ public final static int STEP_116 = 116;
+ public final static int STEP_117 = 117;
+ public final static int STEP_118 = 118;
+ public final static int STEP_119 = 119;
+ /*****************************************/
+ public final static int STEP_120 = 120;
+ public final static int STEP_121 = 121;
+ public final static int STEP_122 = 122;
+ public final static int STEP_123 = 123;
+ public final static int STEP_124 = 124;
+ public final static int STEP_125 = 125;
+ public final static int STEP_126 = 126;
+ public final static int STEP_127 = 127;
+ public final static int STEP_128 = 128;
+ public final static int STEP_129 = 129;
+ /*****************************************/
+ public final static int STEP_130 = 130;
+ public final static int STEP_131 = 131;
+ public final static int STEP_132 = 132;
+ public final static int STEP_133 = 133;
+ public final static int STEP_134 = 134;
+ public final static int STEP_135 = 135;
+ public final static int STEP_136 = 136;
+ public final static int STEP_137 = 137;
+ public final static int STEP_138 = 138;
+ public final static int STEP_139 = 139;
+ /*****************************************/
+ public final static int STEP_140 = 140;
+ public final static int STEP_141 = 141;
+ public final static int STEP_142 = 142;
+ public final static int STEP_143 = 143;
+ public final static int STEP_144 = 144;
+ public final static int STEP_145 = 145;
+ public final static int STEP_146 = 146;
+ public final static int STEP_147 = 147;
+ public final static int STEP_148 = 148;
+ public final static int STEP_149 = 149;
+ /*****************************************/
+ public final static int STEP_150 = 150;
+ public final static int STEP_151 = 151;
+ public final static int STEP_152 = 152;
+ public final static int STEP_153 = 153;
+ public final static int STEP_154 = 154;
+ public final static int STEP_155 = 155;
+ public final static int STEP_156 = 156;
+ public final static int STEP_157 = 157;
+ public final static int STEP_158 = 158;
+ public final static int STEP_159 = 159;
+ /*****************************************/
+ public final static int STEP_160 = 160;
+ public final static int STEP_161 = 161;
+ public final static int STEP_162 = 162;
+ public final static int STEP_163 = 163;
+ public final static int STEP_164 = 164;
+ public final static int STEP_165 = 165;
+ public final static int STEP_166 = 166;
+ public final static int STEP_167 = 167;
+ public final static int STEP_168 = 168;
+ public final static int STEP_169 = 169;
+ /*****************************************/
+ public final static int STEP_170 = 170;
+ public final static int STEP_171 = 171;
+ public final static int STEP_172 = 172;
+ public final static int STEP_173 = 173;
+ public final static int STEP_174 = 174;
+ public final static int STEP_175 = 175;
+ public final static int STEP_176 = 176;
+ public final static int STEP_177 = 177;
+ public final static int STEP_178 = 178;
+ public final static int STEP_179 = 179;
+ /*****************************************/
+ public final static int STEP_180 = 180;
+ public final static int STEP_181 = 181;
+ public final static int STEP_182 = 182;
+ public final static int STEP_183 = 183;
+ public final static int STEP_184 = 184;
+ public final static int STEP_185 = 185;
+ public final static int STEP_186 = 186;
+ public final static int STEP_187 = 187;
+ public final static int STEP_188 = 188;
+ public final static int STEP_189 = 189;
+ /*****************************************/
+ public final static int STEP_190 = 190;
+ public final static int STEP_191 = 191;
+ public final static int STEP_192 = 192;
+ public final static int STEP_193 = 193;
+ public final static int STEP_194 = 194;
+ public final static int STEP_195 = 195;
+ public final static int STEP_196 = 196;
+ public final static int STEP_197 = 197;
+ public final static int STEP_198 = 198;
+ public final static int STEP_199 = 199;
+ public final static int STEP_200 = 200;
+
+ /*****************************************/
+ public final static int STEP_201 = 201;
+ public final static int STEP_202 = 202;
+ public final static int STEP_203 = 203;
+ public final static int STEP_204 = 24;
+ public final static int STEP_205 = 205;
+ public final static int STEP_206 = 206;
+ public final static int STEP_207 = 207;
+ public final static int STEP_208 = 208;
+ public final static int STEP_209 = 209;
+ public final static int STEP_210 = 210;
+
+ /*****************************************/
+ public final static int STEP_211 = 211;
+ public final static int STEP_212 = 212;
+ public final static int STEP_213 = 213;
+ public final static int STEP_214 = 214;
+ public final static int STEP_215 = 215;
+ public final static int STEP_216 = 216;
+ public final static int STEP_217 = 217;
+ public final static int STEP_218 = 218;
+ public final static int STEP_219 = 219;
+ public final static int STEP_220 = 220;
+ /*****************************************/
+
+ public final static int STEP_221 = 221;
+ public final static int STEP_222 = 222;
+ public final static int STEP_223 = 223;
+ public final static int STEP_224 = 224;
+ public final static int STEP_225 = 225;
+ public final static int STEP_226 = 226;
+ public final static int STEP_227 = 227;
+ public final static int STEP_228 = 228;
+ public final static int STEP_229 = 229;
+ public final static int STEP_230 = 230;
+
+ /*****************************************/
+
+ public final static int STEP_231 = 231;
+ public final static int STEP_232 = 232;
+ public final static int STEP_233 = 233;
+ public final static int STEP_234 = 234;
+ public final static int STEP_235 = 235;
+ public final static int STEP_236 = 236;
+ public final static int STEP_237 = 237;
+ public final static int STEP_238 = 238;
+ public final static int STEP_239 = 239;
+ public final static int STEP_240 = 240;
+ /*****************************************/
+
+ public final static int STEP_241 = 241;
+ public final static int STEP_242 = 242;
+ public final static int STEP_243 = 243;
+ public final static int STEP_244 = 244;
+ public final static int STEP_245 = 245;
+ public final static int STEP_246 = 246;
+ public final static int STEP_247 = 247;
+ public final static int STEP_248 = 248;
+ public final static int STEP_249 = 249;
+
+ /*****************************************/
+ public final static int STEP_250 = 250;
+ public final static int STEP_251 = 251;
+ public final static int STEP_252 = 252;
+ public final static int STEP_253 = 253;
+ public final static int STEP_254 = 254;
+ public final static int STEP_255 = 255;
+ public final static int STEP_256 = 256;
+ public final static int STEP_257 = 257;
+ public final static int STEP_258 = 258;
+ public final static int STEP_259 = 259;
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java
new file mode 100644
index 0000000..38e20ee
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/BaseAblStep.java
@@ -0,0 +1,508 @@
+package com.fisherbone.fuzhu.abllib;
+
+import android.graphics.Rect;
+import android.os.Build;
+import android.util.Log;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import androidx.annotation.RequiresApi;
+
+import com.fisherbone.fuzhu.ChangLiang;
+import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
+import com.fisherbone.fuzhu.okgonet.HttpConstants;
+import com.fisherbone.fuzhu.okgonet.NetApi;
+import com.lzy.okgo.model.HttpParams;
+import com.lzy.okgo.model.Response;
+
+import java.util.List;
+
+/**
+ * 2019/4/21
+ * 16:44
+ * Levine
+ * wechat 1483232332
+ */
+public abstract class BaseAblStep implements AblStepHandler.StepListener {
+
+
+ /**
+ * 点击我的
+ */
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void myClick(){
+ AblService instance = AblService.getInstance();
+ if(ChangLiang.phonetype.equals("0")){
+ instance.clickPoint(648,1286, 300);//红米7a
+ }else {
+ instance.clickPoint(648,1536, 300);//华为畅享20 [632,1521][664,1552]
+ }
+ Log.e("TIAOSHI###", "点击了我按钮");
+ }
+
+
+ /**
+ * 查看节点的坐标点
+ */
+ public void nodeZuobiao(AccessibilityNodeInfo nodeinfo){
+ Rect rect = new Rect();
+ nodeinfo.getBoundsInScreen(rect);
+ Log.e("TIAOSHI###", "----显示节点的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")");
+
+ }
+
+ /**
+ * 查看节点的坐标点
+ */
+ public void nodeZuobiaoii(AccessibilityNodeInfo nodeinfo){
+ Rect rect = new Rect();
+ nodeinfo.getBoundsInScreen(rect);
+ Log.e("TIAOSHI###", "----显示控件点击的坐标:" + "(" + rect.left + "," + rect.top + ")" + "," + "(" + rect.right + "," + rect.bottom + ")");
+
+ }
+
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickcommontwo(AccessibilityNodeInfo accessibilityNodeInfo, String s) {
+ if (accessibilityNodeInfo != null) {
+ Rect rect = new Rect();
+ accessibilityNodeInfo.getBoundsInScreen(rect);
+ AblService.getInstance().clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
+ Log.e("TIAOSHI###", "点击" + s + "按钮");
+ Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ } else {
+ Log.e("TIAOSHI###", "没有找到" + s + "按钮,直接退出了。。。。");
+ AblViewUtil.mySleep(2);
+ AblStepHandler.sendMsg(AblSteps.STEP_14);
+ }
+ }
+
+
+ /**
+ * 关闭青少年保护弹框
+ * @param instance
+ */
+ public void closedQDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("我知道了", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到我知道了的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了我知道了的弹窗" );
+ AblService.getInstance().clickcommontwo(zhidao, "我知道了");
+ AblViewUtil.mySleep(2);
+ }
+ }
+
+ /**
+ * 关闭设置抖音号弹框
+ * @param instance
+ */
+ public void setdoyinQDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("设置抖音号", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到设置抖音号的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了设置抖音号的弹窗" );
+ AblService.getInstance().clickPoint(1025, 1630, 300);
+ AblViewUtil.mySleep(3);
+ fangqiQDialog(instance);
+ }
+ }
+
+ public void fangqiQDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("放弃", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到放弃的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了放弃的弹窗" );
+ //[623,1146][799,1295]
+ AblService.getInstance().clickPoint(711, 1220, 300);
+ AblViewUtil.mySleep(2);
+ }
+ }
+
+ /**
+ * 关闭检测到更新弹框
+ * @param instance
+ */
+ public void closedJDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("检测到更新", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到检测到更新的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了检测到更新的弹窗" );
+ AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("以后再说", 0);
+ AblService.getInstance().clickcommontwo(zaishuo, "以后再说");
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 关闭检测到更新弹框
+ * @param instance
+ */
+ public void closedzsDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("暂时不要", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到暂时不要的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了暂时不要的弹窗" );
+ AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("暂时不要", 0);
+ AblService.getInstance().clickcommontwo(zaishuo, "暂时不要");
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 关闭朋友推荐弹框
+ * @param instance
+ */
+ public void closedtjDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("朋友推荐", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到朋友推荐的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了朋友推荐的弹窗" );
+ //[890,489][956,555]
+ AblService.getInstance().clickPoint(923, 522, 300);
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 个人信息保护指引
+ * @param instance
+ */
+ public void yinsiDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("个人信息保护指引", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到个人信息保护指引的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗" );
+ List list = AblViewUtil.findByText("同意");
+ for (AccessibilityNodeInfo item : list) {
+ clickcommontwo(item, "同意");
+ }
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 我们才能继续为你提供服务
+ * @param instance
+ */
+ public void fuwuDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("我们才能继续为你提供服务", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到我们才能继续为你提供服务的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了我们才能继续为你提供服务的弹窗" );
+ List list = AblViewUtil.findByText("同意并继续");
+ for (AccessibilityNodeInfo item : list) {
+ clickcommontwo(item, "同意并继续");
+ }
+ AblViewUtil.mySleep(1);
+ }
+ }
+ /**
+ * 访问以下权限吗
+ * @param instance
+ */
+ public void quanxianDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("访问以下权限吗", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到访问以下权限吗的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了访问以下权限吗的弹窗" );
+ List list = AblViewUtil.findByText("始终允许");
+ for (AccessibilityNodeInfo item : list) {
+ clickcommontwo(item, "始终允许");
+ }
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+
+ /**
+ * 关闭地理位置信息弹框
+ * @param instance
+ */
+ public void closedDDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("地理位置信息", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到地理位置信息的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了检测到地理位置信息的弹窗" );
+ AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("取消", 0);
+ AblService.getInstance().clickcommontwo(zaishuo, "取消");
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 关闭地理位置=授权弹框
+ * @param instance
+ */
+ public void closedSDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("地理位置授权", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到地理位置授权的弹窗" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了检测到地理位置授权的弹窗" );
+ AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("不允许", 0);
+ AblService.getInstance().clickcommontwo(zaishuo, "不允许");
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 关闭个人信息保护指引
+ * @param instance
+ */
+ public void closedBDialog(AblService instance) {
+ //处理我知道了的弹框
+ AccessibilityNodeInfo zhidao = AblViewUtil.findByText("个人信息保护指引", 0);
+ if(zhidao==null){
+ Log.e("TIAOSHI###", "没有找到个人信息保护指引" );
+ }else {
+ Log.e("TIAOSHI###", "弹出了个人信息保护指引的弹窗" );
+ AccessibilityNodeInfo zaishuo = AblViewUtil.findByText("同意", 0);
+ AblService.getInstance().clickcommontwo(zaishuo, "同意");
+ AblViewUtil.mySleep(1);
+ }
+ }
+
+ /**
+ * 寻找控件
+ */
+ public void getNodeInfo() {
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ nodeZuobiao(child);
+ for (int y = 0; y < child.getChildCount(); y++) {
+ AccessibilityNodeInfo child1 = child.getChild(y);
+
+ Rect rect = new Rect();
+ child1.getBoundsInScreen(rect);
+ if (rect.left >0&& rect.left<1080) {
+ Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
+ nodeZuobiao(child1);
+ }
+
+// for (int j = 0; j < child1.getChildCount(); j++) {
+// AccessibilityNodeInfo child2 = child1.getChild(j);
+// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
+// nodeZuobiao(child2);
+// for (int x = 0; x < child2.getChildCount(); x++) {
+// AccessibilityNodeInfo child3 = child2.getChild(x);
+// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
+// nodeZuobiao(child3);
+// for (int r = 0; r < child3.getChildCount(); r++) {
+// AccessibilityNodeInfo child4 = child3.getChild(r);
+// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription());
+// nodeZuobiao(child4);
+// for (int m = 0; m < child4.getChildCount(); m++) {
+// AccessibilityNodeInfo child5 = child4.getChild(m);
+// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription());
+// nodeZuobiao(child5);
+// for (int p = 0; p < child5.getChildCount();p++) {
+// AccessibilityNodeInfo child6 = child5.getChild(p);
+// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription());
+// for (int t = 0; t < child6.getChildCount();t++) {
+// AccessibilityNodeInfo child7 = child6.getChild(t);
+// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription());
+// for (int q = 0; q < child7.getChildCount();t++) {
+// AccessibilityNodeInfo child8 = child7.getChild(q);
+// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText()+ ":" + child8.getContentDescription());
+//
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+ }
+ }
+ }
+
+
+ /**
+ * 寻找控件
+ */
+ public void getNodeInfoh() {
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ nodeZuobiao(child);
+ for (int y = 0; y < child.getChildCount(); y++) {
+ AccessibilityNodeInfo child1 = child.getChild(y);
+ Log.e("TIAOSHI###", "----twoNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
+ nodeZuobiao(child1);
+// for (int j = 0; j < child1.getChildCount(); j++) {
+// AccessibilityNodeInfo child2 = child1.getChild(j);
+// Log.e("TIAOSHI###", "----threeNode:" + child2.getClassName() + ":" + child2.getText() + ":" + child2.getContentDescription());
+// nodeZuobiao(child2);
+// for (int x = 0; x < child2.getChildCount(); x++) {
+// AccessibilityNodeInfo child3 = child2.getChild(x);
+// Log.e("TIAOSHI###", "----fourNode:" + child3.getClassName() + ":" + child3.getText() + ":" + child3.getContentDescription());
+// nodeZuobiao(child3);
+// for (int r = 0; r < child3.getChildCount(); r++) {
+// AccessibilityNodeInfo child4 = child3.getChild(r);
+// Log.e("TIAOSHI###", "----5Node:" + child4.getClassName() + ":" + child4.getText()+ ":" + child4.getContentDescription());
+// nodeZuobiao(child4);
+// for (int m = 0; m < child4.getChildCount(); m++) {
+// AccessibilityNodeInfo child5 = child4.getChild(m);
+// Log.e("TIAOSHI###", "----6Node:" + child5.getClassName() + ":" + child5.getText()+ ":" + child5.getContentDescription());
+// nodeZuobiao(child5);
+// for (int p = 0; p < child5.getChildCount();p++) {
+// AccessibilityNodeInfo child6 = child5.getChild(p);
+// Log.e("TIAOSHI###", "----7Node:" + child6.getClassName() + ":" + child6.getText()+ ":" + child6.getContentDescription());
+// for (int t = 0; t < child6.getChildCount();t++) {
+// AccessibilityNodeInfo child7 = child6.getChild(t);
+// Log.e("TIAOSHI###", "----8Node:" + child7.getClassName() + ":" + child7.getText()+ ":" + child7.getContentDescription());
+// for (int q = 0; q < child7.getChildCount();t++) {
+// AccessibilityNodeInfo child8 = child7.getChild(q);
+// Log.e("TIAOSHI###", "----9Node:" + child8.getClassName() + ":" + child8.getText()+ ":" + child8.getContentDescription());
+//
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+ }
+ }
+ }
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public void clickNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo, String s) {
+ if (accessibilityNodeInfo != null) {
+ Rect rect = new Rect();
+ accessibilityNodeInfo.getBoundsInScreen(rect);
+ AblService.getInstance().clickPoint((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2, 300);
+ Log.e("TIAOSHI###", "点击" + s + "按钮" + "(" + (rect.left + rect.right) / 2 + "," + (rect.top + rect.bottom) / 2 + ")");
+ } else {
+ Log.e("TIAOSHI###", "没有找到" + s + "按钮");
+ }
+ }
+
+
+
+
+ protected void againStart(String str) {
+ final HttpParams paramsPost = new HttpParams();
+ paramsPost.put("task_status", str);
+ paramsPost.put("task_id", ChangLiang.task_id);
+ paramsPost.put("task_type", ChangLiang.task_type);
+ new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appscanlogin_againStart).subscribe(new com.fisherbone.fuzhu.okgonet.Observer() {
+ @Override
+ public void onNext(Response response) {
+ String body = (String) response.body();
+ Log.e("需通知后台重新启动", body);
+ }
+
+ @Override
+ public void onError(Exception e) {
+ e.printStackTrace();
+
+ }
+ });
+ }
+
+
+ /**
+ * 当前页面如果有com.bytedance.ies.dmt.ui.widget.DmtTextView,说明是在二级页面运行正常
+ */
+ public boolean Norma() {
+ boolean flag = false;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ // nodeZuobiao(child);
+ Rect rect = new Rect();
+ child.getBoundsInScreen(rect);
+ if (rect.left >= 0 && rect.left < 1080) {
+ // Log.e("TIAOSHI###", "----twoNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ // nodeZuobiao(child);
+ if ("com.bytedance.ies.dmt.ui.widget.DmtTextView".equals(child.getClassName())) {
+ flag = true;
+ }
+ }
+ }
+
+ return flag;
+ }
+ /**
+ * 当前页面如果有切换账号和管理,说明账号切换任务运行正常
+ */
+ public boolean ZhongHaoNorma() {
+ boolean flag = false;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ // nodeZuobiao(child);
+ if ("android.widget.TextView".equals(child.getClassName())) {
+ if("管理".equals(child.getText().toString())){
+ flag = true;
+ }
+
+ }
+
+ }
+
+ return flag;
+ }
+ /**
+ * 当前页面是否在我的页面
+ */
+ public boolean wodeNorma() {
+ boolean flag = false;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(0);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ // nodeZuobiao(child);
+ if ("主页背景图".equals(child.getContentDescription())) {
+ flag = true;
+ }
+ }
+ return flag;
+ }
+
+
+ public boolean allowed() {
+ boolean ifOpen = false;
+ AccessibilityNodeInfo root = AblService.getInstance().getRootInActiveWindow();
+ for (int i = 0; i < root.getChildCount(); i++) {
+ AccessibilityNodeInfo child = root.getChild(i);
+ // Log.e("TIAOSHI###", "----oneNode:" + child.getClassName() + ":" + child.getText() + ":" + child.getContentDescription());
+ if ("android.widget.TextView".equals(child.getClassName())) {
+ if(child.getText()!=null) {
+ if (child.getText().toString().contains("正在尝试开启") || child.getText().toString().contains("是否允许")) {
+ int childCount = root.getChildCount();
+ AccessibilityNodeInfo child1 = root.getChild(childCount - 1);
+ clickNodeInfo(child1, "点击了允许");
+ }
+ }
+ ifOpen = true;
+ }
+ }
+ return ifOpen;
+ }
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/FindViewCountDown.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/FindViewCountDown.java
new file mode 100644
index 0000000..ffaff1d
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/FindViewCountDown.java
@@ -0,0 +1,159 @@
+package com.fisherbone.fuzhu.abllib;
+
+import android.os.CountDownTimer;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import androidx.annotation.NonNull;
+
+import com.fisherbone.fuzhu.abllib.utils.AblViewUtil;
+
+/**
+ * 寻找界面倒计时
+ * 2019/4/21
+ * 15:21
+ * Levine
+ * wechat 1483232332
+ */
+public class FindViewCountDown {
+
+ private static DownTimer mDownTimer;
+ public static long millisInFuture = 10000;//默认倒计时总时长
+ public static long countDownInterval = 500;//间隔时间
+
+ private static class DownTimer extends CountDownTimer {
+
+ private String[] mMsgViewIdOrText;
+ private int mStep;
+ private CallBack mCallback;
+
+ public DownTimer(
+ long millisInFuture,
+ long countDownInterval,
+ int step, CallBack callback,
+ String... viewIdOrText
+ ) {
+ super(millisInFuture, countDownInterval);
+ mMsgViewIdOrText = viewIdOrText.clone();
+ mStep = step;
+ mCallback = callback;
+ }
+
+ @Override
+ public void onTick(long l) {
+ if (AblStepHandler.getInstance().isStop()) {
+ cancel();
+ return;
+ }
+ for (String string : mMsgViewIdOrText) {
+ AccessibilityNodeInfo fromId = AblViewUtil.findById(string, 0);
+ AccessibilityNodeInfo fromText = AblViewUtil.findByText(string, 0);
+ if (fromId != null || fromText != null) {
+ cancel();
+ if (mCallback != null) {
+ mCallback.succ();
+ } else {
+ AblStepHandler.sendMsg(mStep);
+ }
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void onFinish() {
+ if (mCallback != null) mCallback.fail();
+ }
+ }
+
+ public interface CallBack {
+ void succ();
+
+ default void fail() {
+ }
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param millisInFuture view查找超时时间
+ * @param countDownInterval 查找间隔时间
+ * @param step 步骤
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void start(
+ long millisInFuture,
+ long countDownInterval,
+ int step,
+ String... viewIdOrText
+ ) {
+ start(millisInFuture, countDownInterval, step, null, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param millisInFuture view查找超时时间
+ * @param countDownInterval 查找间隔时间
+ * @param callBack 回调,注:如果回调不为空将不发送消息,要发送消息就自己在成功的回调里发送
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void start(
+ long millisInFuture,
+ long countDownInterval,
+ @NonNull CallBack callBack,
+ String... viewIdOrText
+ ) {
+ start(millisInFuture, countDownInterval, 0, callBack, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param callBack 回调,注:如果回调不为空将不发送消息,要发送消息就自己在成功的回调里发送
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void start(
+ @NonNull CallBack callBack,
+ String... viewIdOrText
+ ) {
+ start(millisInFuture, countDownInterval, 0, callBack, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param step 步骤
+ * @param viewIdOrText viewid或者文字内容
+ */
+ public static void start(
+ int step,
+ String... viewIdOrText
+ ) {
+ start(millisInFuture, countDownInterval, step, null, viewIdOrText);
+ }
+
+ /**
+ * 根据viewid或文字发送执行消息
+ *
+ * @param millisInFuture view查找超时时间
+ * @param countDownInterval 查找间隔时间
+ * @param step 步骤
+ * @param callBack 回调,注:如果回调不为空将不发送消息,要发送消息就自己在成功的回调里发送
+ * @param viewIdOrText viewid或者文字内容
+ */
+ private static void start(
+ long millisInFuture,
+ long countDownInterval,
+ int step,
+ CallBack callBack,
+ String... viewIdOrText
+ ) {
+ if (mDownTimer != null) mDownTimer.cancel();
+ mDownTimer = new DownTimer(millisInFuture, countDownInterval, step, callBack, viewIdOrText);
+ mDownTimer.start();
+ }
+
+ public static DownTimer getDownTimer() {
+ return mDownTimer;
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/Func1.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/Func1.java
new file mode 100644
index 0000000..2b8b201
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/Func1.java
@@ -0,0 +1,6 @@
+package com.fisherbone.fuzhu.abllib;
+
+public interface Func1 {
+ //把一个结果转为我们需要的一个结果
+ R call(T t);
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java
new file mode 100644
index 0000000..524faba
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/RandumInt.java
@@ -0,0 +1,22 @@
+package com.fisherbone.fuzhu.abllib;
+
+import java.util.Random;
+
+/*产生一个1~4之间的随机数*/
+public class RandumInt {
+ public static int getRandumInt4(){
+ return new Random().nextInt(4)+1;
+ }
+ public static int getRandumInt3(){
+ return new Random().nextInt(3)+1;
+ }
+ public static int getRandumInt2(){
+ return new Random().nextInt(2)+1;
+ }
+ public static int getRandumInt10to20(){
+ return new Random().nextInt(15)+1;
+ }
+ public static int getRandumInt40(){
+ return new Random().nextInt(95)+40;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AniCallBack.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AniCallBack.java
new file mode 100644
index 0000000..568d86e
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AniCallBack.java
@@ -0,0 +1,16 @@
+package com.fisherbone.fuzhu.abllib.callback;
+
+import android.view.accessibility.AccessibilityNodeInfo;
+
+/**
+ * 2019/4/21
+ * 13:05
+ * Levine
+ * wechat 1483232332
+ */
+public interface AniCallBack {
+ void succ(AccessibilityNodeInfo info);
+
+ default void fail() {
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AnisCallBack.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AnisCallBack.java
new file mode 100644
index 0000000..600c079
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/AnisCallBack.java
@@ -0,0 +1,18 @@
+package com.fisherbone.fuzhu.abllib.callback;
+
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import java.util.List;
+
+/**
+ * 2019/4/21
+ * 13:04
+ * Levine
+ * wechat 1483232332
+ */
+public interface AnisCallBack {
+ void succ(List infos);
+
+ default void fail() {
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/GestureCallBack.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/GestureCallBack.java
new file mode 100644
index 0000000..3384140
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/callback/GestureCallBack.java
@@ -0,0 +1,15 @@
+package com.fisherbone.fuzhu.abllib.callback;
+
+import android.accessibilityservice.GestureDescription;
+
+/**
+ * 2019/4/21
+ * 13:20
+ * Levine
+ * wechat 1483232332
+ */
+public interface GestureCallBack {
+ void succ(GestureDescription gestureDescription);
+
+ void fail(GestureDescription gestureDescription);
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java
new file mode 100644
index 0000000..96c3987
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblUtil.java
@@ -0,0 +1,267 @@
+package com.fisherbone.fuzhu.abllib.utils;
+
+import android.Manifest;
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.PixelFormat;
+import android.net.Uri;
+import android.os.Build;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Toast;
+
+import com.blankj.utilcode.util.LogUtils;
+import com.blankj.utilcode.util.ToastUtils;
+import com.fisherbone.fuzhu.FZConfig;
+import com.fisherbone.fuzhu.abllib.AblConfig;
+import com.fisherbone.fuzhu.abllib.AblService;
+import com.fisherbone.fuzhu.entity.addWinEntity;
+import com.fisherbone.fuzhu.utils.DeviceUtils;
+import com.fisherbone.fuzhu.utils.SPUtils;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.HttpParams;
+import com.tbruyelle.rxpermissions2.RxPermissions;
+
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+
+import io.reactivex.disposables.Disposable;
+
+import static com.blankj.utilcode.util.ActivityUtils.startActivity;
+
+/**
+ * 2019/4/21
+ * 18:21
+ * Levine
+ * wechat 1483232332
+ */
+public class AblUtil {
+
+ /**
+ * 添加悬浮界面
+ *
+ * @param context
+ * @param view
+ */
+ public static void addSuspensionWindowView(Context context, View view) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ if (Settings.canDrawOverlays(context)) {
+ if(!addWinEntity.isopen){
+ Log.e("TIAOSHI###", "temp7");
+ addSuspensionView(context, view);
+ Log.e("TIAOSHI###", "temp8");
+ addWinEntity.isopen=true;
+ }
+
+ } else {
+ ToastUtils.showShort("请先开启允许显示在其他应用上权限");
+ AblUtil.openDrawOverlaysAnth(context);
+ }
+ } else {
+ addSuspensionView(context, view);
+ }
+ }
+
+ /**
+ * 添加悬浮界面(取关)
+ *
+ * @param context
+ * @param view
+ */
+ public static void addSuspensionWindowViewtwo(Context context, View view) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ if (Settings.canDrawOverlays(context)) {
+ addSuspensionView(context, view);
+ addWinEntity.cancleisopen=true;
+ } else {
+ ToastUtils.showShort("请先开启允许显示在其他应用上权限");
+ AblUtil.openDrawOverlaysAnth(context);
+ }
+ } else {
+ addSuspensionView(context, view);
+ }
+ }
+
+ /**
+ * 添加悬浮界面
+ *
+ * @param context
+ * @param view
+ */
+ private static void addSuspensionView(Context context, View view) {
+ WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+ } else {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+ }
+ layoutParams.format = PixelFormat.TRANSLUCENT;// 支持透明
+ layoutParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;// 焦点
+ layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;//窗口的宽和高
+ layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
+ layoutParams.x = 0;//窗口位置的偏移量
+ layoutParams.y = -500;
+ layoutParams.gravity = Gravity.LEFT;
+ windowManager.addView(view, layoutParams);//添加窗口
+ }
+
+
+ /**
+ * 添加底部悬浮界面
+ *
+ * @param context
+ * @param view
+ */
+ public static void addSuWindowView(Context context, View view) {
+ showFloatingWindow(context, view);
+ }
+
+ /**
+ * 添加底部悬浮界面
+ *
+ * @param context
+ * @param view
+ */
+ private static void showFloatingWindow(Context context, View view) {
+ if (Settings.canDrawOverlays(context)) {
+ // 获取WindowManager服务
+ WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ // 根据android版本设置悬浮窗类型
+ WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+ layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
+ } else {
+ layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;
+ }
+
+ // layoutParams.format = PixelFormat.RGBA_8888;
+ layoutParams.format = PixelFormat.TRANSLUCENT;// 支持透明
+ layoutParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;// 焦点
+ //设置大小
+ layoutParams.width = 300;
+ layoutParams.height = 100;
+
+ //设置位置
+ layoutParams.x = 0;
+ layoutParams.y = 688;
+
+ // 将悬浮窗控件添加到WindowManager
+ windowManager.addView(view, layoutParams);
+ }
+ }
+
+
+
+ /**
+ * 打开悬浮窗授权界面
+ *
+ * @param context
+ */
+ public static void openDrawOverlaysAnth(Context context) {
+ Intent intent = new Intent(
+ Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
+ Uri.parse("package:" + context.getPackageName())
+ );
+ context.startActivity(intent);
+ }
+
+ /**
+ * 检查是否是需要监听的APP包名
+ *
+ * @param thisPackageName APP包名
+ * @return
+ */
+ public static boolean checkPackageName(String thisPackageName) {
+ if (AblConfig.sMonitoringPackageNames != null && AblConfig.sMonitoringPackageNames.length > 0) {
+ for (String packageName : AblConfig.sMonitoringPackageNames) {
+ if (packageName.contentEquals(thisPackageName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 打开无障碍服务设置
+ */
+ public static void openAccessibilitySettings() {
+ Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+ startActivity(intent);
+ }
+
+ /**
+ * 辅助服务是否开启
+ *
+ * @return
+ */
+ public static boolean isAccessibilityServiceOpen(Context context) {
+ ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ List services = am.getRunningServices(Short.MAX_VALUE);
+ for (ActivityManager.RunningServiceInfo info : services) {
+ LogUtils.v(info.service.getClassName());
+ if (info.service.getClassName().equals(AblService.class.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static void getPermissions(Context context) {
+
+
+ RxPermissions rxPermissions = new RxPermissions((Activity) context);
+ rxPermissions.request(Manifest.permission.READ_PHONE_STATE,Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE)
+ .subscribe(new io.reactivex.Observer() {
+ @Override
+ public void onSubscribe(Disposable d) {
+
+ }
+
+ @Override
+ public void onNext(Boolean aBoolean) {
+ if (aBoolean) {
+ String device_id = (String) SPUtils.getSp(context, FZConfig.KEY_DEVICE_ID, "");
+ Log.e("设备imei为sp:", device_id);//小米8==548ec01ca14763927b10defb19371f81
+ if(device_id.equals("")) {
+ String imei = DeviceUtils.getIMEI(context);
+ try {
+ String s = DeviceUtils.toMD5(imei);
+ Log.e("设备imei为:", s);//小米8==548ec01ca14763927b10defb19371f81
+ //红米7a==7228bdb66fed66c60d961e30a9dc06d3
+ SPUtils.setSP(context, FZConfig.KEY_DEVICE_ID, s);
+ OkGo.getInstance().addCommonParams(new HttpParams("device_id", s));
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ }
+ }
+ //红米7a==865367043276309
+ } else {
+ Toast.makeText(context, "获取权限失败,请重新授权",Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ @Override
+ public void onError(Throwable e) {
+
+ }
+
+ @Override
+ public void onComplete() {
+
+ }
+ });
+ }
+
+
+
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java
new file mode 100644
index 0000000..379425f
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/abllib/utils/AblViewUtil.java
@@ -0,0 +1,540 @@
+package com.fisherbone.fuzhu.abllib.utils;
+
+import android.accessibilityservice.AccessibilityService;
+import android.accessibilityservice.GestureDescription;
+import android.annotation.TargetApi;
+import android.content.ClipData;
+import android.content.ClipboardManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.graphics.Path;
+import android.graphics.Rect;
+import android.os.Build;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.accessibility.AccessibilityNodeInfo;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresApi;
+
+import com.blankj.utilcode.util.ScreenUtils;
+import com.fisherbone.fuzhu.FuzhuApplication;
+import com.fisherbone.fuzhu.InfoMessage;
+import com.fisherbone.fuzhu.abllib.AblService;
+import com.fisherbone.fuzhu.abllib.callback.AniCallBack;
+import com.fisherbone.fuzhu.abllib.callback.AnisCallBack;
+import com.fisherbone.fuzhu.abllib.callback.GestureCallBack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static android.accessibilityservice.AccessibilityService.GLOBAL_ACTION_BACK;
+import static android.content.Context.CLIPBOARD_SERVICE;
+
+/**
+ * 界面操作工具类
+ * wechat 1483232332
+ */
+public class AblViewUtil {
+ private static InfoMessage infoMessag;
+ /**
+ * 根据id获取view
+ *
+ * @param parent
+ * @param id 界面id
+ * @param position
+ * @return
+ */
+ public static AccessibilityNodeInfo findById(
+ AccessibilityNodeInfo parent,
+ String id,
+ int position,
+ @Nullable AniCallBack callBack
+ ) {
+ if (parent != null) {
+ List accessibilityNodeInfos =
+ parent.findAccessibilityNodeInfosByViewId(id);
+ if (accessibilityNodeInfos != null &&
+ !accessibilityNodeInfos.isEmpty() &&
+ position < accessibilityNodeInfos.size()) {
+ if (callBack != null) {
+ callBack.succ(accessibilityNodeInfos.get(position));
+ }
+ return accessibilityNodeInfos.get(position);
+ }
+ }
+ if (callBack != null) {
+ callBack.fail();
+ }
+ return null;
+ }
+
+ public static AccessibilityNodeInfo findById(
+ AccessibilityNodeInfo parent,
+ String id,
+ int position
+ ) {
+ return findById(parent, id, position, null);
+ }
+
+ public static AccessibilityNodeInfo findById(String id, int position) {
+ return findById(AblService.getInstance().getRootInActiveWindow(), id, position, null);
+ }
+
+ public static AccessibilityNodeInfo findById(String id, int position, AniCallBack callBack) {
+ return findById(AblService.getInstance().getRootInActiveWindow(), id, position, callBack);
+ }
+
+ public static List findById(
+ AccessibilityNodeInfo parent,
+ String id,
+ @Nullable AnisCallBack anisCallBack
+ ) {
+ if (parent != null) {
+ List accessibilityNodeInfos =
+ parent.findAccessibilityNodeInfosByViewId(id);
+ if (accessibilityNodeInfos != null &&
+ !accessibilityNodeInfos.isEmpty()) {
+ if (anisCallBack != null) anisCallBack.succ(accessibilityNodeInfos);
+ return accessibilityNodeInfos;
+ }
+ }
+ if (anisCallBack != null) anisCallBack.fail();
+ return new ArrayList<>();
+ }
+
+ public static List findById(
+ AccessibilityNodeInfo parent,
+ String id
+ ) {
+ return findById(parent, id, null);
+ }
+
+ public static List findById(String id) {
+ return findById(AblService.getInstance().getRootInActiveWindow(), id, null);
+ }
+
+ public static List findById(String id, AnisCallBack anisCallBack) {
+ return findById(AblService.getInstance().getRootInActiveWindow(), id, anisCallBack);
+ }
+
+ /**
+ * 根据文本获取view
+ *
+ * @param parent
+ * @param text
+ * @param position
+ * @return
+ */
+ public static AccessibilityNodeInfo findByText(AccessibilityNodeInfo parent, String text, int position) {
+ if (parent != null) {
+ List accessibilityNodeInfos =
+ parent.findAccessibilityNodeInfosByText(text);
+ if (accessibilityNodeInfos != null &&
+ !accessibilityNodeInfos.isEmpty() &&
+ position < accessibilityNodeInfos.size()) {
+ return accessibilityNodeInfos.get(position);
+ }
+ }
+ return null;
+ }
+
+ public static AccessibilityNodeInfo findByText(String text, int position) {
+ return findByText(AblService.getInstance().getRootInActiveWindow(), text, position);
+ }
+
+ public static List findByText(AccessibilityNodeInfo parent, String text) {
+ if (parent != null) {
+ List accessibilityNodeInfos =
+ parent.findAccessibilityNodeInfosByText(text);
+ if (accessibilityNodeInfos != null &&
+ !accessibilityNodeInfos.isEmpty()) {
+ return accessibilityNodeInfos;
+ }
+ }
+ return new ArrayList<>();
+ }
+
+ public static List findByText(String text) {
+ return findByText(AblService.getInstance().getRootInActiveWindow(), text);
+ }
+
+ /**
+ * 手势模拟
+ *
+ * @param start_position 开始位置,长度为2的数组,下标0为x轴,下标1为y轴
+ * @param end_position
+ * @param startTime 开始间隔时间
+ * @param duration 持续时间
+ * @param callback 回调
+ */
+ @TargetApi(Build.VERSION_CODES.N)
+ public static void dispatch_gesture(
+ float[] start_position,
+ float[] end_position,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ Path path = new Path();
+ path.moveTo(start_position[0], start_position[1]);
+ path.lineTo(end_position[0], end_position[1]);
+ GestureDescription.Builder builder = new GestureDescription.Builder();
+ GestureDescription.StrokeDescription strokeDescription =
+ new GestureDescription.StrokeDescription(path, startTime, duration);
+ GestureDescription gestureDescription = builder.addStroke(strokeDescription).build();
+ AblService.getInstance().dispatchGesture(gestureDescription, new AccessibilityService.GestureResultCallback() {
+ @Override
+ public void onCompleted(GestureDescription gestureDescription) {
+ if (callback != null) callback.succ(gestureDescription);
+ }
+
+ @Override
+ public void onCancelled(GestureDescription gestureDescription) {
+ if (callback != null) callback.fail(gestureDescription);
+ }
+ }, null);
+ }
+
+ /**
+ * x轴居中竖直滑动屏幕
+ *
+ * @param yRatio y轴份数
+ * @param startSlideRatio y轴开始的份数
+ * @param stopSlideRatio y轴结束的份数
+ */
+ public static void scrollVertical(
+ int yRatio,
+ int startSlideRatio,
+ int stopSlideRatio,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ int screenWidth = ScreenUtils.getScreenWidth();
+ int start = (screenHeight / yRatio) * startSlideRatio;
+ int stop = (screenHeight / yRatio) * stopSlideRatio;
+ dispatch_gesture(
+ new float[]{screenWidth >> 1, start},
+ new float[]{screenWidth >> 1, stop},
+ startTime,
+ duration,
+ callback
+ );
+
+ }
+
+ /**
+ * 竖直滑动,y轴分为20份
+ *
+ * @param startSlideRatio 开始份数
+ * @param stopSlideRatio 结束份数
+ */
+ public static void scrollVertical(
+ int startSlideRatio,
+ int stopSlideRatio
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ int screenWidth = ScreenUtils.getScreenWidth();
+ int start = (screenHeight / 20) * startSlideRatio;
+ int stop = (screenHeight / 20) * stopSlideRatio;
+ dispatch_gesture(
+ new float[]{screenWidth >> 1, start},
+ new float[]{screenWidth >> 1, stop},
+ 50,
+ 500,
+ null
+ );
+
+ }
+
+ /**
+ * x轴居中竖直滑动屏幕
+ *
+ * @param startY y轴开始位置
+ * @param stopY y轴结束位置
+ */
+ public static void scrollVertical(
+ float startY,
+ float stopY,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ int screenWidth = ScreenUtils.getScreenWidth();
+ dispatch_gesture(
+ new float[]{screenWidth >> 1, startY},
+ new float[]{screenWidth >> 1, stopY},
+ startTime,
+ duration,
+ callback
+ );
+
+ }
+
+
+ /**
+ * y轴居中横向滑动
+ *
+ * @param xRatio x轴份数
+ * @param startSlideRatio x轴开始滑动份数
+ * @param stopSlideRatio x轴结束滑动份数
+ * @param startTime 开始延迟时间
+ * @param duration 滑动持续时间
+ * @param callback 回调
+ */
+ public void scrollHorizontal(
+ int xRatio,
+ int startSlideRatio,
+ int stopSlideRatio,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ int screenWidth = ScreenUtils.getScreenWidth();
+ int start = (screenWidth / xRatio) * startSlideRatio;
+ int stop = (screenWidth / xRatio) * stopSlideRatio;
+ dispatch_gesture(
+ new float[]{start, screenHeight >> 1},
+ new float[]{stop, screenHeight >> 1},
+ startTime,
+ duration,
+ callback
+ );
+ }
+
+ /**
+ * y轴居中横向滑动
+ *
+ * @param startX x轴开始位置
+ * @param stopX x轴结束位置
+ * @param startTime 开始延迟时间
+ * @param duration 滑动持续时间
+ * @param callback 回调
+ */
+ public static void scrollHorizontal(
+ int startX,
+ int stopX,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ dispatch_gesture(
+ new float[]{startX, screenHeight >> 1},
+ new float[]{stopX, screenHeight >> 1},
+ startTime,
+ duration,
+ callback
+ );
+ }
+
+ /**
+ * 点击屏幕
+ *
+ * @param ratio 屏幕长宽份数
+ * @param xRatio 屏幕宽ratio份的比例
+ * @param yRatio
+ */
+ public static void clickScreen(
+ int ratio,
+ int xRatio,
+ int yRatio,
+ @Nullable GestureCallBack callback
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ int screenWidth = ScreenUtils.getScreenWidth();
+ int y = (screenHeight / ratio) * yRatio;
+ int x = (screenWidth / ratio) * xRatio;
+ dispatch_gesture(
+ new float[]{x, y},
+ new float[]{x, y},
+ 100,
+ 50,
+ callback
+ );
+ }
+
+ /**
+ * 点击屏幕
+ */
+ public static void clickScreen(
+ int xRatio,
+ int yRatio
+ ) {
+ int screenHeight = ScreenUtils.getScreenHeight();
+ int screenWidth = ScreenUtils.getScreenWidth();
+ int y = (screenHeight / 20) * yRatio;
+ int x = (screenWidth / 20) * xRatio;
+ dispatch_gesture(
+ new float[]{x, y},
+ new float[]{x, y},
+ 100,
+ 50,
+ null
+ );
+ }
+
+ /**
+ * 点击屏幕
+ *
+ * @param x x轴像素
+ * @param y
+ * @param startTime 开始间隔时间
+ * @param duration 持续时间
+ */
+ public static void clickScreen(
+ float x,
+ float y,
+ long startTime,
+ long duration,
+ @Nullable GestureCallBack callback
+ ) {
+ dispatch_gesture(
+ new float[]{x, y},
+ new float[]{x, y},
+ startTime,
+ duration,
+ callback
+ );
+ }
+
+ /**
+ * 返回
+ */
+ public static void back() {
+ AblService.getInstance().performGlobalAction(GLOBAL_ACTION_BACK);
+ }
+
+
+ /**
+ * 黏贴文本至view
+ *
+ * @param info
+ * @param text
+ */
+ public static void paste(AccessibilityNodeInfo info, String text) {
+ ClipData clip = ClipData.newPlainText(System.currentTimeMillis() + "", text);
+ ClipboardManager clipboardManager = (ClipboardManager) AblService.getInstance().getSystemService(CLIPBOARD_SERVICE);
+ assert clipboardManager != null;
+ clipboardManager.setPrimaryClip(clip);
+ ClipData abc = clipboardManager.getPrimaryClip();
+ assert abc != null;
+ ClipData.Item item = abc.getItemAt(0);
+ if (info != null) info.performAction(AccessibilityNodeInfo.ACTION_PASTE);
+ }
+
+
+ /**
+ * 具体的说话方法
+ *
+ * @param text
+ * @param node
+ */
+ public static void sayInput(String text, AccessibilityNodeInfo node) {
+ if(node!=null) {
+ if ("android.widget.EditText".equals(node.getClassName())) {
+ Log.e("TIAOSHI###", "要说的话:.." + text);
+ Bundle arguments = new Bundle();
+ arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, text);
+ node.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments);
+ }
+ }
+
+ }
+
+
+ /**
+ * @param
+ * @return
+ * @description 开启app
+ */
+ @RequiresApi(api = Build.VERSION_CODES.N)
+ public static void startApplication() {
+ startApplicationtwo(FuzhuApplication.getContext(), "com.ss.android.ugc.aweme");
+ }
+
+ public static void startApplicationtwo(Context ctx, String pkName) {
+ PackageManager packageManager = ctx.getPackageManager();
+ Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
+ resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+ resolveIntent.setPackage(pkName);
+ List apps = packageManager.queryIntentActivities(resolveIntent, 0);
+ ResolveInfo ri = apps.iterator().next();
+ if (ri != null) {
+ String packageName = ri.activityInfo.packageName;
+ String className = ri.activityInfo.name;
+ Intent intent = new Intent(Intent.ACTION_MAIN);
+ intent.addCategory(Intent.CATEGORY_LAUNCHER);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ ComponentName cn = new ComponentName(packageName, className);
+ intent.setComponent(cn);
+ ctx.startActivity(intent);
+ }
+ }
+
+
+ public static void mySleep(int i) {
+ try {
+ Thread.sleep(i * 1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /**
+ *
+
+ * @param nikename 方法内字符串变量
+ * @param child1
+ * @param numt 上坐标点
+ * @param numb 下坐标点
+ * @param numl 左坐标点
+ * @param numr 右坐标点
+ * @param classStr 节点的包名
+ * @return
+ */
+ public static String getString(String nikename, AccessibilityNodeInfo child1, int numt, int numb, int numl, int numr, String classStr) {
+ Rect rect = new Rect();
+ child1.getBoundsInScreen(rect);
+ if (rect.top >= numt && rect.bottom <= numb&&rect.left>=numl&&rect.right<=numr) {
+ Log.e("TIAOSHI###", "----RectNode:" + child1.getClassName() + ":" + child1.getText() + ":" + child1.getContentDescription());
+ if (classStr.equals(child1.getClassName())) {
+ if (child1.getText() != null) {
+ nikename = child1.getText().toString();
+ }
+ }
+ }
+ return nikename;
+ }
+
+
+ public void rigist(InfoMessage infoMessag){
+ this.infoMessag=infoMessag;
+ }
+ public static void onMessage(String str){
+ infoMessag.mesagesuccess(str);
+ }
+
+ public static void mesagefinish(String str){
+ infoMessag.mesagefinish(str);
+ }
+
+
+ public static void zhuanghaoMessage(String str){
+ infoMessag.mesagezhuang(str);
+ }
+
+ public static void potfinish(String id,String str,String type){
+ infoMessag.potfinish(id,str,type);
+ }
+ public static void potgegin(String str){
+ infoMessag.potgegin(str);
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/AppointActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/AppointActivity.java
new file mode 100644
index 0000000..058e6c9
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/AppointActivity.java
@@ -0,0 +1,79 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.databinding.ActivityAppointBinding;
+import com.fisherbone.fuzhu.entity.AppoBean;
+import com.fisherbone.fuzhu.entity.AppointBean;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.okgonet.HttpConstants;
+import com.fisherbone.fuzhu.okgonet.NetApi;
+import com.fisherbone.fuzhu.utils.JsonUtils;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.utils.ToastUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+import com.lzy.okgo.model.HttpParams;
+import com.lzy.okgo.model.Response;
+
+import java.util.List;
+
+import de.greenrobot.event.EventBus;
+
+public class AppointActivity extends BaseActivity {
+
+ private TitleBar mTitleBar;
+ private ActivityAppointBinding binding;
+ private AppointBean appointBean;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_appoint);
+ appointBean = ProfileSpUtils.getInstance().getAppointBean();
+ binding.setAppointBean(appointBean);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("关注指定直播间");
+ initNormalBack();
+ binding.appRlStart.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ ProfileSpUtils.getInstance().saveAppointBean(appointBean);
+ if(binding.appSwitch1.isChecked()) {
+ EventBus.getDefault().post(new FourEvent("success", "8"));
+ }else {
+ //随机直播间加关注
+ EventBus.getDefault().post(new FourEvent("success", "9"));
+ }
+ }
+ });
+ //获得数据
+ getData();
+ }
+
+ private void getData() {
+ final HttpParams paramsPost = new HttpParams();
+ //抖音号
+ // paramsPost.put("short_id", ChangLiang.short_id);
+ paramsPost.put("short_id", "178421572");
+ new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appoperate_LiveRoom).subscribe(new com.fisherbone.fuzhu.okgonet.Observer() {
+ @Override
+ public void onNext(Response response) {
+ String body = (String) response.body();
+ AppoBean appoBean = JsonUtils.fromJson(body, AppoBean.class);
+ ProfileSpUtils.getInstance().saveAppoBean(appoBean);
+ List data = appoBean.getData();
+ ToastUtils.showToast(AppointActivity.this,appoBean.getMsg());
+ }
+
+ @Override
+ public void onError(Exception e) {
+ e.printStackTrace();
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/BaseMoActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/BaseMoActivity.java
new file mode 100644
index 0000000..a59ffd2
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/BaseMoActivity.java
@@ -0,0 +1,148 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.entity.Savaselect;
+
+import java.util.List;
+
+public abstract class BaseMoActivity extends BaseActivity {
+
+ public static final String ARG_PAGE = "ARG_PAGE";
+ private boolean IS_LOADED = false;
+ private static int mSerial = 0;
+ private boolean isFirst = true;
+ @SuppressLint("HandlerLeak")
+ private Handler handler = new Handler() {
+ public void handleMessage(Message msg) {
+ Log.e("tag", "IS_LOADED=" + IS_LOADED);
+ if (!IS_LOADED) {
+ IS_LOADED = true;
+ //请求我的客户已流失数据
+ requesdata();
+ }
+ return;
+ }
+
+ };
+ public Savaselect savaselectbean;
+ private RelativeLayout rl_top;
+ private RelativeLayout layTop_left_tv;
+ public BaseQuickAdapter markingtwoAdapter;
+ public void sendMessage() {
+ Message message = handler.obtainMessage();
+ message.sendToTarget();
+ }
+
+ private String uid;
+ public RecyclerView mMarkingFragmentRecyclerView;
+ public SwipeRefreshLayout mSwl;
+ public int mNextRequestPage = 1;
+ private static final int PAGE_SIZE = 10;
+ View view;
+ public View notDataView;
+ public View errorView;
+ public TextView mLayTopTitle;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_mo);
+ initView(view);
+ //设置页和当前页一致时加载,防止预加载
+ if (isFirst) {
+ isFirst = false;
+ sendMessage();
+ }
+ }
+
+ private void initView(View mContentView) {
+ mMarkingFragmentRecyclerView = (RecyclerView) findViewById(R.id.marking_fragment_recyclerView);
+ mSwl = findViewById(R.id.srl);
+ notDataView = this.getLayoutInflater().inflate(R.layout.empty_view, (ViewGroup) mMarkingFragmentRecyclerView.getParent(), false);
+ notDataView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // refresh();
+ }
+ });
+ errorView = this.getLayoutInflater().inflate(R.layout.error_view, (ViewGroup) mMarkingFragmentRecyclerView.getParent(), false);
+ errorView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // onRefresh();
+ }
+ });
+
+ }
+
+ public void requesdata() {
+ initAdapter();
+ initRefreshLayout();
+ mSwl.setRefreshing(true);
+ refresh();
+ }
+
+ public abstract void initAdapter();
+
+
+ private void initRefreshLayout() {
+ mSwl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+ @Override
+ public void onRefresh() {
+ refresh();
+ }
+ });
+ }
+
+ private void refresh() {
+ mNextRequestPage = 1;
+ // markingtwoAdapter.setEnableLoadMore(false);//这里的作用是防止下拉刷新的时候还可以上拉加载
+ requestData();
+ }
+
+ public void loadMore() {
+ requestData();
+ }
+
+ public void setData(boolean isRefresh, List data) {
+ mNextRequestPage++;
+ final int size = data == null ? 0 : data.size();
+ if (isRefresh) {
+ markingtwoAdapter.setNewData(data);
+ } else {
+ if (size > 0) {
+ markingtwoAdapter.addData(data);
+ }
+ }
+ if (size < PAGE_SIZE) {
+ //第一页如果不够一页就不显示没有更多数据布局
+ markingtwoAdapter.loadMoreEnd(isRefresh);
+ } else {
+ markingtwoAdapter.loadMoreComplete();
+ }
+ }
+ public abstract void requestData();
+
+ public void getAdpter(BaseQuickAdapter markingtwoAdapter){
+ this.markingtwoAdapter=markingtwoAdapter;
+ }
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java
new file mode 100644
index 0000000..23ccae2
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/CancleFollowActivity.java
@@ -0,0 +1,114 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.CompoundButton;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.ChangLiang;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.databinding.ActivityCancleFollowBinding;
+import com.fisherbone.fuzhu.entity.CancleFollowBean;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.entity.addWinEntity;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.utils.StringUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+
+import de.greenrobot.event.EventBus;
+
+/**
+ * 一键取关
+ */
+public class CancleFollowActivity extends BaseActivity {
+ private ActivityCancleFollowBinding binding;
+ private TitleBar mTitleBar;
+ private CancleFollowBean cancleFollowBean;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_cancle_follow);
+ cancleFollowBean = ProfileSpUtils.getInstance().getCan();
+ binding.setCanclefollowbean(cancleFollowBean);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("一键取关");
+ initNormalBack();
+ binding.radioButton01.setChecked(true);
+ cancleFollowBean.setCancelclosed(true);
+ binding.radioButton02.setChecked(false);
+ cancleFollowBean.setCancelcrosscor(false);
+
+ binding.radioButton01.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+ cancleFollowBean.setCancelclosed(b);
+ }
+ });
+ binding.radioButton02.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+ cancleFollowBean.setCancelcrosscor(b);
+ }
+ });
+
+ binding.rlStart.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Log.e("TIAOSHI###==发送的一键取关参数", cancleFollowBean.toString());
+ //将参数数据缓存起来
+ ChangLiang.cancelclosed = cancleFollowBean.getCancelclosed();
+ ChangLiang.cancelcrosscor = cancleFollowBean.getCancelcrosscor();
+ ChangLiang.passnumber = cancleFollowBean.getPassnumber();
+ ChangLiang.swiinterval = cancleFollowBean.getSwiinterval();
+ ChangLiang.minthrthr = cancleFollowBean.getMinthrthr();
+ ChangLiang.minfans = cancleFollowBean.getMinfans();
+ //存储参数信息
+ ProfileSpUtils.getInstance().saveCan(cancleFollowBean);
+ if (StringUtils.isEmpty(cancleFollowBean.getPassnumber())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(CancleFollowActivity.this, "请输入取关数");
+ return;
+ }
+ if (StringUtils.isEmpty(cancleFollowBean.getSwiinterval())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(CancleFollowActivity.this, "请输入取关间隔");
+ return;
+ }
+ if (cancleFollowBean.getCancelclosed()) {
+ if (StringUtils.isEmpty(cancleFollowBean.getMinthrthr())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(CancleFollowActivity.this, "请输入最小开始取关数");
+ return;
+ }
+ }
+ if (cancleFollowBean.getCancelcrosscor()) {
+ if (StringUtils.isEmpty(cancleFollowBean.getMinfans())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(CancleFollowActivity.this, "请输入互关保留粉丝数");
+ return;
+ }
+ }
+
+ if(!addWinEntity.cancleisopen){
+ //下面两个步骤不能同时执行
+ //取消已关
+ if (ChangLiang.cancelclosed&&!ChangLiang.cancelcrosscor) {
+ Log.e("TIAOSHI###==发送的一键取关参数", "执行取消已关");
+ EventBus.getDefault().post(new FourEvent("success","2"));
+
+ }
+ //取消互关
+ if (ChangLiang.cancelcrosscor&&!ChangLiang.cancelclosed) {
+ Log.e("TIAOSHI###==发送的一键取关参数", "执行取消互关");
+ EventBus.getDefault().post(new FourEvent("success","2"));
+ }
+
+ if(ChangLiang.cancelclosed&&ChangLiang.cancelcrosscor){
+ Log.e("TIAOSHI###==发送的一键取关参数", "执行取消互关");
+ EventBus.getDefault().post(new FourEvent("success","2"));
+ }
+ }
+ }
+ });
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java b/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java
new file mode 100644
index 0000000..8142b37
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/ControlWindow.java
@@ -0,0 +1,351 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.content.Context;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.blankj.utilcode.util.ToastUtils;
+import com.fisherbone.fuzhu.ChangLiang;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.abllib.AblStepHandler;
+import com.fisherbone.fuzhu.abllib.AblSteps;
+import com.fisherbone.fuzhu.abllib.utils.AblUtil;
+import com.fisherbone.fuzhu.databinding.ViewTestBinding;
+import com.fisherbone.fuzhu.entity.ControlBean;
+import com.fisherbone.fuzhu.entity.addWinEntity;
+import com.fisherbone.fuzhu.step.TestAblStep30;
+import com.fisherbone.fuzhu.step.TestAblStep34;
+import com.fisherbone.fuzhu.step.TestAblStepXin5;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.jeremyliao.liveeventbus.LiveEventBus;
+
+/**
+ * Time: 2021/6/28
+ * Author: jianbo
+ * Description:
+ */
+public class ControlWindow {
+
+ Context mContext;
+ private ViewTestBinding binding;
+ private ControlBean controlBean;
+ public ControlWindow (Context mContext){
+ this.mContext=mContext;
+ }
+ private String func_type;
+ /**
+ * 显示运行信息
+ */
+ public void showRunInfo(String str){
+ controlBean.setContent(str);
+ }
+ /**
+ * 显示控制系统运行的浮窗
+ *
+ * @return
+ */
+ public View initWindowView( String func_typee) {
+ this.func_type = func_typee;
+ LayoutInflater inflater = (LayoutInflater)mContext.getSystemService
+ (Context.LAYOUT_INFLATER_SERVICE);
+ binding = DataBindingUtil.inflate(inflater, R.layout.view_test, null, false);
+ controlBean = new ControlBean();
+ controlBean.setContent("");
+ controlBean.setPhonetype(Integer.valueOf(ChangLiang.phonetype));
+ binding.setControlBean(controlBean);
+ stutas(true);
+ binding.image01.setBackgroundResource(R.mipmap.icon_bianzu);
+ AblStepHandler.getInstance().setStop(false);
+ //func_type 1:推荐加关,2:一键取关,3:撞号设置 4.登录 5.抢红包 51.粉丝互动 6.大V粉丝截流 7.潜在客户加关 9.粉丝通知 10.直播间加热 12.抢福袋
+ switch (func_type) {
+ case "1":
+ AblStepHandler.getInstance().initStepClass(new TestAblStepXin5(mContext));
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_9);
+ break;
+ case "2":
+ if (AblUtil.isAccessibilityServiceOpen(mContext)) {
+ stutas(ChangLiang.isrun);
+ if (ChangLiang.cancelclosed && !ChangLiang.cancelcrosscor) {
+ Log.e("TIAOSHI###", "执行取消关注");
+ AblStepHandler.sendMsg(AblSteps.STEP_11);
+ }
+ //取消互关
+ if (ChangLiang.cancelcrosscor && !ChangLiang.cancelclosed) {
+ Log.e("TIAOSHI###", "执行取消相互关注");
+ AblStepHandler.sendMsg(AblSteps.STEP_15);
+ }
+ //取消互关+取消已关
+ if (ChangLiang.cancelcrosscor && ChangLiang.cancelclosed) {
+ Log.e("TIAOSHI###", "执行取消相互关注+取消已关");
+ AblStepHandler.sendMsg(AblSteps.STEP_60);
+ }
+ } else {
+ ToastUtils.showShort("点到了");
+ ToastUtils.showShort("请先开启辅助服务");
+ AblUtil.openAccessibilitySettings();
+ }
+ break;
+ case "3"://执行幢号任务
+ if (ChangLiang.if_quguan.equals("0")) {
+ stutas(ChangLiang.isrun);
+ ChangLiang.zishuodong = "T";
+ AblStepHandler.sendMsg(AblSteps.STEP_70);
+ } else {
+ stutas(ChangLiang.isrun);
+ ChangLiang.zishuodong = "T";
+ AblStepHandler.sendMsg(AblSteps.STEP_70);
+ }
+ break;
+ case "4"://帐号登录任务
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_90);
+ break;
+ //抢红包
+ case "5":
+ AblStepHandler.getInstance().initStepClass(new TestAblStep34(mContext));
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_249);
+ break;
+ //粉丝互动
+ case "51":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_180);
+ break;
+ case "6":
+ AblStepHandler.getInstance().initStepClass(new TestAblStep30());
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_210);
+ break;
+ //大V粉丝截流
+ case "61":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_130);
+ break;
+ case "7"://潜在客户加关(大咖)
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_170);
+ break;
+ case "8"://潜在客户加关(关键词)
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_160);
+ break;
+ case "9"://粉丝通知
+ stutas(ChangLiang.isrun);
+ String lettertype = ProfileSpUtils.getInstance().getFensiNotice().getLettertype();
+ Log.e("类型", lettertype);
+ if (lettertype.equals("1")) {
+ AblStepHandler.sendMsg(AblSteps.STEP_201);
+ } else if (lettertype.equals("2")) {
+ AblStepHandler.sendMsg(AblSteps.STEP_80);
+ } else {
+ AblStepHandler.sendMsg(AblSteps.STEP_120);
+ }
+ break;
+ //直播间加热
+ case "10":
+
+ break;
+ //抢福袋
+ case "12":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_221);
+ break;
+ //关注指定直播间
+ case "13":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_231);
+ break;
+ //随机直播间
+ case "14":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_241);
+ break;
+ //直播间抢红包
+ case "15":
+
+ break;
+ default:
+ Log.e("TIAOSHI###", "执行的功能类型不匹配");
+ break;
+ }
+
+ binding.tv1.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // Log.e("TIAOSHI###", "func_type=="+func_type);
+ AblStepHandler.getInstance().setStop(false);
+ switch (func_type) {
+ case "1":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_9);
+ break;
+ case "2":
+ if (AblUtil.isAccessibilityServiceOpen(mContext)) {
+ stutas(ChangLiang.isrun);
+ if (ChangLiang.cancelclosed && !ChangLiang.cancelcrosscor) {
+ Log.e("TIAOSHI###", "执行取消关注");
+ AblStepHandler.sendMsg(AblSteps.STEP_11);
+ }
+ //取消互关
+ if (ChangLiang.cancelcrosscor && !ChangLiang.cancelclosed) {
+ Log.e("TIAOSHI###", "执行取消相互关注");
+ AblStepHandler.sendMsg(AblSteps.STEP_15);
+ }
+ //取消互关+取消已关
+ if (ChangLiang.cancelcrosscor && ChangLiang.cancelclosed) {
+ Log.e("TIAOSHI###", "执行取消相互关注+取消已关");
+ AblStepHandler.sendMsg(AblSteps.STEP_60);
+ }
+ } else {
+ ToastUtils.showShort("点到了");
+ ToastUtils.showShort("请先开启辅助服务");
+ AblUtil.openAccessibilitySettings();
+ }
+ break;
+ case "3"://执行幢号任务
+ if (ChangLiang.if_quguan.equals("0")) {
+ stutas(ChangLiang.isrun);
+ ChangLiang.zishuodong = "T";
+ AblStepHandler.sendMsg(AblSteps.STEP_70);
+ } else {
+ stutas(ChangLiang.isrun);
+ ChangLiang.zishuodong = "T";
+ AblStepHandler.sendMsg(AblSteps.STEP_70);
+ }
+ break;
+ case "4"://帐号登录任务
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_90);
+ break;
+ case "5"://粉丝互动
+ AblStepHandler.getInstance().initStepClass(new TestAblStep34(mContext));
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_249);
+ break;
+ //粉丝互动
+ case "51":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_180);
+ break;
+ case "6":
+ AblStepHandler.getInstance().initStepClass(new TestAblStep30());
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_210);
+ break;
+ //大V粉丝截流
+ case "61":
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_130);
+ break;
+ case "7"://潜在客户加关(大咖)
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_170);
+ break;
+ case "8"://潜在客户加关(关键词)
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_160);
+ break;
+ case "9"://粉丝通知
+ stutas(ChangLiang.isrun);
+ String lettertype = ProfileSpUtils.getInstance().getFensiNotice().getLettertype();
+ Log.e("类型", lettertype);
+ if (lettertype.equals("1")) {
+ AblStepHandler.sendMsg(AblSteps.STEP_201);
+ } else if (lettertype.equals("2")) {
+ AblStepHandler.sendMsg(AblSteps.STEP_80);
+ } else {
+ AblStepHandler.sendMsg(AblSteps.STEP_120);
+ }
+ break;
+ case "10"://直播间加热
+ AblStepHandler.getInstance().initStepClass(new TestAblStep30());
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_210);
+ break;
+ case "12"://抢福袋
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_221);
+ break;
+ case "13"://关注指定直播间
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_231);
+ break;
+ case "14"://随机直播间
+ stutas(ChangLiang.isrun);
+ AblStepHandler.sendMsg(AblSteps.STEP_241);
+ break;
+ case "15"://直播间抢红包
+
+ break;
+ default:
+ Log.e("TIAOSHI###", "执行的功能类型不匹配");
+ break;
+ }
+
+ }
+ });
+ binding.tv2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ stutas(ChangLiang.isrun);
+ Log.e("TIAOSHI###", "停止服务");
+ AblStepHandler.getInstance().setStop(true);
+ ChangLiang.short_id="";// 当前执行任务抖音id
+ ChangLiang.task_id="";//当前执行任务id
+ ChangLiang.id="";//当前执行任务功能id
+ ChangLiang.task_type="";//当前执行任务类型
+ LiveEventBus.get("closedtime").post("");
+ }
+ });
+ binding.tv4.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ windowManager.removeView(binding.getRoot());
+ addWinEntity.isopen = false;
+ }
+ });
+ binding.rl04.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //缩小浮窗
+ if (ChangLiang.isopoen) {
+ binding.rlAt.setVisibility(View.GONE);
+ binding.image01.setBackgroundResource(R.mipmap.icon_open);
+ ChangLiang.isopoen = false;
+ } else {
+ binding.rlAt.setVisibility(View.VISIBLE);
+ binding.image01.setBackgroundResource(R.mipmap.icon_bianzu);
+ ChangLiang.isopoen = true;
+ }
+ }
+ });
+ return binding.getRoot();
+ }
+
+ public void stutas(boolean isrun) {
+ if (isrun) {
+ binding.tv1.setVisibility(View.VISIBLE);
+ binding.tv2.setVisibility(View.GONE);;
+ ChangLiang.isrun = false;
+ } else {
+ binding.tv1.setVisibility(View.GONE);
+ binding.tv2.setVisibility(View.VISIBLE);
+ ChangLiang.isrun = true;
+ }
+ }
+
+ /**
+ * 退出悬浮窗
+ */
+ public void closedWin(){
+ WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
+ windowManager.removeView(binding.getRoot());
+ addWinEntity.isopen = false;
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/DakaActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/DakaActivity.java
new file mode 100644
index 0000000..bddd777
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/DakaActivity.java
@@ -0,0 +1,188 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.adapter.DakaAdapter;
+import com.fisherbone.fuzhu.entity.AddDakaBeanData;
+import com.fisherbone.fuzhu.okgonet.HttpConstants;
+import com.fisherbone.fuzhu.okgonet.NetApi;
+import com.fisherbone.fuzhu.utils.ToastUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+import com.google.gson.Gson;
+import com.lzy.okgo.model.HttpParams;
+import com.lzy.okgo.model.Response;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 新建大咖页面
+ */
+public class DakaActivity extends BaseActivity {
+
+ private RecyclerView mRecyclerView;
+ private DakaAdapter headerAndFooterAdapter;
+ private List statuses;
+ private TitleBar mTitleBar;
+ private String type="1";//1:大咖,2:视频关键词
+ private EditText et_coneten;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_prilet);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("新建大咖");
+ initNormalBack();
+ mTitleBar.visibleTvRightTextBtn(true);
+ mTitleBar.setTvRightText("确定");
+ type = getIntent().getStringExtra("type");
+ mTitleBar.setTvRightTextColor(R.color.color_30B9B6);
+ mTitleBar.setOnTitleBarAllClickListener(new TitleBar.OnTitleBarAllClickListener() {
+ @Override
+ public void onRightTextButtonClick(View view) {
+ Gson gson = new Gson();
+ // ToastUtils.showToast(ScriptSettingActivity.this, s1);
+ ArrayList strings = new ArrayList<>();
+ for(int i=0;i();
+ AddDakaBeanData status = new AddDakaBeanData();
+ statuses.add(status);
+ initAdapter();
+ View footerView = getFooterView(0, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // headerAndFooterAdapter.addFooterView(getFooterView(1, getRemoveFooterListener()), 0);
+
+ AddDakaBeanData status = new AddDakaBeanData();
+ statuses.add(status);
+ headerAndFooterAdapter.notifyDataSetChanged();
+ int size = statuses.size();
+ mRecyclerView.scrollToPosition(size); // 将ListView定位到最后一行
+ }
+ });
+ View headView = getHeadView(type, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ }
+ });
+ headerAndFooterAdapter.addHeaderView(headView,0);
+ headerAndFooterAdapter.addFooterView(footerView, 0);
+ mRecyclerView.setAdapter(headerAndFooterAdapter);
+ }
+
+ private View getFooterView(int type, View.OnClickListener listener) {
+ View view = getLayoutInflater().inflate(R.layout.footer_prilet_view, (ViewGroup) mRecyclerView.getParent(), false);
+ if (type == 1) {
+ ImageView imageView = (ImageView) view.findViewById(R.id.iv);
+ imageView.setImageResource(R.mipmap.rm_icon);
+ }
+ view.setOnClickListener(listener);
+ return view;
+ }
+ private View getHeadView(String type, View.OnClickListener listener) {
+ View view = getLayoutInflater().inflate(R.layout.head_prilet_view, (ViewGroup) mRecyclerView.getParent(), false);
+ if (type.equals("1")) {
+ TextView tv_head = (TextView) view.findViewById(R.id.tv_head);
+ tv_head.setText("大咖抖音昵称");
+ }else {
+ TextView tv_head = (TextView) view.findViewById(R.id.tv_head);
+ tv_head.setText("视频关键词");
+ }
+ et_coneten = (EditText)view.findViewById(R.id.et_coneten);
+ view.setOnClickListener(listener);
+ return view;
+ }
+
+
+ private View.OnClickListener getRemoveFooterListener() {
+ return new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ headerAndFooterAdapter.removeFooterView(v);
+ }
+ };
+ }
+
+ private void initAdapter() {
+
+ headerAndFooterAdapter = new DakaAdapter(statuses);
+ headerAndFooterAdapter.openLoadAnimation();
+ mRecyclerView.setAdapter(headerAndFooterAdapter);
+ headerAndFooterAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+ @Override
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+ Toast.makeText(DakaActivity.this, "" + Integer.toString(position), Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+
+ private void addDakaVideo(String s1){
+ final HttpParams paramsPost = new HttpParams();
+ paramsPost.put("name", et_coneten.getText().toString());
+ paramsPost.put("key_name", s1);
+ paramsPost.put("type", type);
+ new NetApi().getPostData(paramsPost, HttpConstants.URi_Device_Appoperate_addDakaVideo).subscribe(new com.fisherbone.fuzhu.okgonet.Observer() {
+ @Override
+ public void onNext(Response response) {
+ String body = (String) response.body();
+ try {
+ JSONObject jsonObject = new JSONObject(body);
+ String msg = jsonObject.getString("msg");
+ String success = jsonObject.getString("success");
+ if(success.equals("0")){
+ finish();
+ ToastUtils.showToast(DakaActivity.this, msg);
+ }
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void onError(Exception e) {
+ e.printStackTrace();
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java
new file mode 100644
index 0000000..ce7031a
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/DavActivity.java
@@ -0,0 +1,130 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.ChangLiang;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.databinding.ActivityDavBinding;
+import com.fisherbone.fuzhu.db.CommentBeanData;
+import com.fisherbone.fuzhu.db.dao.CommentDao;
+import com.fisherbone.fuzhu.entity.DavBean;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.entity.HusshuBean;
+import com.fisherbone.fuzhu.entity.addWinEntity;
+import com.fisherbone.fuzhu.utils.GetJsonDataUtil;
+import com.fisherbone.fuzhu.utils.JsonUtils;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.utils.StringUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.greenrobot.event.EventBus;
+
+/**
+ * 大V粉丝截流
+ */
+public class DavActivity extends BaseActivity {
+ private ActivityDavBinding binding;
+ private TitleBar mTitleBar;
+ private DavBean davCan;
+ private CommentDao commentDao;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_dav);
+ davCan = ProfileSpUtils.getInstance().getDavCan();
+ binding.setDavbean(davCan);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("大V粉丝截流");
+ initNormalBack();
+ commentDao = new CommentDao(DavActivity.this);
+ //给数据库插入十条默认数据
+ ArrayList commentBeanData = commentDao.queryAll();
+ if(commentBeanData.size()==0) {
+ Log.e("ceshi","添加了数据");
+ madeData();
+ }
+
+ binding.rlStart.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ // ToastUtils.showShort("点到了");
+ Log.e("TIAOSHI###==发送的dav粉丝截流参数", davCan.toString());
+ //将参数数据缓存起来
+ ChangLiang.dav_runningtime = davCan.getRunningtime();
+ ChangLiang.dav_maxnumcon =davCan.getMaxnumcon();
+ ChangLiang.dav_douyinhao =davCan.getDavdouyin();
+ ChangLiang.dav_guanjianci =davCan.getGuanjianci();
+ ChangLiang.dav_minimumlikes =davCan.getMinimumlikes();
+ ChangLiang.dav_minimumcon =davCan.getMinimumcon();
+ ChangLiang.dav_minimumzuopin =davCan.getMinimumzuopin();
+ ChangLiang.dav_maxmumzuopin =davCan.getMaxmumzuopin();
+ ChangLiang.dav_maxmumlikes =davCan.getMaxmumlikes();
+ ChangLiang.dav_maximumcon =davCan.getMaximumcon();
+ //存储参数信息
+ ProfileSpUtils.getInstance().saveDavCan(davCan);
+ if (StringUtils.isEmpty(davCan.getRunningtime())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "运行时长");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMaxnumcon())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最大关注数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMinimumlikes())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最小加关关注数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMinimumcon())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最小加关粉丝数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMinimumzuopin())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最小作品数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMaxmumzuopin())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最大作品数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMaxmumlikes())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最大加关关注数");
+ return;
+ }
+ if (StringUtils.isEmpty(davCan.getMaximumcon())) {
+ com.fisherbone.fuzhu.utils.ToastUtils.showToast(DavActivity.this, "最大粉丝数");
+ return;
+ }
+
+ if(!addWinEntity.cancleisopen){
+ //下面两个步骤不能同时执行
+ Log.e("TIAOSHI###==发送的粉丝互动参数", "执行粉丝互动");
+ EventBus.getDefault().post(new FourEvent("success","4"));
+ }
+ }
+ });
+ }
+
+
+ private void madeData() {
+ String JsonData = new GetJsonDataUtil().getJson(DavActivity.this, "huashu.json");//获取assets目录下的json文件数据
+ HusshuBean resultt = JsonUtils.fromJson(JsonData, HusshuBean.class);
+ List data = resultt.getData();
+ for (int i = 0; i < data.size(); i++) {
+ CommentBeanData commentBeanData = data.get(i);
+ if (null != commentDao.queryByCustom("Id", commentBeanData.getId()) && commentDao.queryByCustom("Id", commentBeanData.getId()).size() > 0) {
+ commentDao.updateData(commentBeanData);
+ } else {
+ commentDao.addInsert(commentBeanData);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java b/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java
new file mode 100644
index 0000000..df7fcd4
--- /dev/null
+++ b/app/src/main/java/com/fisherbone/fuzhu/activity/HongBaoActivity.java
@@ -0,0 +1,45 @@
+package com.fisherbone.fuzhu.activity;
+
+import android.os.Bundle;
+
+import androidx.databinding.DataBindingUtil;
+
+import com.fisherbone.fuzhu.BaseActivity;
+import com.fisherbone.fuzhu.R;
+import com.fisherbone.fuzhu.databinding.ActivityHongBaoBinding;
+import com.fisherbone.fuzhu.entity.FourEvent;
+import com.fisherbone.fuzhu.entity.RedEnvBean;
+import com.fisherbone.fuzhu.utils.ProfileSpUtils;
+import com.fisherbone.fuzhu.widget.TitleBar;
+import com.jakewharton.rxbinding2.view.RxView;
+
+import java.util.concurrent.TimeUnit;
+
+import de.greenrobot.event.EventBus;
+import io.reactivex.functions.Consumer;
+
+public class HongBaoActivity extends BaseActivity {
+ private TitleBar mTitleBar;
+ private ActivityHongBaoBinding binding;
+ private RedEnvBean redEnvBean;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_hong_bao);
+ redEnvBean = ProfileSpUtils.getInstance().getRedEnvBean();
+ binding.setRedEnvBean(redEnvBean);
+ mTitleBar = (TitleBar) findViewById(R.id.title_bar);
+ mTitleBar.setTitle("关注直播间抢抖币");
+ initNormalBack();
+ RxView.clicks(binding.appRlStart)
+ .throttleFirst(3, TimeUnit.SECONDS)
+ .subscribe(new Consumer