@@ -347,7 +347,7 @@ protected void performNotificationScheduling(int id, Notification.Builder notifi
347
347
}
348
348
349
349
if (fireNow ) {
350
- Notification notification = buildNotificationForSending (mContext , mOpenActivity , notificationBuilder );
350
+ Notification notification = buildNotificationForSending (mOpenActivity , notificationBuilder );
351
351
notify (id , notification );
352
352
}
353
353
}
@@ -385,29 +385,29 @@ static void scheduleAlarmWithNotification(Notification.Builder notificationBuild
385
385
scheduleAlarmWithNotification (context , openActivity , notificationBuilder , intent , fireTime );
386
386
}
387
387
388
- protected static Notification buildNotificationForSending (Context context , Class openActivity , Notification .Builder builder ) {
388
+ private Notification buildNotificationForSending (Class openActivity , Notification .Builder builder ) {
389
389
int id = builder .getExtras ().getInt (KEY_ID , -1 );
390
- Intent openAppIntent = buildOpenAppIntent (context , openActivity );
390
+ Intent openAppIntent = buildOpenAppIntent (openActivity );
391
391
openAppIntent .putExtra (KEY_NOTIFICATION_ID , id );
392
- PendingIntent pendingIntent = getActivityPendingIntent (context , id , openAppIntent , 0 );
392
+ PendingIntent pendingIntent = getActivityPendingIntent (mContext , id , openAppIntent , 0 );
393
393
builder .setContentIntent (pendingIntent );
394
394
395
395
if (Build .VERSION .SDK_INT < Build .VERSION_CODES .M ) {
396
396
// Can't check StatusBar notifications pre-M, so ask to be notified when dismissed
397
- Intent deleteIntent = new Intent (context , UnityNotificationManager .class );
397
+ Intent deleteIntent = new Intent (mContext , UnityNotificationManager .class );
398
398
deleteIntent .setAction (KEY_NOTIFICATION_DISMISSED ); // need action to distinguish intent from content one
399
399
deleteIntent .putExtra (KEY_NOTIFICATION_DISMISSED , id );
400
- PendingIntent deletePending = getBroadcastPendingIntent (context , id , deleteIntent , 0 );
400
+ PendingIntent deletePending = getBroadcastPendingIntent (mContext , id , deleteIntent , 0 );
401
401
builder .setDeleteIntent (deletePending );
402
402
}
403
403
404
- finalizeNotificationForDisplay (context , builder );
404
+ finalizeNotificationForDisplay (builder );
405
405
return builder .build ();
406
406
}
407
407
408
408
// Build an Intent to open the given activity with the data from input Intent.
409
- protected static Intent buildOpenAppIntent (Context context , Class className ) {
410
- Intent openAppIntent = new Intent (context , className );
409
+ private Intent buildOpenAppIntent (Class className ) {
410
+ Intent openAppIntent = new Intent (mContext , className );
411
411
openAppIntent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK | Intent .FLAG_ACTIVITY_SINGLE_TOP );
412
412
413
413
return openAppIntent ;
@@ -682,7 +682,7 @@ public void onReceive(Intent intent) {
682
682
}
683
683
684
684
id = builder .getExtras ().getInt (KEY_ID , -1 );
685
- notif = buildNotificationForSending (mContext , openActivity , builder );
685
+ notif = buildNotificationForSending (openActivity , builder );
686
686
}
687
687
688
688
if (notif != null ) {
@@ -731,17 +731,17 @@ public static int getNotificationGroupAlertBehavior(Notification notification) {
731
731
return 0 ;
732
732
}
733
733
734
- public static void finalizeNotificationForDisplay (Context context , Notification .Builder notificationBuilder ) {
734
+ private void finalizeNotificationForDisplay (Notification .Builder notificationBuilder ) {
735
735
String icon = notificationBuilder .getExtras ().getString (KEY_SMALL_ICON );
736
- int iconId = UnityNotificationUtilities .findResourceIdInContextByName (context , icon );
736
+ int iconId = UnityNotificationUtilities .findResourceIdInContextByName (mContext , icon );
737
737
if (iconId == 0 ) {
738
- iconId = context .getApplicationInfo ().icon ;
738
+ iconId = mContext .getApplicationInfo ().icon ;
739
739
}
740
740
notificationBuilder .setSmallIcon (iconId );
741
741
icon = notificationBuilder .getExtras ().getString (KEY_LARGE_ICON );
742
- iconId = UnityNotificationUtilities .findResourceIdInContextByName (context , icon );
742
+ iconId = UnityNotificationUtilities .findResourceIdInContextByName (mContext , icon );
743
743
if (iconId != 0 ) {
744
- notificationBuilder .setLargeIcon (BitmapFactory .decodeResource (context .getResources (), iconId ));
744
+ notificationBuilder .setLargeIcon (BitmapFactory .decodeResource (mContext .getResources (), iconId ));
745
745
}
746
746
}
747
747
0 commit comments