├── aop ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── colors.xml │ │ ├── java │ │ └── com │ │ │ └── cby │ │ │ └── aspectj │ │ │ ├── common │ │ │ ├── Constant.java │ │ │ └── Interceptor.java │ │ │ ├── annotation │ │ │ ├── JSingleClick.java │ │ │ ├── JPermission.java │ │ │ ├── JIntercept.java │ │ │ └── JTrace.java │ │ │ ├── aspectj │ │ │ ├── Precedence.java │ │ │ ├── SingleClickAspect.java │ │ │ ├── InterceptAspect.java │ │ │ ├── TraceAspect.java │ │ │ └── PermissionAspect.java │ │ │ ├── util │ │ │ ├── StopWatch.java │ │ │ ├── SingleClickUtil.java │ │ │ ├── DebugLog.java │ │ │ ├── PermissionFragment.java │ │ │ ├── PermissionConsts.java │ │ │ ├── Utils.java │ │ │ └── PermissionUtils.java │ │ │ └── Aop.java │ │ └── AndroidManifest.xml └── build.gradle ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_login.xml │ │ │ │ ├── activity_second.xml │ │ │ │ └── activity_main.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── cby │ │ │ │ └── jaop │ │ │ │ ├── SecondActivity.java │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── JApplication.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── cby │ │ │ └── singleclickdemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── cby │ │ └── singleclickdemo │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── encodings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── inspectionProfiles │ └── Project_Default.xml └── codeStyles │ └── Project.xml ├── localMaven.gradle ├── aspectj-plugin ├── build.gradle └── src │ └── main │ ├── resources │ └── META-INF │ │ └── gradle-plugins │ │ └── aspectj-plugin.properties │ └── groovy │ └── com │ └── cby │ └── aop_plugin │ └── AspectjPlugin.groovy ├── gradle.properties ├── .gitignore ├── gradlew.bat ├── README.md ├── bintrayUpload.gradle └── gradlew /aop/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':aop' -------------------------------------------------------------------------------- /aop/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /aop/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /aop/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | JAop 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chen-Baiyi/JAop/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/common/Constant.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.common; 2 | 3 | public class Constant { 4 | public static String TAG = "cby_aop -> "; 5 | } 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /aop/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 14 22:37:06 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/annotation/JSingleClick.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.annotation; 2 | 3 | 4 | import java.lang.annotation.ElementType; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | @Target(ElementType.METHOD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | public @interface JSingleClick { 12 | // 默认值 13 | long value() default 1000; 14 | } 15 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/common/Interceptor.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.common; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | 5 | public interface Interceptor { 6 | 7 | /** 8 | * 执行拦截 9 | * @param type 拦截的类型 10 | * @param joinPoint 切片切点 11 | * @return {@code true}: 拦截切片的执行
{@code false}: 不拦截切片的执行 12 | * @throws Throwable 13 | */ 14 | boolean intercept(int type, JoinPoint joinPoint) throws Throwable; 15 | 16 | } -------------------------------------------------------------------------------- /app/src/main/java/com/cby/jaop/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.cby.jaop; 2 | 3 | import android.os.Bundle; 4 | import androidx.annotation.Nullable; 5 | import androidx.fragment.app.FragmentActivity; 6 | 7 | public class SecondActivity extends FragmentActivity { 8 | @Override 9 | protected void onCreate(@Nullable Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_second); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /localMaven.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven' 2 | 3 | def groupName = 'com.cby.aop' 4 | def artifactName = 'aspectj-plugin' 5 | def versionName = '1.0.0' 6 | 7 | // 本地仓库发布 8 | uploadArchives { 9 | // 使用当前目录下面的maven仓库,仓库在当前目录的repo文件目录中 10 | repositories { 11 | mavenDeployer { 12 | pom.groupId = "${groupName}" 13 | pom.artifactId = "${artifactName}" 14 | pom.version = "${versionName}" 15 | repository(url: uri('../repo')) 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/test/java/com/cby/singleclickdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.cby.singleclickdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/annotation/JPermission.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Target({ElementType.METHOD, ElementType.PARAMETER}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface JPermission { 11 | 12 | /** 13 | * 拦截类型 14 | * 15 | * @return 16 | */ 17 | String[] value(); 18 | } 19 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/cby/jaop/LoginActivity.java: -------------------------------------------------------------------------------- 1 | package com.cby.jaop; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.os.Bundle; 5 | import androidx.annotation.Nullable; 6 | import androidx.fragment.app.FragmentActivity; 7 | 8 | @SuppressLint("Registered") 9 | public class LoginActivity extends FragmentActivity { 10 | 11 | @Override 12 | protected void onCreate(@Nullable Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_login); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /aspectj-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply plugin: 'maven' 3 | 4 | targetCompatibility = JavaVersion.VERSION_1_8 5 | sourceCompatibility = JavaVersion.VERSION_1_8 6 | 7 | dependencies { 8 | implementation gradleApi() 9 | implementation localGroovy() 10 | implementation 'com.android.tools.build:gradle:3.3.0' 11 | implementation 'org.aspectj:aspectjtools:1.9.3' 12 | } 13 | repositories { 14 | jcenter() 15 | mavenCentral() 16 | } 17 | 18 | apply from: "../bintrayUpload.gradle" 19 | //apply from: "../localMaven.gradle" 20 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/aspectj/Precedence.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.aspectj; 2 | 3 | import org.aspectj.lang.annotation.Aspect; 4 | import org.aspectj.lang.annotation.DeclarePrecedence; 5 | 6 | /** 7 | * @Desc 定义多个 @Aspect 的顺序(优先级) 8 | * @Author cby 9 | * @Time 2019/5/22 11:41 10 | */ 11 | @Aspect 12 | @DeclarePrecedence( 13 | "com.cby.aspectj.aspectj.SingleClickAspect," + 14 | "com.cby.aspectj.aspectj.InterceptAspect," + 15 | "com.cby.aspectj.aspectj.PermissionAspect") 16 | public class Precedence { 17 | } 18 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/annotation/JIntercept.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 自定义拦截注解 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) // 作用于:运行时 12 | @Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) //作用于:字段声明、方法、类 13 | public @interface JIntercept { 14 | 15 | /** 16 | * @return 拦截类型 17 | */ 18 | int[] value(); 19 | } 20 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /aop/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | // aspectj 插件 4 | apply plugin: 'aspectj-plugin' 5 | 6 | group='com.github.Chen-Baiyi' 7 | 8 | android { 9 | compileSdkVersion 29 10 | defaultConfig { 11 | minSdkVersion 15 12 | targetSdkVersion 29 13 | versionCode 8 14 | versionName "1.1.0" 15 | } 16 | 17 | compileOptions { 18 | sourceCompatibility 1.8 19 | targetCompatibility 1.8 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(include: ['*.jar'], dir: 'libs') 25 | implementation 'androidx.appcompat:appcompat:1.1.0' 26 | implementation 'org.aspectj:aspectjrt:1.9.3' 27 | } 28 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/annotation/JTrace.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * @ProjectName: JAop 10 | * @Package: com.cby.aspectj.annotation 11 | * @ClassName: JTrace 12 | * @Description: 性能监测 13 | * @Author: 陈白衣 14 | * @CreateDate: 2019/8/8 1:11 15 | * @UpdateUser: 更新者 16 | * @UpdateDate: 2019/8/8 1:11 17 | * @UpdateRemark: 更新说明 18 | * @Version: 1.0.5 19 | */ 20 | 21 | @Retention(RetentionPolicy.RUNTIME) // 作用于:运行时 22 | @Target({ElementType.METHOD, ElementType.TYPE}) //作用于:方法、类 23 | public @interface JTrace { 24 | } 25 | -------------------------------------------------------------------------------- /aspectj-plugin/src/main/resources/META-INF/gradle-plugins/aspectj-plugin.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com) 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | implementation-class=com.cby.aop_plugin.AspectjPlugin -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/cby/singleclickdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.cby.singleclickdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.cby.singleclickdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/util/StopWatch.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.util; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | public class StopWatch { 6 | private long startTime; 7 | private long endTime; 8 | private long elapsedTime; 9 | 10 | public StopWatch() { 11 | //empty 12 | } 13 | 14 | private void reset() { 15 | startTime = 0; 16 | endTime = 0; 17 | elapsedTime = 0; 18 | } 19 | 20 | public void start() { 21 | reset(); 22 | startTime = System.nanoTime(); 23 | } 24 | 25 | public void stop() { 26 | if (startTime != 0) { 27 | endTime = System.nanoTime(); 28 | elapsedTime = endTime - startTime; 29 | } else { 30 | reset(); 31 | } 32 | } 33 | 34 | public long getTotalTimeMillis() { 35 | return (elapsedTime != 0) ? TimeUnit.NANOSECONDS.toMillis(endTime - startTime) : 0; 36 | } 37 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx512m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | 16 | BUILD_TOOL_VERSION=29.0.0 17 | ANDROID_SUPPORT_VERSION=29.+ 18 | JUNIT_VERSION=4.12 19 | ESPRESSO_VERSION=2.2.2 20 | android.useAndroidX=true 21 | android.enableJetifier=true -------------------------------------------------------------------------------- /aop/src/main/java/com/cby/aspectj/util/SingleClickUtil.java: -------------------------------------------------------------------------------- 1 | package com.cby.aspectj.util; 2 | 3 | import android.os.SystemClock; 4 | import android.view.View; 5 | 6 | public class SingleClickUtil { 7 | 8 | private static long mLastClickTime; 9 | private static int mLastClickViewId; 10 | 11 | 12 | /** 13 | * 是否快速点击 14 | * 15 | * @param view 点击的控件 16 | * @param intervalMillis 时间间隔(毫秒) 17 | * @return true:是;false:不是 18 | */ 19 | public static boolean isFastDoubleClick(View view, long intervalMillis) { 20 | int viewId = view.getId(); 21 | long time = SystemClock.elapsedRealtime(); 22 | long timeInerval = Math.abs(time - mLastClickTime); 23 | if (timeInerval < intervalMillis && viewId == mLastClickViewId) { 24 | return true; 25 | } else { 26 | mLastClickTime = time; 27 | mLastClickViewId = viewId; 28 | return false; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | // aspectj 插件 3 | apply plugin: 'aspectj-plugin' 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "${BUILD_TOOL_VERSION}" 8 | defaultConfig { 9 | applicationId "com.cby.jaop" 10 | minSdkVersion 15 11 | targetSdkVersion 29 12 | versionCode 1 13 | versionName "1.0.0" 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | compileOptions { 25 | sourceCompatibility 1.8 26 | targetCompatibility 1.8 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(include: ['*.jar'], dir: 'libs') 32 | implementation 'androidx.appcompat:appcompat:1.1.0' 33 | testImplementation "junit:junit:${JUNIT_VERSION}" 34 | //引入aspectj的依赖 35 | implementation project(':aop') 36 | // implementation 'com.github.Chen-Baiyi:JAop:1.0.3' 37 | // implementation 'com.cby.aop:aspectj-plugin:1.0.1' 38 | // annotationProcessor 'com.cby.aop:aspectj-plugin:1.0.1' 39 | } 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | *.aab 5 | 6 | # Files for the ART/Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | out/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea/workspace.xml 39 | .idea/tasks.xml 40 | .idea/gradle.xml 41 | .idea/assetWizardSettings.xml 42 | .idea/dictionaries 43 | .idea/libraries 44 | .idea/caches 45 | 46 | # Keystore files 47 | # Uncomment the following lines if you do not want to check your keystore files in. 48 | #*.jks 49 | #*.keystore 50 | 51 | # External native build folder generated in Android Studio 2.2 and later 52 | .externalNativeBuild 53 | 54 | # Google Services (e.g. APIs or Firebase) 55 | # google-services.json 56 | 57 | # Freeline 58 | freeline.py 59 | freeline/ 60 | freeline_project_description.json 61 | 62 | # fastlane 63 | fastlane/report.xml 64 | fastlane/Preview.html 65 | fastlane/screenshots 66 | fastlane/test_output 67 | fastlane/readme.md 68 | 69 | # Version control 70 | vcs.xml 71 | 72 | # lint 73 | lint/intermediates/ 74 | lint/generated/ 75 | lint/outputs/ 76 | lint/tmp/ 77 | # lint/reports/ 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 |