forked from upstream-mirrors/quik
@@ -21,10 +21,12 @@ package com.moez.QKSMS.feature.compose
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import com.bumptech.glide.Glide
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.base.QkAdapter
|
||||
import com.moez.QKSMS.common.base.QkViewHolder
|
||||
import com.moez.QKSMS.common.util.extensions.getDisplayName
|
||||
import com.moez.QKSMS.extensions.mapNotNull
|
||||
import com.moez.QKSMS.model.Attachment
|
||||
import ezvcard.Ezvcard
|
||||
@@ -78,9 +80,13 @@ class AttachmentAdapter @Inject constructor(
|
||||
|
||||
is Attachment.Contact -> Observable.just(attachment.vCard)
|
||||
.mapNotNull { vCard -> Ezvcard.parse(vCard).first() }
|
||||
.map { vcard -> vcard.getDisplayName() ?: "" }
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { vcard -> holder.name?.text = vcard.formattedName.value }
|
||||
.subscribe { displayName ->
|
||||
holder.name?.text = displayName
|
||||
holder.name?.isVisible = displayName.isNotEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@ package com.moez.QKSMS.feature.compose.part
|
||||
import android.content.Context
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.view.isVisible
|
||||
import com.moez.QKSMS.R
|
||||
import com.moez.QKSMS.common.base.QkViewHolder
|
||||
import com.moez.QKSMS.common.util.Colors
|
||||
import com.moez.QKSMS.common.util.extensions.getDisplayName
|
||||
import com.moez.QKSMS.common.util.extensions.resolveThemeColor
|
||||
import com.moez.QKSMS.common.util.extensions.setBackgroundTint
|
||||
import com.moez.QKSMS.common.util.extensions.setTint
|
||||
@@ -61,9 +63,13 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
Observable.just(part.getUri())
|
||||
.map(context.contentResolver::openInputStream)
|
||||
.mapNotNull { inputStream -> inputStream.use { Ezvcard.parse(it).first() } }
|
||||
.map { vcard -> vcard.getDisplayName() ?: "" }
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { vcard -> holder.name?.text = vcard.formattedName.value }
|
||||
.subscribe { displayName ->
|
||||
holder.name?.text = displayName
|
||||
holder.name.isVisible = displayName.isNotEmpty()
|
||||
}
|
||||
|
||||
val params = holder.vCardBackground.layoutParams as FrameLayout.LayoutParams
|
||||
if (!message.isMe()) {
|
||||
@@ -81,4 +87,4 @@ class VCardBinder @Inject constructor(colors: Colors, private val context: Conte
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user