8
8
9
9
public class AndroidNotification extends PlatformNotification {
10
10
public static final String NOTIFICATION_ANDROID = "android" ;
11
-
11
+
12
12
private static final String TITLE = "title" ;
13
13
private static final String BUILDER_ID = "builder_id" ;
14
14
private static final String INBOX = "inbox" ;
@@ -20,7 +20,7 @@ public class AndroidNotification extends PlatformNotification {
20
20
private static final String CATEGORY = "category" ;
21
21
private static final String LARGE_ICON = "large_icon" ;
22
22
private static final String INTENT = "intent" ;
23
-
23
+
24
24
private final String title ;
25
25
private final int builderId ;
26
26
// 0 ~ 4
@@ -34,15 +34,15 @@ public class AndroidNotification extends PlatformNotification {
34
34
private String category ;
35
35
private String large_icon ;
36
36
private JsonObject intent ;
37
-
37
+
38
38
private AndroidNotification (Object alert , String title , int builderId , int style , int alertType , String bigText ,
39
- Object inbox , String bigPicPath , int priority , String category ,String large_icon ,JsonObject intent ,
40
- Map <String , String > extras ,
41
- Map <String , Number > numberExtras ,
42
- Map <String , Boolean > booleanExtras ,
39
+ Object inbox , String bigPicPath , int priority , String category ,String large_icon ,JsonObject intent ,
40
+ Map <String , String > extras ,
41
+ Map <String , Number > numberExtras ,
42
+ Map <String , Boolean > booleanExtras ,
43
43
Map <String , JsonObject > jsonExtras ) {
44
44
super (alert , extras , numberExtras , booleanExtras , jsonExtras );
45
-
45
+
46
46
this .title = title ;
47
47
this .builderId = builderId ;
48
48
this .style = style ;
@@ -55,16 +55,16 @@ private AndroidNotification(Object alert, String title, int builderId, int style
55
55
this .large_icon = large_icon ;
56
56
this .intent = intent ;
57
57
}
58
-
58
+
59
59
public static Builder newBuilder () {
60
60
return new Builder ();
61
61
}
62
-
62
+
63
63
public static AndroidNotification alert (String alert ) {
64
64
return newBuilder ().setAlert (alert ).build ();
65
65
}
66
-
67
-
66
+
67
+
68
68
@ Override
69
69
public String getPlatform () {
70
70
return NOTIFICATION_ANDROID ;
@@ -77,11 +77,11 @@ protected Object getInbox() {
77
77
protected void setInbox (Object inbox ) {
78
78
this .inbox = inbox ;
79
79
}
80
-
80
+
81
81
@ Override
82
82
public JsonElement toJSON () {
83
83
JsonObject json = super .toJSON ().getAsJsonObject ();
84
-
84
+
85
85
if (builderId > 0 ) {
86
86
json .add (BUILDER_ID , new JsonPrimitive (this .builderId ));
87
87
}
@@ -120,19 +120,19 @@ public JsonElement toJSON() {
120
120
if (null != category ) {
121
121
json .add (CATEGORY , new JsonPrimitive (category ));
122
122
}
123
-
123
+
124
124
if (null != large_icon ) {
125
125
json .add (LARGE_ICON , new JsonPrimitive (large_icon ));
126
126
}
127
127
128
128
if (null != intent ) {
129
129
json .add (INTENT , intent );
130
130
}
131
-
131
+
132
132
return json ;
133
133
}
134
-
135
-
134
+
135
+
136
136
public static class Builder extends PlatformNotification .Builder <AndroidNotification , Builder > {
137
137
private String title ;
138
138
private int builderId ;
@@ -145,21 +145,21 @@ public static class Builder extends PlatformNotification.Builder<AndroidNotifica
145
145
private String category ;
146
146
private String large_icon ;
147
147
private JsonObject intent ;
148
-
148
+
149
149
protected Builder getThis () {
150
150
return this ;
151
151
}
152
-
152
+
153
153
public Builder setTitle (String title ) {
154
154
this .title = title ;
155
155
return this ;
156
156
}
157
-
157
+
158
158
public Builder setBuilderId (int builderId ) {
159
159
this .builderId = builderId ;
160
160
return this ;
161
161
}
162
-
162
+
163
163
public Builder setAlert (Object alert ) {
164
164
this .alert = alert ;
165
165
return this ;
@@ -203,22 +203,22 @@ public Builder setInbox(Object inbox) {
203
203
this .inbox = inbox ;
204
204
return this ;
205
205
}
206
-
206
+
207
207
public Builder setLargeIcon (String largeIcon ) {
208
208
this .large_icon = largeIcon ;
209
209
return this ;
210
210
}
211
-
211
+
212
212
public Builder setIntent (JsonObject intent ) {
213
- if (null == inbox ) {
213
+ if (null == intent ) {
214
214
LOG .warn ("Null intent. Throw away it." );
215
215
return this ;
216
216
}
217
217
this .intent = intent ;
218
218
return this ;
219
219
}
220
-
221
-
220
+
221
+
222
222
public AndroidNotification build () {
223
223
return new AndroidNotification (alert , title , builderId , style , alert_type , big_text , inbox , big_pic_path , priority ,
224
224
category , large_icon , intent ,extrasBuilder , numberExtrasBuilder , booleanExtrasBuilder , jsonExtrasBuilder );
0 commit comments