mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-18 03:48:52 +01:00
Store contact’s photoUri
So much less complicated now!
This commit is contained in:
@@ -234,7 +234,7 @@ class MessagesAdapter @Inject constructor(
|
||||
// Bind the avatar
|
||||
if (!message.isMe()) {
|
||||
view.avatar.threadId = conversation?.id ?: 0
|
||||
view.avatar.setContact(contactCache[message.address])
|
||||
view.avatar.setContact(contactCache[message.address]?.contact)
|
||||
view.avatar.setVisible(!canGroup(message, next), View.INVISIBLE)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class ChipsAdapter @Inject constructor() : QkAdapter<Chip>() {
|
||||
val chip = getItem(position)
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.setContact(chip.contact, chip.address)
|
||||
view.avatar.setContact(chip.contact)
|
||||
view.name.text = chip.contact?.name?.takeIf { it.isNotBlank() } ?: chip.address
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ class DetailedChipView(context: Context) : RelativeLayout(context) {
|
||||
}
|
||||
|
||||
fun setChip(chip: Chip) {
|
||||
avatar.setContact(chip.contact, chip.address)
|
||||
avatar.setContact(chip.contact)
|
||||
name.text = chip.contact?.name?.takeIf { it.isNotBlank() } ?: chip.address
|
||||
info.text = chip.address
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class ConversationRecipientAdapter @Inject constructor() : QkRealmAdapter<Recipi
|
||||
val view = holder.containerView
|
||||
|
||||
view.avatar.threadId = threadId
|
||||
view.avatar.setContact(recipient)
|
||||
view.avatar.setContact(recipient.contact)
|
||||
|
||||
view.name.text = recipient.contact?.name ?: recipient.address
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.moez.QKSMS.model.PhoneNumber
|
||||
import com.moez.QKSMS.repository.ConversationRepository
|
||||
import com.moez.QKSMS.util.GlideApp
|
||||
import com.moez.QKSMS.util.Preferences
|
||||
import com.moez.QKSMS.util.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
class WidgetAdapter(intent: Intent) : RemoteViewsService.RemoteViewsFactory {
|
||||
@@ -130,17 +131,11 @@ class WidgetAdapter(intent: Intent) : RemoteViewsService.RemoteViewsFactory {
|
||||
}
|
||||
|
||||
remoteViews.setImageViewBitmap(R.id.photo, null)
|
||||
contact?.numbers?.firstOrNull()?.address?.let { address ->
|
||||
val futureGet = GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.load("tel:$address")
|
||||
.submit(48.dpToPx(context), 48.dpToPx(context))
|
||||
|
||||
try {
|
||||
remoteViews.setImageViewBitmap(R.id.photo, futureGet.get())
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
val futureGet = GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.load(contact?.photoUri)
|
||||
.submit(48.dpToPx(context), 48.dpToPx(context))
|
||||
tryOrNull(false) { remoteViews.setImageViewBitmap(R.id.photo, futureGet.get()) }
|
||||
|
||||
// Name
|
||||
remoteViews.setTextColor(R.id.name, textPrimary)
|
||||
|
||||
Reference in New Issue
Block a user