Skip to content

Commit 0bd06ae

Browse files
committed
Update sample and proguard rules.
1 parent c0c8c2d commit 0bd06ae

File tree

6 files changed

+20
-28
lines changed

6 files changed

+20
-28
lines changed

andlinker/proguard-rules.pro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#-renamesourcefileattribute SourceFile
2222

2323
-dontwarn com.codezjx.andlinker.adapter.**
24-
-keep class * implements android.os.Parcelable {
24+
-keep class * implements com.codezjx.andlinker.SuperParcelable {
2525
public void readFromParcel(android.os.Parcel);
2626
}
27-
-keep @com.codezjx.andlinker.annotation.RemoteInterface class * {*;}
27+
-keep @com.codezjx.andlinker.annotation.RemoteInterface class * {
28+
<methods>;
29+
}

andlinker/src/main/java/com/codezjx/andlinker/Response.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package com.codezjx.andlinker;
22

33
import android.os.Parcel;
4-
import android.os.Parcelable;
54

65
/**
76
* Created by codezjx on 2017/9/13.<br/>
87
*/
9-
final class Response implements Parcelable {
8+
final class Response implements SuperParcelable {
109

1110
static final int STATUS_CODE_SUCCESS = 200;
1211
static final int STATUS_CODE_ILLEGAL_ACCESS = 400;
@@ -35,12 +34,17 @@ public void writeToParcel(Parcel dest, int flags) {
3534
dest.writeValue(mResult);
3635
}
3736

38-
private Response(Parcel in) {
37+
@Override
38+
public void readFromParcel(Parcel in) {
3939
mStatusCode = in.readInt();
4040
mStatusMessage = in.readString();
4141
mResult = in.readValue(getClass().getClassLoader());
4242
}
4343

44+
private Response(Parcel in) {
45+
readFromParcel(in);
46+
}
47+
4448
public static final Creator<Response> CREATOR = new Creator<Response>() {
4549
@Override
4650
public Response createFromParcel(Parcel source) {

sample/src/main/java/com/example/andlinker/BindingActivity.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import com.codezjx.andlinker.Callback;
1212
import com.codezjx.andlinker.adapter.OriginalCallAdapterFactory;
1313
import com.codezjx.andlinker.adapter.rxjava2.RxJava2CallAdapterFactory;
14-
import com.codezjx.andlinker.annotation.ClassName;
15-
import com.codezjx.andlinker.annotation.MethodName;
14+
import com.codezjx.andlinker.annotation.RemoteInterface;
1615

1716
import java.util.List;
1817

@@ -125,15 +124,13 @@ public void onValueChange(int value) {
125124

126125

127126
/**
128-
* Copy the original interface, wrap the return type of the method, keep the original @ClassName and @MethodName.
127+
* Copy the original interface, wrap the return type of the method, keep the original interface name and method name.
129128
*/
130-
@ClassName("com.example.andlinker.IRemoteTask")
129+
@RemoteInterface
131130
public interface IRemoteTask {
132131

133-
@MethodName("remoteCalculate")
134132
Call<Integer> remoteCalculate(int a, int b);
135133

136-
@MethodName("getDatas")
137134
Observable<List<ParcelableObj>> getDatas();
138135

139136
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.example.andlinker;
22

3-
import com.codezjx.andlinker.annotation.ClassName;
4-
import com.codezjx.andlinker.annotation.MethodName;
3+
import com.codezjx.andlinker.annotation.RemoteInterface;
54

65
/**
76
* Created by codezjx on 2018/3/13.<br/>
87
*/
9-
@ClassName("com.example.andlinker.IRemoteCallback")
8+
@RemoteInterface
109
public interface IRemoteCallback {
1110

12-
@MethodName("onValueChange")
1311
void onValueChange(int value);
1412
}

sample/src/main/java/com/example/andlinker/IRemoteService.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,27 @@
33
import android.graphics.Rect;
44

55
import com.codezjx.andlinker.annotation.Callback;
6-
import com.codezjx.andlinker.annotation.ClassName;
76
import com.codezjx.andlinker.annotation.In;
87
import com.codezjx.andlinker.annotation.Inout;
9-
import com.codezjx.andlinker.annotation.MethodName;
108
import com.codezjx.andlinker.annotation.OneWay;
119
import com.codezjx.andlinker.annotation.Out;
10+
import com.codezjx.andlinker.annotation.RemoteInterface;
1211

1312
/**
1413
* Created by codezjx on 2018/3/12.<br/>
1514
*/
16-
@ClassName("com.example.andlinker.IRemoteService")
15+
@RemoteInterface
1716
public interface IRemoteService {
1817

19-
@MethodName("getPid")
2018
int getPid();
2119

22-
@MethodName("basicTypes")
2320
void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
2421
double aDouble, String aString);
2522

26-
@MethodName("registerCallback")
2723
void registerCallback(@Callback IRemoteCallback callback);
2824

29-
@MethodName("directionalParamMethod")
3025
void directionalParamMethod(@In int[] arr, @Out ParcelableObj obj, @Inout Rect rect);
3126

32-
@MethodName("onewayMethod")
3327
@OneWay
3428
void onewayMethod(String msg);
3529
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
package com.example.andlinker;
22

3-
import com.codezjx.andlinker.annotation.ClassName;
4-
import com.codezjx.andlinker.annotation.MethodName;
3+
import com.codezjx.andlinker.annotation.RemoteInterface;
54

65
import java.util.List;
76

87
/**
98
* Created by codezjx on 2018/3/14.<br/>
109
*/
11-
@ClassName("com.example.andlinker.IRemoteTask")
10+
@RemoteInterface
1211
public interface IRemoteTask {
1312

14-
@MethodName("remoteCalculate")
1513
int remoteCalculate(int a, int b);
1614

17-
@MethodName("getDatas")
1815
List<ParcelableObj> getDatas();
1916

2017
}

0 commit comments

Comments
 (0)