Hide phone number field when there is none
This commit is contained in:
parent
ea5adfcf91
commit
5c6500d45e
|
@ -10,6 +10,7 @@ import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
|
||||||
import com.bumptech.glide.request.RequestOptions
|
import com.bumptech.glide.request.RequestOptions
|
||||||
|
import com.simplemobiletools.commons.extensions.beGone
|
||||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||||
import com.simplemobiletools.commons.extensions.normalizeString
|
import com.simplemobiletools.commons.extensions.normalizeString
|
||||||
|
@ -44,8 +45,13 @@ class AutoCompleteTextViewAdapter(
|
||||||
|
|
||||||
tag = nameToUse.isNotEmpty()
|
tag = nameToUse.isNotEmpty()
|
||||||
item_autocomplete_name.text = nameToUse
|
item_autocomplete_name.text = nameToUse
|
||||||
item_autocomplete_number.text = contact.phoneNumbers.run {
|
contact.phoneNumbers.apply {
|
||||||
firstOrNull { it.isPrimary }?.normalizedNumber ?: firstOrNull()?.normalizedNumber
|
val phoneNumber = firstOrNull { it.isPrimary }?.normalizedNumber ?: firstOrNull()?.normalizedNumber
|
||||||
|
if (phoneNumber.isNullOrEmpty()) {
|
||||||
|
item_autocomplete_number.beGone()
|
||||||
|
} else {
|
||||||
|
item_autocomplete_number.text = phoneNumber
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
|
|
Loading…
Reference in New Issue