Set `tickerText` to improve accessibility of notifications.
Signed-off-by: Nolan Darilek <nolan@thewordnerd.info>
This commit is contained in:
parent
eb50256af7
commit
2e4d30ef29
|
@ -8,7 +8,7 @@
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx8192m
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
|
|
@ -343,12 +343,19 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
||||||
globalLastMessageTimestamp = lastMessageTimestamp
|
globalLastMessageTimestamp = lastMessageTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val tickerText = if (roomEventGroupInfo.isDirect) {
|
||||||
|
String.format("%s: %s", events[0].senderName, events[0].description)
|
||||||
|
} else {
|
||||||
|
String.format("%s: %s %s", roomName, events[0].senderName, events[0].description)
|
||||||
|
}
|
||||||
|
|
||||||
val notification = notificationUtils.buildMessagesListNotification(
|
val notification = notificationUtils.buildMessagesListNotification(
|
||||||
style,
|
style,
|
||||||
roomEventGroupInfo,
|
roomEventGroupInfo,
|
||||||
largeBitmap,
|
largeBitmap,
|
||||||
lastMessageTimestamp,
|
lastMessageTimestamp,
|
||||||
myUserDisplayName)
|
myUserDisplayName,
|
||||||
|
tickerText)
|
||||||
|
|
||||||
// is there an id for this room?
|
// is there an id for this room?
|
||||||
notificationUtils.showNotificationMessage(roomId, ROOM_MESSAGES_NOTIFICATION_ID, notification)
|
notificationUtils.showNotificationMessage(roomId, ROOM_MESSAGES_NOTIFICATION_ID, notification)
|
||||||
|
|
|
@ -381,7 +381,8 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
roomInfo: RoomEventGroupInfo,
|
roomInfo: RoomEventGroupInfo,
|
||||||
largeIcon: Bitmap?,
|
largeIcon: Bitmap?,
|
||||||
lastMessageTimestamp: Long,
|
lastMessageTimestamp: Long,
|
||||||
senderDisplayNameForReplyCompat: String?): Notification {
|
senderDisplayNameForReplyCompat: String?,
|
||||||
|
tickerText: String): Notification {
|
||||||
val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color)
|
val accentColor = ContextCompat.getColor(context, R.color.notification_accent_color)
|
||||||
// Build the pending intent for when the notification is clicked
|
// Build the pending intent for when the notification is clicked
|
||||||
val openRoomIntent = buildOpenRoomIntent(roomInfo.roomId)
|
val openRoomIntent = buildOpenRoomIntent(roomInfo.roomId)
|
||||||
|
@ -478,6 +479,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
System.currentTimeMillis().toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
System.currentTimeMillis().toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
setDeleteIntent(pendingIntent)
|
setDeleteIntent(pendingIntent)
|
||||||
}
|
}
|
||||||
|
.setTicker(tickerText)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue