ブースト表記と返信表記のレイアウト調整

This commit is contained in:
tateisu 2023-01-13 02:35:00 +09:00
parent 19b7d7d0d8
commit 0700e54554
1 changed files with 30 additions and 42 deletions

View File

@ -34,7 +34,6 @@ import jp.juggler.util.LogCategory
import jp.juggler.util.applyAlphaMultiplier import jp.juggler.util.applyAlphaMultiplier
import jp.juggler.util.attrColor import jp.juggler.util.attrColor
import org.jetbrains.anko.* import org.jetbrains.anko.*
import kotlin.math.min
class ItemViewHolder( class ItemViewHolder(
val activity: ActMain, val activity: ActMain,
@ -304,21 +303,18 @@ class ItemViewHolder(
ivAvatar.layoutParams.height = s ivAvatar.layoutParams.height = s
ivAvatar.layoutParams.width = s ivAvatar.layoutParams.width = s
ivFollow.layoutParams.width = s ivFollow.layoutParams.width = s
ivBoosted.layoutParams.width = s
s = ActMain.replyIconSize + (activity.density * 8).toInt() s = ActMain.replyIconSize
ivReply.layoutParams.width = s ivReply.layoutParams.width = s
ivReply.layoutParams.height = s ivReply.layoutParams.height = s
ivReplyAvatar.layoutParams.width = s ivReplyAvatar.layoutParams.width = s
ivReplyAvatar.layoutParams.height = s ivReplyAvatar.layoutParams.height = s
s = activity.notificationTlIconSize s = activity.notificationTlIconSize
ivBoosted.layoutParams.width = s
ivBoosted.layoutParams.height = s ivBoosted.layoutParams.height = s
ivBoostAvatar.layoutParams.width = s
min(activity.notificationTlIconSize, activity.avatarIconSize).let { ivBoostAvatar.layoutParams.height = s
ivBoostAvatar.layoutParams.width = it
ivBoostAvatar.layoutParams.height = it
}
this.contentInvalidator = NetworkEmojiInvalidator(activity.handler, tvContent) this.contentInvalidator = NetworkEmojiInvalidator(activity.handler, tvContent)
this.spoilerInvalidator = NetworkEmojiInvalidator(activity.handler, tvContentWarning) this.spoilerInvalidator = NetworkEmojiInvalidator(activity.handler, tvContentWarning)
@ -370,15 +366,19 @@ class ItemViewHolder(
gravity = Gravity.CENTER_VERTICAL gravity = Gravity.CENTER_VERTICAL
ivBoosted = imageView { ivBoosted = imageView {
scaleType = ImageView.ScaleType.FIT_END scaleType = ImageView.ScaleType.FIT_CENTER
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
}.lparams(dip(48), dip(32)) { }.lparams(dip(32), dip(32)) {}
endMargin = dip(4)
} ivBoostAvatar = myNetworkImageView {
scaleType = ImageView.ScaleType.FIT_CENTER
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
}.lparams(dip(32), dip(32)) {}
verticalLayout { verticalLayout {
lparams(dip(0), wrapContent) { lparams(dip(0), wrapContent) {
weight = 1f weight = 1f
startMargin = dip(4)
} }
linearLayout { linearLayout {
@ -405,23 +405,10 @@ class ItemViewHolder(
}.lparams(wrapContent, wrapContent) }.lparams(wrapContent, wrapContent)
} }
linearLayout { tvBoosted = myTextView {
lparams(matchParent, wrapContent) // tools:text = "~にブーストされました"
}.lparams(matchParent, wrapContent) {
ivBoostAvatar = myNetworkImageView { gravity = Gravity.CENTER_VERTICAL
scaleType = ImageView.ScaleType.FIT_END
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
padding = dip(4)
}.lparams(dip(32), dip(32)) {
gravity = Gravity.CENTER_VERTICAL
}
tvBoosted = myTextView {
// tools:text = "~にブーストされました"
}.lparams(matchParent, wrapContent){
endMargin = dip(2)
gravity = Gravity.CENTER_VERTICAL
}
} }
} }
} }
@ -616,32 +603,33 @@ class ItemViewHolder(
private fun _LinearLayout.inflateStatusReplyInfo() { private fun _LinearLayout.inflateStatusReplyInfo() {
llReply = linearLayout { llReply = linearLayout {
lparams(matchParent, wrapContent) { lparams(matchParent, wrapContent) {}
bottomMargin = dip(3)
} minimumHeight = dip(40)
padding = dip(4)
background = background =
ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp) ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent_round6dp)
gravity = Gravity.CENTER_VERTICAL gravity = Gravity.CENTER_VERTICAL
ivReplyAvatar = myNetworkImageView { ivReply = imageView {
scaleType = ImageView.ScaleType.FIT_END scaleType = ImageView.ScaleType.FIT_CENTER
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
padding = dip(4)
}.lparams(dip(32), dip(32)) { }.lparams(dip(32), dip(32)) {
endMargin = dip(1)
} }
ivReply = imageView { ivReplyAvatar = myNetworkImageView {
scaleType = ImageView.ScaleType.FIT_END scaleType = ImageView.ScaleType.FIT_CENTER
importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_NO
padding = dip(4)
}.lparams(dip(32), dip(32)) { }.lparams(dip(32), dip(32)) {
endMargin = dip(4) startMargin = dip(2)
} }
tvReply = myTextView { tvReply = myTextView {
}.lparams(dip(0), wrapContent) { }.lparams(dip(0), wrapContent) {
startMargin = dip(4)
weight = 1f weight = 1f
} }
} }
@ -806,8 +794,8 @@ class ItemViewHolder(
verticalLayout { verticalLayout {
lparams(0, wrapContent) { weight = 1f } lparams(0, wrapContent) { weight = 1f }
tvName = myTextView { tvName = myTextView {}
}.lparams(matchParent, wrapContent) .lparams(matchParent, wrapContent)
inflateOpenSticker() inflateOpenSticker()
inflateStatusReplyInfo() inflateStatusReplyInfo()