【光环助手V5.9.0】新社区7期-论坛详情页优化(增加标签字体颜色字段)https://git.shanqu.cc/pm/halo-app-issues/-/issues/1789#note_146539

This commit is contained in:
lyr
2022-05-06 20:53:09 +08:00
parent 30bf685962
commit e0bcf947bf
2 changed files with 13 additions and 5 deletions

View File

@ -31,7 +31,11 @@ data class ForumDetailEntity(
var style: Style = Style()
)
data class Style(var color: String = "")
data class Style(
var color: String = "",
@SerializedName("font_color")
var fontColor: String = ""
)
fun convertForumDetailEntityToForumEntity(): ForumEntity {
val forumEntity = ForumEntity()

View File

@ -31,11 +31,15 @@ class ForumTopLinkAdapter(
linkNameTv.text = linkEntity.title
linkEntity.category?.run {
tagView.visibility = View.VISIBLE
tagView.text = linkEntity.category!!.title
if (linkEntity.category!!.style.color.isNotBlank()) {
tagView.text = title
tagView.setTextColor(
if (style.fontColor.isNotBlank()) Color.parseColor(style.fontColor)
else Color.WHITE
)
if (style.color.isNotBlank()) {
tagView.background = DrawableView.getCornerGradientDrawable(
Color.parseColor(linkEntity.category!!.style.color),
Color.parseColor(linkEntity.category!!.style.color),
Color.parseColor(style.color),
Color.parseColor(style.color),
3F
)
}