From 5932ca95108f5b39ec5801bae780659ac5bd11f4 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Fri, 9 Jun 2023 23:24:12 +0530 Subject: [PATCH] Notification tray icon customized. --- .../client/documentscan/GeneratePdfFromImagesWork.kt | 3 ++- .../java/com/nextcloud/client/jobs/FilesExportWork.kt | 3 ++- .../nextcloud/client/jobs/MediaFoldersDetectionWork.kt | 3 ++- .../java/com/nextcloud/client/jobs/NotificationWork.kt | 8 ++++---- .../main/java/com/nextcloud/client/media/PlayerService.kt | 3 ++- .../client/notifications/AppNotificationManagerImpl.kt | 3 ++- .../com/owncloud/android/syncadapter/FileSyncAdapter.java | 3 ++- .../android/ui/notifications/NotificationUtils.java | 4 +++- 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt index 5fd4a640d079..3dfcf4bdfee7 100644 --- a/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt +++ b/app/src/main/java/com/nextcloud/client/documentscan/GeneratePdfFromImagesWork.kt @@ -113,7 +113,8 @@ class GeneratePdfFromImagesWork( .setContentText(message) .setAutoCancel(true) - viewThemeUtils.androidx.themeNotificationCompatBuilder(appContext, notificationBuilder) + //NMC Customization + notificationBuilder.color = appContext.resources.getColor(R.color.primary, null) notificationManager.notify(notificationId, notificationBuilder.build()) diff --git a/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt b/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt index d8a417513be0..7cfc1cfc4e21 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt @@ -155,7 +155,8 @@ class FilesExportWork( .setContentTitle(message) .setAutoCancel(true) - viewThemeUtils.androidx.themeNotificationCompatBuilder(appContext, notificationBuilder) + //NMC Customization + notificationBuilder.color = appContext.resources.getColor(R.color.primary, null) val actionIntent = Intent(DownloadManager.ACTION_VIEW_DOWNLOADS).apply { flags = FLAG_ACTIVITY_NEW_TASK diff --git a/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt b/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt index b647b5801062..c9133f18e644 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/MediaFoldersDetectionWork.kt @@ -226,7 +226,8 @@ class MediaFoldersDetectionWork constructor( .setAutoCancel(true) .setContentIntent(pendingIntent) - viewThemeUtils.androidx.themeNotificationCompatBuilder(context, notificationBuilder) + //NMC Customization + notificationBuilder.color = context.resources.getColor(R.color.primary, null) val disableDetection = Intent(context, NotificationReceiver::class.java) disableDetection.putExtra(NOTIFICATION_ID, notificationId) diff --git a/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt b/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt index 0e29f5e99cc4..273173ffbef8 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/NotificationWork.kt @@ -177,7 +177,8 @@ class NotificationWork constructor( .setVisibility(NotificationCompat.VISIBILITY_PRIVATE) .setContentIntent(pendingIntent) - viewThemeUtils.androidx.themeNotificationCompatBuilder(context, notificationBuilder) + //NMC Customization + notificationBuilder.color = context.resources.getColor(R.color.primary, null) // Remove if (notification.getActions().isEmpty()) { @@ -233,9 +234,8 @@ class NotificationWork constructor( .setAutoCancel(true) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentIntent(pendingIntent) - .also { - viewThemeUtils.androidx.themeNotificationCompatBuilder(context, it) - } + //NMC Customization + .setColor(context.resources.getColor(R.color.primary, null)) .build() ) val notificationManager = NotificationManagerCompat.from(context) diff --git a/app/src/main/java/com/nextcloud/client/media/PlayerService.kt b/app/src/main/java/com/nextcloud/client/media/PlayerService.kt index 5d8e7a336420..807c08626f17 100644 --- a/app/src/main/java/com/nextcloud/client/media/PlayerService.kt +++ b/app/src/main/java/com/nextcloud/client/media/PlayerService.kt @@ -101,7 +101,8 @@ class PlayerService : Service() { AndroidInjection.inject(this) player = Player(applicationContext, clientFactory, playerListener, audioManager) notificationBuilder = NotificationCompat.Builder(this) - viewThemeUtils.androidx.themeNotificationCompatBuilder(this, notificationBuilder) + //NMC Customization + notificationBuilder.color = resources.getColor(R.color.primary, null) val stop = Intent(this, PlayerService::class.java) stop.action = ACTION_STOP diff --git a/app/src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt b/app/src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt index 9f754f5fe76e..667241c58ea7 100644 --- a/app/src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt +++ b/app/src/main/java/com/nextcloud/client/notifications/AppNotificationManagerImpl.kt @@ -37,7 +37,8 @@ class AppNotificationManagerImpl @Inject constructor( } else { NotificationCompat.Builder(context) } - viewThemeUtils.androidx.themeNotificationCompatBuilder(context, builder) + //NMC Customization + builder.color = context.resources.getColor(R.color.primary, null) return builder } diff --git a/app/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java b/app/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java index 69917018f6e9..41a03156ef83 100644 --- a/app/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java +++ b/app/src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java @@ -524,7 +524,8 @@ private void notifyForgottenLocalFiles() { private NotificationCompat.Builder createNotificationBuilder() { NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext()); notificationBuilder.setSmallIcon(R.drawable.notification_icon).setAutoCancel(true); - viewThemeUtils.androidx.themeNotificationCompatBuilder(getContext(), notificationBuilder); + //NMC Customization + notificationBuilder.setColor(getContext().getResources().getColor(R.color.primary, null)); return notificationBuilder; } diff --git a/app/src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java b/app/src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java index 6c70dc45c91a..6bd282c7ae3c 100644 --- a/app/src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java +++ b/app/src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java @@ -25,6 +25,7 @@ import android.os.HandlerThread; import android.os.Process; +import com.owncloud.android.R; import com.owncloud.android.utils.theme.ViewThemeUtils; import java.security.SecureRandom; @@ -63,7 +64,8 @@ private NotificationUtils() { */ public static NotificationCompat.Builder newNotificationBuilder(Context context, final ViewThemeUtils viewThemeUtils) { final NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - viewThemeUtils.androidx.themeNotificationCompatBuilder(context, builder); + //NMC Customization + builder.setColor(context.getResources().getColor(R.color.primary, null)); return builder; }