Skip to content

Commit

Permalink
Notification tray icon customized.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Aug 5, 2024
1 parent cf222d4 commit c19d0f2
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,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())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,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()) {
Expand Down Expand Up @@ -219,9 +220,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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).apply {
action = ACTION_STOP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.os.HandlerThread;
import android.os.Process;

import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.utils.theme.ViewThemeUtils;

Expand Down Expand Up @@ -55,7 +56,8 @@ private NotificationUtils() {
*/
public static NotificationCompat.Builder newNotificationBuilder(Context context, String channelId, final ViewThemeUtils viewThemeUtils) {
final NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId);
viewThemeUtils.androidx.themeNotificationCompatBuilder(context, builder);
// NMC Customization
builder.setColor(context.getResources().getColor(R.color.primary, null));
return builder;
}

Expand Down

0 comments on commit c19d0f2

Please sign in to comment.