mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Add Android Auto notification support
Signed-off-by: Alex Baker <alex@beeper.com>
This commit is contained in:
parent
cde6e8cc1b
commit
09a25cce4e
4 changed files with 17 additions and 4 deletions
1
changelog.d/240.feature
Normal file
1
changelog.d/240.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Android Auto notification support
|
|
@ -83,6 +83,10 @@
|
||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="9.9" />
|
android:value="9.9" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.gms.car.application"
|
||||||
|
android:resource="@xml/automotive_app_desc" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".features.MainActivity"
|
android:name=".features.MainActivity"
|
||||||
android:theme="@style/Theme.Vector.Launcher" />
|
android:theme="@style/Theme.Vector.Launcher" />
|
||||||
|
|
|
@ -597,10 +597,12 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
val markRoomReadPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(), markRoomReadIntent,
|
val markRoomReadPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(), markRoomReadIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT)
|
PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
|
||||||
addAction(NotificationCompat.Action(
|
NotificationCompat.Action.Builder(R.drawable.ic_material_done_all_white,
|
||||||
R.drawable.ic_material_done_all_white,
|
stringProvider.getString(R.string.action_mark_room_read), markRoomReadPendingIntent)
|
||||||
stringProvider.getString(R.string.action_mark_room_read),
|
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
|
||||||
markRoomReadPendingIntent))
|
.setShowsUserInterface(false)
|
||||||
|
.build()
|
||||||
|
.let { addAction(it) }
|
||||||
|
|
||||||
// Quick reply
|
// Quick reply
|
||||||
if (!roomInfo.hasSmartReplyError) {
|
if (!roomInfo.hasSmartReplyError) {
|
||||||
|
@ -611,6 +613,8 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
NotificationCompat.Action.Builder(R.drawable.vector_notification_quick_reply,
|
NotificationCompat.Action.Builder(R.drawable.vector_notification_quick_reply,
|
||||||
stringProvider.getString(R.string.action_quick_reply), replyPendingIntent)
|
stringProvider.getString(R.string.action_quick_reply), replyPendingIntent)
|
||||||
.addRemoteInput(remoteInput)
|
.addRemoteInput(remoteInput)
|
||||||
|
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
|
||||||
|
.setShowsUserInterface(false)
|
||||||
.build()
|
.build()
|
||||||
.let { addAction(it) }
|
.let { addAction(it) }
|
||||||
}
|
}
|
||||||
|
|
4
vector/src/main/res/xml/automotive_app_desc.xml
Normal file
4
vector/src/main/res/xml/automotive_app_desc.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<automotiveApp>
|
||||||
|
<uses name="notification" />
|
||||||
|
</automotiveApp>
|
Loading…
Reference in a new issue