55import android .app .PendingIntent ;
66import android .app .AlarmManager ;
77import android .app .NotificationManager ;
8- import android .support .v4 .app .NotificationCompat ;
98import android .content .Context ;
109import android .content .Intent ;
1110import android .content .SharedPreferences ;
2120import io .neson .react .notification .NotificationEventReceiver ;
2221import io .neson .react .notification .NotificationPublisher ;
2322
23+ import android .support .v7 .app .NotificationCompat ;
24+ import android .text .Html ;
2425import android .util .Log ;
2526import android .graphics .Color ;
2627
@@ -112,7 +113,7 @@ public Notification delete() {
112113 * Build the notification.
113114 */
114115 public android .app .Notification build () {
115- NotificationCompat .Builder notificationBuilder = new NotificationCompat .Builder (context );
116+ android . support . v7 . app . NotificationCompat .Builder notificationBuilder = new android . support . v7 . app . NotificationCompat .Builder (context );
116117
117118 notificationBuilder
118119 .setContentTitle (attributes .subject )
@@ -125,21 +126,39 @@ public android.app.Notification build() {
125126 notificationBuilder .setPriority (attributes .priority );
126127 }
127128
128- int defaults = 0 ;
129+ if ( attributes . inboxStyle ){
129130
130- if ("default" .equals (attributes .sound )) {
131- defaults = defaults | NotificationCompat .DEFAULT_SOUND ;
132- }
131+ android .support .v7 .app .NotificationCompat .InboxStyle inboxStyle = new android .support .v7 .app .NotificationCompat .InboxStyle ();
133132
134- if ("default" .equals (attributes .vibrate )) {
135- defaults = defaults | NotificationCompat .DEFAULT_VIBRATE ;
136- }
133+ if (attributes .inboxStyleBigContentTitle != null ){
134+ inboxStyle .setBigContentTitle (attributes .inboxStyleBigContentTitle );
135+ }
136+ if (attributes .inboxStyleSummaryText != null ){
137+ inboxStyle .setSummaryText (attributes .inboxStyleSummaryText );
138+ }
139+ if (attributes .inboxStyleLines != null ){
140+ for (int i =0 ; i < attributes .inboxStyleLines .size (); i ++){
141+ inboxStyle .addLine (Html .fromHtml (attributes .inboxStyleLines .get (i )));
142+ }
143+ }
137144
138- if ("default" .equals (attributes .lights )) {
139- defaults = defaults | NotificationCompat .DEFAULT_LIGHTS ;
140- }
145+ Log .i ("ReactSystemNotification" , "set inbox style!!" );
141146
142- notificationBuilder .setDefaults (defaults );
147+ }else {
148+
149+ int defaults = 0 ;
150+ if ("default" .equals (attributes .sound )) {
151+ defaults = defaults | android .app .Notification .DEFAULT_SOUND ;
152+ }
153+ if ("default" .equals (attributes .vibrate )) {
154+ defaults = defaults | android .app .Notification .DEFAULT_VIBRATE ;
155+ }
156+ if ("default" .equals (attributes .lights )) {
157+ defaults = defaults | android .app .Notification .DEFAULT_LIGHTS ;
158+ }
159+ notificationBuilder .setDefaults (defaults );
160+
161+ }
143162
144163 if (attributes .onlyAlertOnce != null ) {
145164 notificationBuilder .setOnlyAlertOnce (attributes .onlyAlertOnce );
@@ -156,7 +175,7 @@ public android.app.Notification build() {
156175
157176 if (attributes .bigText != null ) {
158177 notificationBuilder
159- .setStyle (new NotificationCompat .BigTextStyle ()
178+ .setStyle (new android . support . v7 . app . NotificationCompat .BigTextStyle ()
160179 .bigText (attributes .bigText ));
161180 }
162181
0 commit comments