diff --git a/README.md b/README.md index 7c01e00..fb3031a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,13 @@ # AsmActualCombat -ASM实战——埋点 -- 可动态设置方法对点击事件处理之前进行拦截 -- 可获取方法的耗时时间 -- 默认包含防止多次点击事件的处理 -- 可动态配置是否开启插件,默认是开启 -#### 怎样使用 +**使用文档链接:https://github.com/Peakmain/AsmActualCombat/wiki** + +#### How To **ASM插件依赖** Add it in your root build.gradle at the end of repositories: ``` buildscript { dependencies { - classpath "io.github.peakmain:plugin:1.0.1" + classpath "io.github.peakmain:plugin:1.0.8" } } @@ -30,63 +27,12 @@ Add it in your root build.gradle at the end of repositories: - Step 2. Add the dependency ``` dependencies { - implementation 'com.github.Peakmain:AsmActualCombat:1.0.0' + implementation 'com.github.Peakmain:AsmActualCombat:1.0.5' } ``` -#### 使用文档 -- 1、Application中初始化 -``` - SensorsDataAPI.init(this); -``` -- 2、动态设置是否开启插件 -在gradle.properties中设置以下参数,false代表不关闭插件,true表示关闭插件,默认是false -``` -peakmainPlugin.disableAppClick=false -``` -- 3、在要拦截的页面设置拦截事件 -``` - SensorsDataAPI.getInstance().setOnUserAgreementListener(new SensorsDataAPI.OnUserAgreementListener() { - @Override - public boolean onUserAgreement() { - - } - }) -``` -完整的举例代码如下: -``` - private void setUserAgreementListener(Activity activity) { - isAcceptUserPrivacy = (Boolean) PreferencesUtils.getInstance(this).getParam(Constants.HAS_ACCEPT_USER_PRIVACY, false); - SensorsDataAPI.getInstance().setOnUserAgreementListener(new SensorsDataAPI.OnUserAgreementListener() { - @Override - public boolean onUserAgreement() { - if (!isAcceptUserPrivacy) { - //没有同意 - AlertDialog dialog = new AlertDialog.Builder(activity) - .setContentView(R.layout.dialog_user_agreement) - .setCancelable(false)//点击空白不可取消 - .show(); - //设置用户协议的拦截事件为NULL - SensorsDataAPI.getInstance().setOnUserAgreementListener(null); - dialog.setOnClickListener(R.id.stv_refuse, v -> { - //取消按钮的点击事件 - dialog.dismiss(); - setUserAgreementListener(activity); - }); - dialog.setOnClickListener(R.id.stv_agreement, v -> { - //同意按钮的点击事件 - com.peakmain.ui.utils.ToastUtils.showLong("同意了"); - PreferencesUtils.getInstance(activity).saveParams(Constants.HAS_ACCEPT_USER_PRIVACY, true); - dialog.dismiss(); - - }); - } - return isAcceptUserPrivacy; - } - }); -``` -- 4、获取方法耗时时间 -在需要获取耗时时间的方法上方添加以下注解 -``` - @LogMessageTime -``` + +#### 关于我 +- 我的Github:https://github.com/peakmain +- 我的简书:https://www.jianshu.com/u/3ff32f5aea98 +- 我的掘金:https://juejin.cn/user/175532853176152