Dark mode color
This commit is contained in:
parent
005d03a7c2
commit
cd2e9b7d6a
3 changed files with 8 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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? {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue