Android aspect programming implementation (AOP)

AOP

Android aspect programming implements
GitHub warehouse address

introduce

gradle

allprojects {
    
    
    repositories {
    
    
        maven {
    
     url 'https://jitpack.io' }
    }
}

//如果使用aop,项目的build.gradle添加以下代码
dependencies {
    
    
    classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
}
//如果使用aop,app的build.gradle添加插件android-aspectjx
apply plugin: 'android-aspectjx'
// AOP 配置
// AspectJX默认会处理所有的二进制代码文件和库,为了提升编译效率及规避部分第三方库出现的编译兼容性问题,
// AspectJX提供include,exclude命令来过滤需要处理的文件及排除某些文件(包括class文件及jar文件)。
aspectjx {
    
    
     //只导入需要AspectJX处理的包com.zhangteng.aop必须添加
    include 'com.zhangteng.aop', '应用包名'
}

implementation 'com.github.DL-ZhangTeng:AOP:2.0.0'

aop toolkit (com/zhangteng/aop)

Tool package name/class name describe
TimeLog Add this annotation to methods that need to print time-consuming methods
TimeLogAspect Time-consuming method entry point processing logic
CheckNet Add this annotation to methods that require network detection
CheckNetAspect Network detection method entry point processing logic
Permissions Add this annotation to methods that require permission application
PermissionsAspect Permission application method entry point processing logic
SingleClick Add this annotation to methods that need to prevent repeated clicks
SingleClickAspect Anti-repeated click method entry point processing logic

Confuse

-keep public class com.zhangteng.**.*{ *; }

historic version

Version renew Update time
v2.0.0 Separate AOP from BaseLibrary 2022/9/14 at 22:36

Appreciate

If you like AOP, or feel that AOP has helped you, you can click "Star" in the upper right corner to support it. Your support is my motivation, thank you.

contact me

Email: [email protected]/[email protected]

License

Copyright © [2020] [Swing]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Guess you like

Origin blog.csdn.net/duoluo9/article/details/126879386