1
0
mirror of https://github.com/tateisu/SubwayTooter synced 2025-01-27 09:11:23 +01:00

show blurhash even in vertical thumbnail mode

This commit is contained in:
tateisu 2019-07-24 17:59:07 +09:00
parent 8541f9c470
commit 20155ea16b

View File

@ -91,7 +91,7 @@ internal class ItemViewHolder(
private lateinit var flMedia : View private lateinit var flMedia : View
private lateinit var llMedia : View private lateinit var llMedia : View
private lateinit var btnShowMedia : TextView private lateinit var btnShowMedia : BlurhashView
private lateinit var ivMedia1 : MyNetworkImageView private lateinit var ivMedia1 : MyNetworkImageView
private lateinit var ivMedia2 : MyNetworkImageView private lateinit var ivMedia2 : MyNetworkImageView
private lateinit var ivMedia3 : MyNetworkImageView private lateinit var ivMedia3 : MyNetworkImageView
@ -290,7 +290,7 @@ internal class ItemViewHolder(
cardBackground.width = (density * 1f) cardBackground.width = (density * 1f)
} }
(btnShowMedia as? BlurhashView)?.text = btnShowMedia.text =
SpannableString(activity.getString(R.string.tap_to_show)) SpannableString(activity.getString(R.string.tap_to_show))
.apply { .apply {
val colorBg = getAttributeColor(activity, R.attr.colorShowMediaBackground) val colorBg = getAttributeColor(activity, R.attr.colorShowMediaBackground)
@ -1323,11 +1323,8 @@ internal class ItemViewHolder(
setMedia(media_attachments, sb, ivMedia3, 2) setMedia(media_attachments, sb, ivMedia3, 2)
setMedia(media_attachments, sb, ivMedia4, 3) setMedia(media_attachments, sb, ivMedia4, 3)
(btnShowMedia as? BlurhashView)?.let { val m0 = if(media_attachments.isEmpty()) null else media_attachments[0] as? TootAttachment
val m0 = btnShowMedia.blurhash = m0?.blurhash
if(media_attachments.isEmpty()) null else media_attachments[0] as? TootAttachment
it.blurhash = m0?.blurhash
}
if(sb.isNotEmpty()) { if(sb.isNotEmpty()) {
tvMediaDescription.visibility = View.VISIBLE tvMediaDescription.visibility = View.VISIBLE
@ -3312,22 +3309,22 @@ internal class ItemViewHolder(
} }
} }
btnShowMedia = textView { btnShowMedia = blurhashView {
background = errorColor = getAttributeColor(
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent) context,
R.attr.colorShowMediaBackground
)
gravity = Gravity.CENTER
padding = dip(4) textColor = getAttributeColor(
context,
R.attr.colorShowMediaText
)
minHeightCompat = dip(40) minHeightCompat = dip(48)
gravity = Gravity.CENTER_VERTICAL or Gravity.END }.lparams(matchParent,wrapContent)
text = context.getString(R.string.tap_to_show)
}.lparams(wrapContent,wrapContent){
gravity = Gravity.END
}
} }
} else { } else {