Use tel: schema for glide handler

This commit is contained in:
moezbhatti
2019-10-28 00:58:02 -04:00
parent 18d8f24123
commit ae2d482d95
6 changed files with 7 additions and 7 deletions
@@ -42,7 +42,7 @@ class ContactImageLoader(
) : ModelLoader<String, InputStream> {
override fun handles(model: String): Boolean {
return phoneNumberUtils.isPossibleNumber(model)
return model.startsWith("tel:")
}
override fun buildLoadData(
@@ -157,7 +157,7 @@ class NotificationManagerImpl @Inject constructor(
person.setIcon(GlideApp.with(context)
.asBitmap()
.circleCrop()
.load(message.address)
.load("tel:${message.address}")
.submit(64.dpToPx(context), 64.dpToPx(context))
.let { futureGet -> tryOrNull(false) { futureGet.get() } }
?.let(IconCompat::createWithBitmap))
@@ -182,7 +182,7 @@ class NotificationManagerImpl @Inject constructor(
GlideApp.with(context)
.asBitmap()
.circleCrop()
.load(address)
.load("tel:$address")
.submit(64.dpToPx(context), 64.dpToPx(context))
}
?.let { futureGet -> tryOrNull(false) { futureGet.get() } }
@@ -58,7 +58,7 @@ class QkChooserTargetService : ChooserTargetService() {
val request = GlideApp.with(this)
.asBitmap()
.circleCrop()
.load(address)
.load("tel:$address")
.submit()
val bitmap = tryOrNull(false) { request.get() }
@@ -65,7 +65,7 @@ class ShortcutManagerImpl @Inject constructor(
val request = GlideApp.with(context)
.asBitmap()
.circleCrop()
.load(address)
.load("tel:$address")
.submit(shortcutManager.iconMaxWidth, shortcutManager.iconMaxHeight)
val bitmap = tryOrNull(false) { request.get() }
@@ -126,7 +126,7 @@ class AvatarView @JvmOverloads constructor(context: Context, attrs: AttributeSet
photo.setImageDrawable(null)
address?.let { address ->
GlideApp.with(photo)
.load(address)
.load("tel:$address")
.signature(ObjectKey(lastUpdated ?: 0L))
.into(photo)
}
@@ -130,7 +130,7 @@ class WidgetAdapter(intent: Intent) : RemoteViewsService.RemoteViewsFactory {
contact?.numbers?.firstOrNull()?.address?.let { address ->
val futureGet = GlideApp.with(context)
.asBitmap()
.load(address)
.load("tel:$address")
.submit(48.dpToPx(context), 48.dpToPx(context))
try {