update Code · lvfaqiang/AndroidTestCode@b00e0fa · GitHub
Skip to content

Commit b00e0fa

Browse files
author
吕发强
committed
update Code
1 parent aadd31a commit b00e0fa

19 files changed

Lines changed: 305 additions & 50 deletions

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 0 deletions

app/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ apply plugin: 'kotlin-android'
44

55
apply plugin: 'kotlin-android-extensions'
66

7-
87
android {
98
compileSdkVersion 26
109
buildToolsVersion '26.0.2'
@@ -18,12 +17,16 @@ android {
1817
// jackOptions.enabled = true
1918
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2019
}
21-
compileOptions{
20+
compileOptions {
2221
sourceCompatibility JavaVersion.VERSION_1_8
2322
targetCompatibility JavaVersion.VERSION_1_8
2423
}
2524
buildTypes {
25+
debug {
26+
buildConfigField "boolean", "LOG_DEBUG", "true"
27+
}
2628
release {
29+
buildConfigField "boolean", "LOG_DEBUG", "false"
2730
minifyEnabled false
2831
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2932
}
@@ -38,13 +41,13 @@ dependencies {
3841
compile 'com.android.support:appcompat-v7:26.1.0'
3942
testCompile 'junit:junit:4.12'
4043
compile 'com.squareup.retrofit2:retrofit:2.3.0'
41-
// compile 'com.squareup.retrofit2:converter-gson:2.2.0'
44+
// compile 'com.squareup.retrofit2:converter-gson:2.2.0'
4245
compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
4346
compile 'com.android.support:design:26.1.0'
4447
compile 'com.lfq:AndroidUtils:1.1.6'
4548
compile 'com.lfq:MultiImageSelector:1.4'
4649
// compile 'com.github.bumptech.glide:glide:4.0.0'
47-
// annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
50+
// annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
4851
compile 'com.android.support:support-v4:26.1.0'
4952
compile 'com.zhy:base-rvadapter:3.0.3'
5053
compile 'com.github.bumptech.glide:glide:3.7.0'
@@ -55,4 +58,5 @@ dependencies {
5558
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
5659
implementation 'com.android.support:recyclerview-v7:26.1.0'
5760
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34'
61+
implementation project(':javaLib')
5862
}

app/src/main/java/com/lvfq/code/annotation/AnnotationTest1.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,4 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2323

2424
}
2525

26-
@OnCusBusEvent(tag = "" )
27-
private void mTest() {
28-
29-
}
3026
}

app/src/main/java/com/lvfq/code/annotation/AnnotationUtil.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/src/main/java/com/lvfq/code/annotation/Type.java

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.lvfq.code.proxy;
2+
3+
import com.lvfq.code.proxy.dynamic_proxy.DynamicProxy;
4+
import com.lvfq.code.proxy.static_proxy.ISubject;
5+
import com.lvfq.code.proxy.static_proxy.RealSubject;
6+
7+
import java.lang.reflect.Proxy;
8+
9+
/**
10+
* ProxyMain
11+
*
12+
* @author lvfq
13+
* @Github: https://github.com/lvfaqiang
14+
* @Blog: http://blog.csdn.net/lv_fq
15+
* @date 2017/12/6 下午1:46
16+
* @desc :
17+
*/
18+
19+
public class ProxyMain {
20+
public static void main(String[] args) {
21+
// 测试静态代理
22+
RealSubject realSubject = new RealSubject();
23+
// ProxySubject proxySubject = new ProxySubject(realSubject);
24+
// proxySubject.start();
25+
// proxySubject.pause();
26+
// proxySubject.stop();
27+
// System.out.println("result " + proxySubject.result());
28+
29+
// 测试动态代理
30+
DynamicProxy dynamicProxy = new DynamicProxy(realSubject);
31+
ISubject subject = (ISubject) Proxy.newProxyInstance(ISubject.class.getClassLoader(), new Class[]{ISubject.class}, dynamicProxy);
32+
33+
subject.start();
34+
subject.pause();
35+
subject.stop();
36+
37+
System.out.println("result " + subject.result());
38+
}
39+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.lvfq.code.proxy.dynamic_proxy;
2+
3+
import java.lang.reflect.InvocationHandler;
4+
import java.lang.reflect.Method;
5+
6+
/**
7+
* Dynamic
8+
*
9+
* @author lvfq
10+
* @Github: https://github.com/lvfaqiang
11+
* @Blog: http://blog.csdn.net/lv_fq
12+
* @date 2017/12/6 下午1:59
13+
* @desc :
14+
*/
15+
16+
public class DynamicProxy implements InvocationHandler {
17+
18+
private Object object;
19+
20+
public DynamicProxy(Object object) {
21+
this.object = object;
22+
}
23+
24+
@Override
25+
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
26+
String name = method.getDeclaringClass().getName();
27+
// System.out.println(name);
28+
return method.invoke(object, args);
29+
}
30+
}
Lines changed: 21 additions & 0 deletions

0 commit comments

Comments
 (0)