diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 027cbc6f0cd..1de00150801 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -120,7 +120,9 @@ + android:windowSoftInputMode="adjustResize" + android:allowEmbedded="true" + android:resizeableActivity="true"> @@ -222,7 +224,9 @@ + android:theme="@style/AppTheme" + android:allowEmbedded="true" + android:resizeableActivity="true"/> = Build.VERSION_CODES.R) { + setBubble(notificationBuilder) + } } if (TYPE_RECORDING == pushMessage.type && ncNotification != null) { @@ -572,7 +579,9 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor } person.setIcon(loadAvatarSync(avatarUrl, context!!)) } - notificationBuilder.setStyle(getStyle(person.build(), style)) + val personBuilt = person.build() + notificationBuilder.setStyle(getStyle(personBuilt, style)) + notificationBuilder.addPerson(personBuilt) } private fun buildIntentForAction(cls: Class<*>, systemNotificationId: Int, messageId: Int): PendingIntent { @@ -619,6 +628,34 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor } } + @RequiresApi(Build.VERSION_CODES.R) + private fun setBubble(notificationBuilder: NotificationCompat.Builder) { + val intent = getIntentToOpenConversation() + + val shortcutId = "1_2_3" + val shortcut = + ShortcutInfoCompat.Builder(context!!, shortcutId) + .setCategories(setOf(Notification.CATEGORY_CALL)) // this function is only called for messages + .setIntent(Intent(Intent.ACTION_DEFAULT)) + .setLongLived(true) + .setShortLabel("testing Bubble") + .build() + + val bubbleData = intent?.let { + BubbleMetadata.Builder(it, IconCompat.createWithResource(context!!, R.drawable.ic_logo)) + .setDesiredHeight(600) + .setIntent(intent) + .setAutoExpandBubble(true) + .setSuppressNotification(true) + .build() // eventually change the icon to the avatar of the conversation + // also this will eventually need to be set up to only show for important conversations + } + notificationBuilder + .setBubbleMetadata(bubbleData) + .setShortcutId(shortcutId) + .setShortcutInfo(shortcut) + } + private fun addReplyAction(notificationBuilder: NotificationCompat.Builder, systemNotificationId: Int) { val replyLabel = context!!.resources.getString(R.string.nc_reply) val remoteInput = RemoteInput.Builder(NotificationUtils.KEY_DIRECT_REPLY)