Disable expand/collapse when there's only one item

This commit is contained in:
Naveen 2022-08-29 15:59:31 +05:30
parent ad6abf7ccc
commit 66363caf4c

View File

@ -10,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
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.applyColorFilter import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.getProperTextColor
import com.simplemobiletools.commons.extensions.getTextSize
import com.simplemobiletools.commons.extensions.onGlobalLayout
import com.simplemobiletools.commons.helpers.SimpleContactsHelper import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.smsmessenger.R import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.activities.SimpleActivity import com.simplemobiletools.smsmessenger.activities.SimpleActivity
@ -83,12 +80,15 @@ class VCardViewerAdapter(
.into(this) .into(this)
} }
expand_collapse_icon.applyColorFilter(textColor) expand_collapse_icon.applyColorFilter(textColor)
setOnClickListener { if (items.size > 1) {
expandOrCollapseRow(view, item) setOnClickListener {
expandOrCollapseRow(view, item)
}
} }
onGlobalLayout { onGlobalLayout {
if (items.size == 1) { if (items.size == 1) {
expandOrCollapseRow(view, item) expandOrCollapseRow(view, item)
view.expand_collapse_icon.beGone()
} }
} }
} }