New way of using single/multiple contact(s) avatar don't work well with notifications & shortcuts, fixing it
This commit is contained in:
parent
291ae367a6
commit
a81f7bb711
12 changed files with 26 additions and 35 deletions
|
@ -54,7 +54,7 @@ class XiaomiCompatibility {
|
|||
val builder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_incoming_call_id))
|
||||
.addPerson(notificationsManager.getPerson(contact, displayName, roundPicture))
|
||||
.setSmallIcon(R.drawable.topbar_call_notification)
|
||||
.setLargeIcon(roundPicture ?: BitmapFactory.decodeResource(context.resources, R.drawable.voip_single_contact_avatar))
|
||||
.setLargeIcon(roundPicture ?: BitmapFactory.decodeResource(context.resources, R.drawable.voip_single_contact_avatar_alt))
|
||||
.setContentTitle(displayName)
|
||||
.setContentText(address)
|
||||
.setSubText(context.getString(R.string.incoming_call_notification_title))
|
||||
|
|
|
@ -181,7 +181,7 @@ open class Contact() : Comparable<Contact> {
|
|||
val icon =
|
||||
if (bm == null) IconCompat.createWithResource(
|
||||
coreContext.context,
|
||||
R.drawable.voip_single_contact_avatar
|
||||
R.drawable.voip_single_contact_avatar_alt
|
||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||
if (icon != null) {
|
||||
personBuilder.setIcon(icon)
|
||||
|
|
|
@ -72,7 +72,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
|
|||
val icon =
|
||||
if (bm == null) IconCompat.createWithResource(
|
||||
coreContext.context,
|
||||
R.drawable.voip_single_contact_avatar
|
||||
R.drawable.voip_single_contact_avatar_alt
|
||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||
if (icon != null) {
|
||||
personBuilder.setIcon(icon)
|
||||
|
|
|
@ -430,7 +430,7 @@ class NotificationsManager(private val context: Context) {
|
|||
if (picture != null) {
|
||||
IconCompat.createWithAdaptiveBitmap(picture)
|
||||
} else {
|
||||
IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar)
|
||||
IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar_alt)
|
||||
}
|
||||
if (userIcon != null) builder.setIcon(userIcon)
|
||||
builder.build()
|
||||
|
@ -791,7 +791,7 @@ class NotificationsManager(private val context: Context) {
|
|||
}
|
||||
style.isGroupConversation = notifiable.isGroup
|
||||
|
||||
val icon = lastPerson?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar)
|
||||
val icon = lastPerson?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar_alt)
|
||||
val bubble = NotificationCompat.BubbleMetadata.Builder(bubbleIntent, icon)
|
||||
.setDesiredHeightResId(R.dimen.chat_message_bubble_desired_height)
|
||||
.build()
|
||||
|
|
|
@ -310,23 +310,9 @@ fun setImageViewScaleType(imageView: ImageView, scaleType: ImageView.ScaleType)
|
|||
imageView.scaleType = scaleType
|
||||
}
|
||||
|
||||
@BindingAdapter("glideAvatarFallback")
|
||||
fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) {
|
||||
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
||||
GlideApp.with(imageView)
|
||||
.load(path)
|
||||
.signature(ObjectKey(coreContext.contactsManager.latestContactFetch))
|
||||
.apply(RequestOptions.circleCropTransform())
|
||||
.into(imageView)
|
||||
} else {
|
||||
Log.w("[Data Binding] [Glide] Can't load $path")
|
||||
imageView.setImageResource(R.drawable.voip_single_contact_avatar)
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter("glidePath")
|
||||
fun loadImageWithGlide(imageView: ImageView, path: String) {
|
||||
if (path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
||||
fun loadImageWithGlide(imageView: ImageView, path: String?) {
|
||||
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
|
||||
if (corePreferences.vfsEnabled && path.endsWith(FileUtils.VFS_PLAIN_FILE_EXTENSION)) {
|
||||
GlideApp.with(imageView)
|
||||
.load(path)
|
||||
|
|
|
@ -169,7 +169,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
personsList.add(contact.getPerson())
|
||||
}
|
||||
subject = contact?.fullName ?: LinphoneUtils.getDisplayName(chatRoom.peerAddress)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar_alt)
|
||||
} else if (chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && chatRoom.participants.isNotEmpty()) {
|
||||
val address = chatRoom.participants.first().address
|
||||
val contact =
|
||||
|
@ -178,7 +178,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
personsList.add(contact.getPerson())
|
||||
}
|
||||
subject = contact?.fullName ?: LinphoneUtils.getDisplayName(address)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.voip_single_contact_avatar_alt)
|
||||
} else {
|
||||
for (participant in chatRoom.participants) {
|
||||
val contact =
|
||||
|
@ -188,7 +188,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
}
|
||||
}
|
||||
subject = chatRoom.subject.orEmpty()
|
||||
icon = IconCompat.createWithResource(context, R.drawable.voip_multiple_contacts_avatar)
|
||||
icon = IconCompat.createWithResource(context, R.drawable.voip_multiple_contacts_avatar_alt)
|
||||
}
|
||||
|
||||
val persons = arrayOfNulls<Person>(personsList.size)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -36,7 +36,7 @@
|
|||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/voip_single_contact_avatar"
|
||||
android:src="@drawable/voip_single_contact_avatar_alt"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="5dp"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/voip_single_contact_avatar"/>
|
||||
android:src="@drawable/voip_single_contact_avatar_alt"/>
|
||||
|
||||
<ImageView
|
||||
android:visibility="@{generatedAvatarVisibility ? View.VISIBLE : View.GONE}"
|
||||
|
|
|
@ -52,19 +52,23 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/voip_single_contact_avatar"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/generated_avatar_bg"
|
||||
android:src="@drawable/icon_single_contact_avatar"
|
||||
android:contentDescription="@string/content_description_change_own_picture"
|
||||
glideAvatarFallback="@{viewModel.defaultAccountAvatar}" />
|
||||
glidePath="@{viewModel.defaultAccountAvatar}" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="@{viewModel.defaultAccountFound ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="10dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/avatar_border" />
|
||||
android:src="@drawable/avatar_border"
|
||||
android:visibility="@{viewModel.defaultAccountFound ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -39,10 +39,11 @@
|
|||
<ImageView
|
||||
android:visibility="@{data.isInRemoteConference ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/voip_multiple_contacts_avatar" />
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/generated_avatar_bg"
|
||||
android:src="@drawable/icon_multiple_contacts_avatar" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue