mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
Check for nullability
This commit is contained in:
@ -367,8 +367,12 @@ class ThreadAdapter(
|
|||||||
thread_mesage_attachments_holder.addView(vCardView)
|
thread_mesage_attachments_holder.addView(vCardView)
|
||||||
|
|
||||||
parseVCardFromUri(context, uri) { vCards ->
|
parseVCardFromUri(context, uri) { vCards ->
|
||||||
val title = vCards.first().formattedName.value
|
val title = vCards.firstOrNull()?.formattedName?.value
|
||||||
val imageIcon = SimpleContactsHelper(context).getContactLetterIcon(title)
|
val imageIcon = if (title != null) {
|
||||||
|
SimpleContactsHelper(context).getContactLetterIcon(title)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
vCardView.apply {
|
vCardView.apply {
|
||||||
vcard_title.text = title
|
vcard_title.text = title
|
||||||
|
@ -55,7 +55,7 @@ class VCardViewerAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setupVCardView(view: View, item: VCardWrapper) {
|
private fun setupVCardView(view: View, item: VCardWrapper) {
|
||||||
val name = item.vCard.formattedName.value
|
val name = item.vCard.formattedName?.value
|
||||||
view.apply {
|
view.apply {
|
||||||
item_contact_name.apply {
|
item_contact_name.apply {
|
||||||
text = name
|
text = name
|
||||||
@ -64,7 +64,11 @@ class VCardViewerAdapter(
|
|||||||
}
|
}
|
||||||
item_contact_image.apply {
|
item_contact_image.apply {
|
||||||
val photo = item.vCard.photos.firstOrNull()
|
val photo = item.vCard.photos.firstOrNull()
|
||||||
val placeholder = SimpleContactsHelper(context).getContactLetterIcon(name).toDrawable(resources)
|
val placeholder = if (name != null) {
|
||||||
|
SimpleContactsHelper(context).getContactLetterIcon(name).toDrawable(resources)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
val roundingRadius = resources.getDimensionPixelSize(R.dimen.big_margin)
|
val roundingRadius = resources.getDimensionPixelSize(R.dimen.big_margin)
|
||||||
val transformation = RoundedCorners(roundingRadius)
|
val transformation = RoundedCorners(roundingRadius)
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
|
Reference in New Issue
Block a user