Skip to content

Commit

Permalink
1、升级版本
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyJingFish committed May 10, 2024
1 parent 9f3871b commit 26aa552
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 16 deletions.
59 changes: 52 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
plugins {
//必须项 👇 apply 设置为 true 自动为所有module“预”配置debugMode,false则按下边步骤五的方式二
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.3" apply true
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.4" apply true
}
```

Expand All @@ -80,7 +80,7 @@ plugins {
buildscript {
dependencies {
//必须项 👇
classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.7.3'
classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.7.4'
}
}
// 👇加上这句自动为所有module“预”配置debugMode,不加则按下边步骤五的方式二
Expand Down Expand Up @@ -115,7 +115,7 @@ apply plugin: 'android.aop' //最好放在最后一行
//必须项 👇
plugins {
...
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.3"
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.4"
}
```

Expand All @@ -141,17 +141,17 @@ plugins {
dependencies {
//必须项 👇
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.7.3'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.7.3'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.7.4'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.7.4'
//必须项 👇如果您项目内已经有了这项不用加也可以
implementation 'androidx.appcompat:appcompat:1.3.0' // 至少在1.3.0及以上
//非必须项 👇,如果你想自定义切面需要用到,⚠️支持Java和Kotlin代码写的切面
ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.7.3'
ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.7.4'
//非必须项 👇,如果你想自定义切面需要用到,⚠️只适用于Java代码写的切面
annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.7.3'
annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.7.4'
//⚠️上边的 android-aop-ksp 和 android-aop-processor 二选一
}
```
Expand Down Expand Up @@ -378,6 +378,7 @@ AndroidAop.INSTANCE.setOnToastListener(new OnToastListener() {
- @AndroidAopMatchClassMethod 是匹配类的方法的切面
- @AndroidAopReplaceClass 是替换方法调用的
- @AndroidAopModifyExtendsClass 是修改继承类
- @AndroidAopCollectMethod 是收集直接的继承类

#### 一、**@AndroidAopPointCut** 是在方法上通过注解的形式做切面的,上述中注解都是通过这个做的,[详细使用请看wiki文档](https://github.com/FlyJingFish/AndroidAOP/wiki/@AndroidAopPointCut)

Expand Down Expand Up @@ -594,6 +595,50 @@ public class ReplaceImageView extends ImageView {
}
```

#### 五、**@AndroidAopCollectMethod** 是收集直接的继承类[详细使用方式](https://github.com/FlyJingFish/AndroidAOP/wiki/@AndroidAopCollectMethod)

使用起来极其简单,示例代码已经说明了

- Kotlin

```kotlin
object InitCollect {
private val collects = mutableListOf<SubApplication>()

@AndroidAopCollectMethod
@JvmStatic
fun collect(sub: SubApplication){
collects.add(sub)
}

//直接调这个方法 collects 集合就是有数据的
fun init(application: Application){
for (collect in collects) {
collect.onCreate(application)
}
}
}
```

- Java

```java
public class InitCollect2 {
private static List<SubApplication2> collects = new ArrayList<>();
@AndroidAopCollectMethod
public static void collect(SubApplication2 sub){
collects.add(sub);
}

//直接调这个方法 collects 集合就是有数据的
public static void init(Application application){
Log.e("InitCollect2","----init----");
for (SubApplication2 collect : collects) {
collect.onCreate(application);
}
}
}
```

### 常见问题

Expand Down
57 changes: 51 additions & 6 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ plugins {
buildscript {
dependencies {
//Required items 👇
classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.7.3'
classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.7.4'
}
}
//👇Add this sentence to automatically apply debugMode to all modules. If not, follow step 5 below.
Expand Down Expand Up @@ -114,7 +114,7 @@ Add directly to ```build.gradle``` of **app**
//Required items 👇
plugins {
...
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.3"
id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.7.4"
}
```

Expand Down Expand Up @@ -144,16 +144,16 @@ plugins {
dependencies {
//Required items 👇
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.7.3'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.7.3'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.7.4'
implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.7.4'
//Required item 👇If you already have this item in your project, you don’t need to add it.
implementation 'androidx.appcompat:appcompat:1.3.0' // At least in 1.3.0 and above
//Optional 👇, if you want to customize aspects, you need to use them, ⚠️supports aspects written in Java and Kotlin code
ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.7.3'
ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.7.4'
//Optional 👇, if you want to customize aspects, you need to use them, ⚠️only applies to aspects written in Java code
annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.7.3'
annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.7.4'
//⚠️Choose one of the above android-aop-ksp and android-aop-processor
}
```
Expand Down Expand Up @@ -358,6 +358,7 @@ AndroidAop.INSTANCE.setOnToastListener(new OnToastListener() {
- @AndroidAopMatchClassMethod is the aspect of matching class methods
- @AndroidAopReplaceClass is called by the replacement method
- @AndroidAopModifyExtendsClass is a modified inherited class
- @AndroidAopCollectMethod is the direct inheritance class of collection

#### 1. **@AndroidAopPointCut** is used to make aspects in the form of annotations on the method. The above annotations are all made through this. [Please see the wiki document for detailed usage](https://github.com/FlyJingFish/AndroidAOP/wiki/@AndroidAopPointCut)

Expand Down Expand Up @@ -554,6 +555,50 @@ public class ReplaceImageView extends ImageView {
}
```

#### 5. **@AndroidAopCollectMethod** is a direct inheritance class of collection [detailed usage] (https://github.com/FlyJingFish/AndroidAOP/wiki/@AndroidAopCollectMethod)

It is extremely simple to use, the sample code has already explained

- Kotlin

```kotlin
objectInitCollect {
private val collects = mutableListOf<SubApplication>()

@AndroidAopCollectMethod
@JvmStatic
fun collect(sub: SubApplication){
collects.add(sub)
}

// Call this method directly. The collects collection contains data.
fun init(application: Application){
for (collect in collects) {
collect.onCreate(application)
}
}
}
```

-Java

```java
public class InitCollect2 {
private static List<SubApplication2> collects = new ArrayList<>();
@AndroidAopCollectMethod
public static void collect(SubApplication2 sub){
collects.add(sub);
}

// Call this method directly. The collects collection contains data.
public static void init(Application application){
Log.e("InitCollect2","----init----");
for (SubApplication2 collect : collects) {
collect.onCreate(application);
}
}
}
```

### common problem

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DEVELOPER_ID=FlyJingFish
DEVELOPER_NAME=FlyJingFish
DEVELOPER_EMAIL=[email protected]

TestVersion = 1.7.3
TestVersion = 1.7.4
SonatypeTestCode = 1395
TestType = 0
androidAop.debugMode = true
Expand Down
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu May 09 11:47:14 CST 2024
PROJ_VERSION=1.7.3
#Fri May 10 18:38:56 CST 2024
PROJ_VERSION=1.7.4

0 comments on commit 26aa552

Please sign in to comment.