diff --git a/app/build.gradle b/app/build.gradle index 8f300f995..872f0d11e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -223,12 +223,15 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.media:media:1.2.0' - // Don't update to fragment-ktx:1.3.2 for now, will break some animations + // Don't update to fragment-ktx:1.3.2 (nor 1.3.3) for now, will break some animations // https://developer.android.com/jetpack/androidx/releases/fragment#version_132_2 implementation 'androidx.fragment:fragment-ktx:1.3.1' implementation 'androidx.core:core-ktx:1.5.0-beta03' - implementation 'androidx.navigation:navigation-fragment-ktx:2.3.4' - implementation 'androidx.navigation:navigation-ui-ktx:2.3.4' + + def nav_version = "2.3.5" + implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" + implementation "androidx.navigation:navigation-ui-ktx:$nav_version" + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt index b0269231e..8f67e08ea 100644 --- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt +++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt @@ -355,6 +355,22 @@ class NotificationsManager(private val context: Context) { return notifiable } + private fun getPerson(contact: Contact?, displayName: String, picture: Bitmap?): Person { + return if (contact != null) { + contact.getPerson() + } else { + val builder = Person.Builder().setName(displayName) + val userIcon = + if (picture != null) { + IconCompat.createWithAdaptiveBitmap(picture) + } else { + IconCompat.createWithResource(context, R.drawable.avatar) + } + if (userIcon != null) builder.setIcon(userIcon) + builder.build() + } + } + private fun displayIncomingCallNotification(call: Call, useAsForeground: Boolean = false) { val address = LinphoneUtils.getDisplayableAddress(call.remoteAddress) val notifiable = getNotifiableForCall(call) @@ -384,6 +400,7 @@ class NotificationsManager(private val context: Context) { val builder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_incoming_call_id)) .setStyle(NotificationCompat.DecoratedCustomViewStyle()) + .addPerson(getPerson(contact, displayName, roundPicture)) .setSmallIcon(R.drawable.topbar_call_notification) .setContentTitle(displayName) .setContentText(context.getString(R.string.incoming_call_notification_title)) @@ -508,6 +525,7 @@ class NotificationsManager(private val context: Context) { .setContentText(context.getString(stringResourceId)) .setSmallIcon(iconResourceId) .setLargeIcon(roundPicture) + .addPerson(getPerson(contact, displayName, roundPicture)) .setAutoCancel(false) .setCategory(NotificationCompat.CATEGORY_CALL) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) @@ -668,19 +686,7 @@ class NotificationsManager(private val context: Context) { var lastPerson: Person? = null for (message in notifiable.messages) { val contact = message.contact - val person = if (contact != null) { - contact.getPerson() - } else { - val builder = Person.Builder().setName(message.sender) - val userIcon = - if (message.senderAvatar != null) { - IconCompat.createWithAdaptiveBitmap(message.senderAvatar) - } else { - IconCompat.createWithResource(context, R.drawable.avatar) - } - if (userIcon != null) builder.setIcon(userIcon) - builder.build() - } + val person = getPerson(contact, message.sender, message.senderAvatar) // We don't want to see our own avatar if (!message.isOutgoing) {