Merge pull request #4078 from abaker/android_auto
Add Android Auto notification support
This commit is contained in:
		
						commit
						5d51431c60
					
				
							
								
								
									
										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: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" />
 | 
			
		||||
 | 
			
		||||
@ -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) }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user