【光环助手V5.10.0】游戏副标题相关需求 https://git.shanqu.cc/pm/halo-app-issues/-/issues/1839

This commit is contained in:
leafwai
2022-05-30 17:11:01 +08:00
parent 7671e0b4e1
commit 005ec81929
9 changed files with 31 additions and 29 deletions

View File

@ -11,6 +11,7 @@ import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.databinding.GameItemBinding
import com.gh.gamecenter.entity.GameEntity
@ -48,9 +49,9 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
gameDes.text = entity.decoratedDes
recommendStar.rating = entity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((entity.serverLabel == null || entity.advanceDownload) && entity.subtitle.isNotEmpty()))
if ((entity.serverLabel == null || entity.advanceDownload) && entity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = entity.subtitle
if (entity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${entity.subtitleStyle?.color}"))

View File

@ -15,6 +15,7 @@ import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncUi
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.utils.goneIf
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.game.GameItemViewHolder
@ -85,9 +86,9 @@ class GameVerticalAdapter(
BindingAdapters.setGameTags(gameTagContainer, gameEntity)
GameItemViewHolder.initServerType(gameNameTv, serverTypeTv, gameEntity)
gameDesTv.text = gameEntity.decoratedDes
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))

View File

@ -586,9 +586,9 @@ open class GameCollectionDetailAdapter(
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor(mContext) else R.color.theme.toColor(mContext))
gameDes.text = gameEntity.decoratedDes
recommendStar.rating = gameEntity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))

View File

@ -27,9 +27,9 @@ class HomeGameItemViewHolder(val binding: HomeGameItemBinding) : BaseRecyclerVie
View.VISIBLE
} else View.GONE
}, 5)
binding.gameSubtitleTv.goneIf(!((game.serverLabel == null || game.advanceDownload) && game.subtitle.isNotEmpty()))
if ((game.serverLabel == null || game.advanceDownload) && game.subtitle.isNotEmpty()) {
binding.gameSubtitleTv.run {
visibility = View.VISIBLE
text = game.subtitle
if (game.subtitleStyle != null) {
setTextColor(Color.parseColor("#${game.subtitleStyle?.color}"))

View File

@ -37,25 +37,28 @@ class HomeSlideListItemViewHolder(val binding: HomeSlideListItemBinding) : BaseR
}
binding.includeGame.gameRating.setTextColor(R.color.white.toColor())
binding.includeGame.gameName.setTextColor(R.color.white.toColor())
if (homeSlide.linkGame?.serverLabel == null && homeSlide.linkGame?.subtitle?.isNotEmpty() == true) {
binding.includeGame.gameSubtitleTv.run {
visibility = View.VISIBLE
text = homeSlide.linkGame.subtitle
if (homeSlide.linkGame.subtitleStyle != null) {
setTextColor(Color.parseColor("#${homeSlide.linkGame.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
if (homeSlide.linkGame.subtitleStyle?.style == "border") {
setColor(Color.TRANSPARENT)
setStroke(0.5F.dip2px(), Color.parseColor("#${homeSlide.linkGame.subtitleStyle?.background}"))
} else {
shape = GradientDrawable.RECTANGLE
setColor(Color.parseColor("#${homeSlide.linkGame.subtitleStyle?.background}"))
homeSlide.linkGame?.let {
binding.includeGame.gameSubtitleTv.goneIf(!((it.serverLabel == null || it.advanceDownload) && it.subtitle.isNotEmpty()))
if ((it.serverLabel == null || it.advanceDownload) && it.subtitle.isNotEmpty()) {
binding.includeGame.gameSubtitleTv.run {
text = it.subtitle
if (it.subtitleStyle != null) {
setTextColor(Color.parseColor("#${it.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
if (it.subtitleStyle?.style == "border") {
setColor(Color.TRANSPARENT)
setStroke(0.5F.dip2px(), Color.parseColor("#${it.subtitleStyle?.background}"))
} else {
shape = GradientDrawable.RECTANGLE
setColor(Color.parseColor("#${it.subtitleStyle?.background}"))
}
}
} else {
setTextColor(R.color.text_subtitle.toColor(context))
background = R.drawable.bg_game_subtitle.toDrawable(context)
}
} else {
setTextColor(R.color.text_subtitle.toColor(context))
background = R.drawable.bg_game_subtitle.toDrawable(context)
}
}
}

View File

@ -81,9 +81,9 @@ class MyFollowedGameAdapter(context: Context, var mViewModel: MyFollowedGameView
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor(mContext) else R.color.theme.toColor(mContext))
gameDes.text = gameEntity.decoratedDes
recommendStar.rating = gameEntity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))

View File

@ -18,10 +18,7 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.baselist.ListAdapter
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.ItemFollowedGameBinding
import com.gh.gamecenter.entity.GameEntity
@ -89,9 +86,9 @@ class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewMo
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor(mContext) else R.color.theme.toColor(mContext))
gameDes.text = gameEntity.decoratedDes
recommendStar.rating = gameEntity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))

View File

@ -133,9 +133,9 @@ open class PlayedGameAdapter(
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor())
gameDes.text = gameEntity.decoratedDes
recommendStar.rating = gameEntity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))

View File

@ -137,9 +137,9 @@ class SearchGameIndexAdapter(
gameRating.setTextColor(if (gameEntity.commentCount > 3) R.color.theme_font.toColor() else R.color.theme.toColor())
gameDes.text = gameEntity.decoratedDes
recommendStar.rating = gameEntity.recommendStar.toFloat()
gameSubtitleTv.goneIf(!((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()))
if ((gameEntity.serverLabel == null || gameEntity.advanceDownload) && gameEntity.subtitle.isNotEmpty()) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = gameEntity.subtitle
if (gameEntity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${gameEntity.subtitleStyle?.color}"))