游戏详情标签样式由后台控制

This commit is contained in:
kehaoyuan
2019-05-13 18:18:02 +08:00
parent 5f1ff1fc6f
commit 38d2c189e8
5 changed files with 34 additions and 16 deletions

View File

@ -133,7 +133,7 @@ public class PlatformUtils {
}
}
updataPlatform(platformMap, platformPicMap, platformPicUrlMap,
updatePlatform(platformMap, platformPicMap, platformPicUrlMap,
platformColorMap);
}
@ -184,7 +184,7 @@ public class PlatformUtils {
}
}
private void updataPlatform(ArrayMap<String, String> pMap,
private void updatePlatform(ArrayMap<String, String> pMap,
ArrayMap<String, Integer> pPMap, ArrayMap<String, String> pUMap,
ArrayMap<String, String> pCMap) {
platformMap = pMap;

View File

@ -51,8 +51,8 @@ class GameDetailEntity : Parcelable {
var notice: MutableList<NewsEntity>? = null
@SerializedName("type_tag")
var gameTag: List<String>? = null
@SerializedName("tag_style")
var tagStyle: ArrayList<TagStyleEntity> = ArrayList()
@SerializedName("server")
var serverEntity: GameDetailServer? = null
@ -113,7 +113,7 @@ class GameDetailEntity : Parcelable {
dest.writeByte(if (this.isSkinTest) 1.toByte() else 0.toByte())
dest.writeParcelable(this.contact, flags)
dest.writeTypedList(this.notice)
dest.writeStringList(this.gameTag)
dest.writeTypedList(this.tagStyle)
dest.writeParcelable(this.serverEntity, flags)
dest.writeTypedList(this.relatedGames)
dest.writeString(this.fulishuoming)
@ -124,7 +124,7 @@ class GameDetailEntity : Parcelable {
protected constructor(`in`: Parcel) {
this.tag = `in`.createTypedArrayList(TagEntity.CREATOR)
this.tips = `in`.readParcelable<TipsEntity>(TipsEntity::class.java.classLoader)
this.tips = `in`.readParcelable(TipsEntity::class.java.classLoader)
this.news = `in`.createTypedArrayList(NewsEntity.CREATOR)
this.gallery = `in`.createStringArrayList()
this.des = `in`.readString()
@ -133,13 +133,13 @@ class GameDetailEntity : Parcelable {
this.shareCode = `in`.readString()
this.downloadOffText = `in`.readString()
this.isSkinTest = `in`.readByte().toInt() != 0
this.contact = `in`.readParcelable<GameDetailContact>(GameDetailContact::class.java.classLoader)
this.contact = `in`.readParcelable(GameDetailContact::class.java.classLoader)
this.notice = `in`.createTypedArrayList(NewsEntity.CREATOR)
this.gameTag = `in`.createStringArrayList()
this.serverEntity = `in`.readParcelable<GameDetailServer>(GameDetailServer::class.java.classLoader)
this.tagStyle = `in`.createTypedArrayList(TagStyleEntity.CREATOR)
this.serverEntity = `in`.readParcelable(GameDetailServer::class.java.classLoader)
this.relatedGames = `in`.createTypedArrayList(GameDetailRelatedGame.CREATOR)
this.fulishuoming = `in`.readString()
this.me = `in`.readParcelable<MeEntity>(MeEntity::class.java.classLoader)
this.me = `in`.readParcelable(MeEntity::class.java.classLoader)
}
companion object {

View File

@ -9,7 +9,7 @@ data class DescItemData(
var recommendedGame: GameEntity? = null,
var plugin: Plugin? = null,
var intro: Intro? = null,
var gameTag: ArrayList<String>? = null,
var gameTag: ArrayList<TagStyleEntity>? = null,
var header: String? = "",
var recommendedImage: LinkEntity? = null,
var comments: ArrayList<RatingComment>? = null)

View File

@ -62,8 +62,8 @@ class DescViewModel(application: Application,
}
// 游戏标签
if (it.gameTag != null && it.gameTag!!.isNotEmpty()) {
mDataList.add(DescItemData(gameTag = ArrayList(it.gameTag)))
if (it.tagStyle.isNotEmpty()) {
mDataList.add(DescItemData(gameTag = ArrayList(it.tagStyle)))
}
// 图片推荐

View File

@ -1,10 +1,14 @@
package com.gh.gamecenter.gamedetail.desc;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.ViewGroup;
import com.gh.common.util.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.GameDetailGameTagTypeViewHolder;
import com.gh.gamecenter.entity.TagStyleEntity;
import com.lightgame.adapter.BaseRecyclerAdapter;
import java.util.List;
@ -14,9 +18,9 @@ import java.util.List;
*/
public class GameDetailGameTagAdapter extends BaseRecyclerAdapter<GameDetailGameTagTypeViewHolder> {
private List<String> mGameType;
private List<TagStyleEntity> mGameType;
public GameDetailGameTagAdapter(Context context, List<String> gameType) {
public GameDetailGameTagAdapter(Context context, List<TagStyleEntity> gameType) {
super(context);
mGameType = gameType;
}
@ -28,7 +32,21 @@ public class GameDetailGameTagAdapter extends BaseRecyclerAdapter<GameDetailGame
@Override
public void onBindViewHolder(GameDetailGameTagTypeViewHolder holder, int position) {
holder.type.setText(mGameType.get(position));
GradientDrawable gradientDrawable = new GradientDrawable();
TagStyleEntity tagEntity = mGameType.get(position);
String colorStr = "#" + tagEntity.getColor();
if ("border".equals(tagEntity.getStyle())) {
gradientDrawable.setColor(Color.TRANSPARENT);
gradientDrawable.setStroke(DisplayUtils.dip2px(mContext, 0.6f), Color.parseColor(colorStr));
holder.type.setTextColor(Color.parseColor(colorStr));
} else {
gradientDrawable.setColor(Color.parseColor(colorStr));
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
holder.type.setTextColor(Color.WHITE);
}
gradientDrawable.setCornerRadius(DisplayUtils.dip2px(999F));
holder.type.setText(tagEntity.getName());
holder.type.setBackground(gradientDrawable);
}
@Override