【光环助手V5.10.0】游戏副标题相关需求(20220531UI测试 遗漏) https://git.shanqu.cc/pm/halo-app-issues/-/issues/1839
This commit is contained in:
@ -3,7 +3,9 @@ package com.gh.gamecenter.game
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.view.View
|
||||
import android.widget.Space
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
|
||||
import com.gh.common.databind.BindingAdapters
|
||||
@ -49,6 +51,33 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
|
||||
gameRating.setTextColor(if (entity.commentCount > 3) R.color.theme_font.toColor(root.context) else R.color.theme.toColor(root.context))
|
||||
gameDes.text = entity.decoratedDes
|
||||
recommendStar.rating = entity.recommendStar.toFloat()
|
||||
initGameSubtitle(entity, gameSubtitleTv, gameDesSpace, root)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun initServerType(gameNameTv: TextView, serverTypeTv: TextView, gameEntity: GameEntity) {
|
||||
val serverLabel = gameEntity.serverLabel
|
||||
when {
|
||||
gameEntity.test != null -> {
|
||||
serverTypeTv.visibility = View.GONE
|
||||
serverTypeTv.text = ""
|
||||
}
|
||||
serverLabel != null && !gameEntity.advanceDownload -> {
|
||||
serverTypeTv.visibility = View.VISIBLE
|
||||
serverTypeTv.text = serverLabel.value
|
||||
serverTypeTv.setTextColor(Color.WHITE)
|
||||
serverTypeTv.background = DrawableView.getServerDrawable(serverLabel.color)
|
||||
}
|
||||
else -> serverTypeTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 由于RecyclerView的复用机制 需要每次测量gameName的宽
|
||||
gameNameTv.requestLayout()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun initGameSubtitle(entity: GameEntity, gameSubtitleTv: TextView, gameDesSpace: Space, rootContainer: ConstraintLayout) {
|
||||
gameSubtitleTv.visibility = View.GONE
|
||||
if (entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) {
|
||||
gameSubtitleTv.run {
|
||||
@ -82,33 +111,11 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
|
||||
}
|
||||
if (entity.serverLabel != null && !entity.advanceDownload) {
|
||||
ConstraintSet().apply {
|
||||
clone(root)
|
||||
clone(rootContainer)
|
||||
connect(R.id.game_name, ConstraintSet.END, R.id.recent_played_tag, ConstraintSet.START)
|
||||
}.applyTo(root)
|
||||
}.applyTo(rootContainer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun initServerType(gameNameTv: TextView, serverTypeTv: TextView, gameEntity: GameEntity) {
|
||||
val serverLabel = gameEntity.serverLabel
|
||||
when {
|
||||
gameEntity.test != null -> {
|
||||
serverTypeTv.visibility = View.GONE
|
||||
serverTypeTv.text = ""
|
||||
}
|
||||
serverLabel != null && !gameEntity.advanceDownload -> {
|
||||
serverTypeTv.visibility = View.VISIBLE
|
||||
serverTypeTv.text = serverLabel.value
|
||||
serverTypeTv.setTextColor(Color.WHITE)
|
||||
serverTypeTv.background = DrawableView.getServerDrawable(serverLabel.color)
|
||||
}
|
||||
else -> serverTypeTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 由于RecyclerView的复用机制 需要每次测量gameName的宽
|
||||
gameNameTv.requestLayout()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -167,7 +167,7 @@ class GameItemUi(override val ctx: Context) : Ui {
|
||||
endToEndOf(mGameDesSpace)
|
||||
orientation = LinearLayout.HORIZONTAL
|
||||
})
|
||||
add(gameSubtitleTv, lParams(wrapContent, wrapContent) {
|
||||
add(gameSubtitleTv, lParams(wrapContent, dip(14)) {
|
||||
startToEndOf(gameNameTv)
|
||||
topToTopOf(gameNameTv)
|
||||
bottomToBottomOf(gameNameTv)
|
||||
@ -209,9 +209,9 @@ class GameItemUi(override val ctx: Context) : Ui {
|
||||
private fun initGameSubtitleTv() = textView {
|
||||
id = R.id.gameSubtitleTv
|
||||
setSingleLine()
|
||||
includeFontPadding = false
|
||||
textSize = 10F
|
||||
padding = dip(2)
|
||||
startPadding = dip(2)
|
||||
endPadding = dip(2)
|
||||
background = ContextCompat.getDrawable(context, R.drawable.bg_advance_download_game_subtitle)
|
||||
setTextColor(ContextCompat.getColor(context, R.color.text_subtitle))
|
||||
visibility = View.GONE
|
||||
|
||||
@ -26,6 +26,7 @@ import com.gh.gamecenter.databinding.GamePluggableItemBinding;
|
||||
import com.gh.gamecenter.databinding.HomeDividerItemBinding;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.PluginLocation;
|
||||
import com.gh.gamecenter.game.GameItemViewHolder;
|
||||
import com.gh.gamecenter.home.HomeFragmentAdapter;
|
||||
import com.gh.gamecenter.home.PluginDisplayStatus;
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository;
|
||||
@ -115,6 +116,8 @@ public class GamePluginAdapter extends BaseRecyclerAdapter {
|
||||
binding.gameItemIncluded.gameRating.setTextColor(gameEntity.getCommentCount() > 3 ? ExtensionsKt.toColor(R.color.theme_font) : ExtensionsKt.toColor(R.color.theme));
|
||||
binding.gameItemIncluded.gameDes.setText(gameEntity.getDecoratedDes());
|
||||
binding.gameItemIncluded.recommendStar.setRating(gameEntity.getRecommendStar());
|
||||
GameItemViewHolder.initGameSubtitle(gameEntity, binding.gameItemIncluded.gameSubtitleTv, binding.gameItemIncluded.gameDesSpace, binding.gameItemIncluded.getRoot());
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
MtaHelper.onEvent("首页_新", "点击", "插件化" + (position + 1) + "_" + gameEntity.getName());
|
||||
DataCollectionUtils.uploadClick(mContext, "插件化" + "-列表", "游戏-专题", gameEntity.getName());
|
||||
|
||||
Reference in New Issue
Block a user