Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd2e9b7d authored by Philipp Heckel's avatar Philipp Heckel
Browse files

Dark mode color

parent 005d03a7
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -65,12 +65,10 @@ class NotificationService(val context: Context) {
        val channelId = toChannelId(notification.priority)
        val builder = NotificationCompat.Builder(context, channelId)
            .setSmallIcon(R.drawable.ic_notification)
            .setColor(ContextCompat.getColor(context, Colors.notificationIcon(context)))
            .setContentTitle(title)
            .setOnlyAlertOnce(true) // Do not vibrate or play sound if already showing (updates!)
            .setAutoCancel(true) // Cancel when notification is clicked
        if (!isDarkThemeOn(context)) {
            builder.setColor(ContextCompat.getColor(context, Colors.notificationIcon))
        }
        setStyleAndText(builder, subscription, notification) // Preview picture or big text style
        setClickAction(builder, subscription, notification)
        maybeSetSound(builder, update)
+3 −5
Original line number Diff line number Diff line
@@ -290,18 +290,16 @@ class SubscriberService : Service() {
        val pendingIntent: PendingIntent = Intent(this, MainActivity::class.java).let { notificationIntent ->
            PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE)
        }
        val builder = NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
        return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
            .setSmallIcon(R.drawable.ic_notification_instant)
            .setColor(ContextCompat.getColor(this, Colors.notificationIcon(this)))
            .setContentTitle(title)
            .setContentText(text)
            .setContentIntent(pendingIntent)
            .setSound(null)
            .setShowWhen(false) // Don't show date/time
            .setGroup(NOTIFICATION_GROUP_ID) // Do not group with other notifications
        if (!isDarkThemeOn(this)) {
            builder.setColor(ContextCompat.getColor(this, Colors.notificationIcon))
        }
        return builder.build()
            .build()
    }

    override fun onBind(intent: Intent): IBinder? {
+4 −1
Original line number Diff line number Diff line
@@ -8,7 +8,10 @@ import io.heckel.ntfy.util.isDarkThemeOn
class Colors {
    companion object {
        const val refreshProgressIndicator = R.color.teal
        const val notificationIcon = R.color.teal

        fun notificationIcon(context: Context): Int {
            return if (isDarkThemeOn(context)) R.color.teal_light else R.color.teal
        }

        fun itemSelectedBackground(context: Context): Int {
            return if (isDarkThemeOn(context)) R.color.black_800b else R.color.gray_400