style(notifications/action): fix whitespaces

This commit is contained in:
FineFindus
2023-02-27 21:20:02 +01:00
parent 36808e4e8e
commit 6756b36e87

View File

@@ -98,11 +98,11 @@ public class PushNotificationReceiver extends BroadcastReceiver{
Log.w(TAG, "onReceive: invalid push notification format"); Log.w(TAG, "onReceive: invalid push notification format");
} }
} }
if(intent.getBooleanExtra("fromNotificationAction", false)) { if(intent.getBooleanExtra("fromNotificationAction", false)){
String accountID=intent.getStringExtra("accountID"); String accountID=intent.getStringExtra("accountID");
int notificationId=intent.getIntExtra("notificationId", -1); int notificationId=intent.getIntExtra("notificationId", -1);
if ( notificationId >= 0) { if (notificationId >= 0){
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(accountID, notificationId); notificationManager.cancel(accountID, notificationId);
} }
@@ -122,7 +122,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
default -> Log.w(TAG, "onReceive: Failed to get NotificationAction"); default -> Log.w(TAG, "onReceive: Failed to get NotificationAction");
} }
} }
} else { }else{
Log.e(TAG, "onReceive: Failed to load notification"); Log.e(TAG, "onReceive: Failed to load notification");
} }
} }
@@ -202,8 +202,8 @@ public class PushNotificationReceiver extends BroadcastReceiver{
int id = GlobalUserPreferences.keepOnlyLatestNotification ? NOTIFICATION_ID : notificationId++; int id = GlobalUserPreferences.keepOnlyLatestNotification ? NOTIFICATION_ID : notificationId++;
if (notification != null) { if (notification != null){
switch (pn.notificationType) { switch (pn.notificationType){
case MENTION, STATUS -> { case MENTION, STATUS -> {
builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.sk_notification_action_favorite), NotificationAction.FAVORITE)); builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.sk_notification_action_favorite), NotificationAction.FAVORITE));
builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.sk_notification_action_bookmark), NotificationAction.BOOKMARK)); builder.addAction(buildNotificationAction(context, id, accountID, notification, context.getString(R.string.sk_notification_action_bookmark), NotificationAction.BOOKMARK));
@@ -227,8 +227,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
notificationIntent.putExtra("accountID", accountID); notificationIntent.putExtra("accountID", accountID);
notificationIntent.putExtra("notificationAction", action.ordinal()); notificationIntent.putExtra("notificationAction", action.ordinal());
notificationIntent.putExtra("notification", Parcels.wrap(notification)); notificationIntent.putExtra("notification", Parcels.wrap(notification));
PendingIntent actionPendingIntent = PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, new Random().nextInt(), notificationIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT);
PendingIntent.getBroadcast(context, new Random().nextInt(), notificationIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_ONE_SHOT);
return new Notification.Action.Builder(null, title, actionPendingIntent).build(); return new Notification.Action.Builder(null, title, actionPendingIntent).build();
} }