Merge pull request #4078 from abaker/android_auto

Add Android Auto notification support
This commit is contained in:
Benoit Marty 2021-09-30 11:29:58 +02:00 committed by GitHub
commit 5d51431c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

1
changelog.d/240.feature Normal file
View File

@ -0,0 +1 @@
Android Auto notification support

View File

@ -83,6 +83,10 @@
android:name="android.max_aspect"
android:value="9.9" />
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />
<activity
android:name=".features.MainActivity"
android:theme="@style/Theme.Vector.Launcher" />

View File

@ -597,10 +597,12 @@ class NotificationUtils @Inject constructor(private val context: Context,
val markRoomReadPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(), markRoomReadIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
addAction(NotificationCompat.Action(
R.drawable.ic_material_done_all_white,
stringProvider.getString(R.string.action_mark_room_read),
markRoomReadPendingIntent))
NotificationCompat.Action.Builder(R.drawable.ic_material_done_all_white,
stringProvider.getString(R.string.action_mark_room_read), markRoomReadPendingIntent)
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
.setShowsUserInterface(false)
.build()
.let { addAction(it) }
// Quick reply
if (!roomInfo.hasSmartReplyError) {
@ -611,6 +613,8 @@ class NotificationUtils @Inject constructor(private val context: Context,
NotificationCompat.Action.Builder(R.drawable.vector_notification_quick_reply,
stringProvider.getString(R.string.action_quick_reply), replyPendingIntent)
.addRemoteInput(remoteInput)
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
.setShowsUserInterface(false)
.build()
.let { addAction(it) }
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<automotiveApp>
<uses name="notification" />
</automotiveApp>