首页游戏重做(专题大图增强)
This commit is contained in:
@ -165,7 +165,7 @@ public class DownloadItemUtils {
|
||||
} else if (gh_id == null || gh_id.equals(gameEntity.getId())) {
|
||||
holder.gameDownloadBtn.setText(R.string.launch);
|
||||
holder.gameDownloadBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.detail_downloading_normal_style);
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.detail_download_open_style);
|
||||
} else {
|
||||
holder.gameDownloadBtn.setText(R.string.download);
|
||||
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
|
||||
|
||||
@ -20,6 +20,9 @@ import com.gh.gamecenter.R;
|
||||
|
||||
public class DownloadProgressBar extends ProgressBar {
|
||||
private static final int MAX_LENGTH = 1000;
|
||||
private static final int DOWNLOAD_NORMAL_STYLE = 0;
|
||||
private static final int DOWNLOAD_RECT_STYLE = 1;
|
||||
private static final int DOWNLOAD_IMAGE_STYLE = 2;
|
||||
|
||||
public enum DownloadType {
|
||||
NORMAL,
|
||||
@ -39,7 +42,7 @@ public class DownloadProgressBar extends ProgressBar {
|
||||
|
||||
private String mText;
|
||||
|
||||
private boolean mIsRectStyle;
|
||||
private int mDownloadStyle;
|
||||
private int mDefaultColor;
|
||||
private int mTextSize;
|
||||
|
||||
@ -51,7 +54,7 @@ public class DownloadProgressBar extends ProgressBar {
|
||||
super(context, attrs);
|
||||
if (attrs != null) {
|
||||
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.DownloadProgressBar);
|
||||
mIsRectStyle = ta.getBoolean(R.styleable.DownloadProgressBar_rectStyle, false);
|
||||
mDownloadStyle = ta.getInteger(R.styleable.DownloadProgressBar_downloadStyle, DOWNLOAD_NORMAL_STYLE);
|
||||
mTextSize = ta.getDimensionPixelSize(R.styleable.DownloadProgressBar_textSize, DisplayUtils.sp2px(getContext(), 14));
|
||||
ta.recycle();
|
||||
}
|
||||
@ -86,7 +89,7 @@ public class DownloadProgressBar extends ProgressBar {
|
||||
mPaint.setTextAlign(Paint.Align.CENTER);
|
||||
srcCanvas.drawText(mText, getWidth() / 2, baseline, mPaint);
|
||||
mPaint.setXfermode(mDuffXFerMode);
|
||||
mPaint.setColor(Color.WHITE); // 反向颜色
|
||||
mPaint.setColor(DOWNLOAD_IMAGE_STYLE == mDownloadStyle ? Color.BLACK : Color.WHITE); // 反向颜色
|
||||
|
||||
srcCanvas.drawRect(rectF, mPaint);
|
||||
canvas.drawBitmap(srcBitmap, 0, 0, null);
|
||||
@ -109,34 +112,66 @@ public class DownloadProgressBar extends ProgressBar {
|
||||
switch (downloadType) {
|
||||
case NORMAL:
|
||||
case INSTALL_NORMAL:
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
? R.drawable.detail_download_normal_rect_style : R.drawable.game_item_btn_download_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
switch (mDownloadStyle) {
|
||||
case DOWNLOAD_RECT_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_rect_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
break;
|
||||
case DOWNLOAD_IMAGE_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_image_style));
|
||||
mDefaultColor = Color.BLACK;
|
||||
break;
|
||||
default:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.game_item_btn_download_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PLUGIN:
|
||||
case INSTALL_PLUGIN:
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
|
||||
? R.drawable.detail_download_plugin_install_rect_style : R.drawable.game_item_btn_plugin_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
break;
|
||||
case NONE:
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
|
||||
? R.drawable.detail_download_none_rect_style : R.drawable.news_detail_comment));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.hint);
|
||||
break;
|
||||
case LAUNCH_OR_OPEN:
|
||||
setProgress(0);
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
? R.drawable.detail_download_open_rect_style : R.drawable.detail_download_open_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
switch (mDownloadStyle) {
|
||||
case DOWNLOAD_RECT_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_rect_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
break;
|
||||
case DOWNLOAD_IMAGE_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_image_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
break;
|
||||
default:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_open_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DOWNLOADING_NORMAL:
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
? R.drawable.detail_downloading_normal_rect_style : R.drawable.detail_downloading_normal_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
switch (mDownloadStyle) {
|
||||
case DOWNLOAD_RECT_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_rect_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
break;
|
||||
case DOWNLOAD_IMAGE_STYLE:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_image_style));
|
||||
mDefaultColor = Color.WHITE;
|
||||
break;
|
||||
default:
|
||||
setProgressDrawable(getResources().getDrawable(R.drawable.detail_downloading_normal_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.theme);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DOWNLOADING_PLUGIN:
|
||||
setProgressDrawable(getResources().getDrawable(mIsRectStyle
|
||||
setProgressDrawable(getResources().getDrawable(mDownloadStyle == DOWNLOAD_RECT_STYLE
|
||||
? R.drawable.detail_downloading_plugin_rect_style : R.drawable.detail_downloading_plugin_style));
|
||||
mDefaultColor = ContextCompat.getColor(getContext(), R.color.btn_plugin);
|
||||
break;
|
||||
|
||||
@ -5,6 +5,7 @@ import android.view.View;
|
||||
import com.facebook.drawee.view.SimpleDraweeView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.databinding.GameImageItemBinding;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
@ -19,6 +20,14 @@ public class GameImageViewHolder extends BaseRecyclerViewHolder {
|
||||
@BindView(R.id.game_image_line)
|
||||
public View line;
|
||||
|
||||
public GameImageItemBinding binding;
|
||||
|
||||
public GameImageViewHolder(GameImageItemBinding bind) {
|
||||
super(bind.getRoot());
|
||||
this.binding = bind;
|
||||
}
|
||||
|
||||
|
||||
public GameImageViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@ -48,23 +48,14 @@ public class GameViewHolder extends BaseRecyclerViewHolder {
|
||||
|
||||
public void initServerType(GameEntity gameEntity, Context context) {
|
||||
int paddRight = 0;
|
||||
String serverType = gameEntity.getServerType();
|
||||
if (TextUtils.isEmpty(serverType)) {
|
||||
String serverRemark = gameEntity.getServerRemark();
|
||||
if (TextUtils.isEmpty(serverRemark)) {
|
||||
gameServerType.setVisibility(View.GONE);
|
||||
} else {
|
||||
gameServerType.setVisibility(View.VISIBLE);
|
||||
gameServerType.setText(serverType);
|
||||
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
|
||||
gameServerType.setBackgroundResource(R.drawable.textview_server_tag);
|
||||
if ("删档内测".equals(serverType)) {
|
||||
paddRight = DisplayUtils.dip2px(context, 50);
|
||||
} else {
|
||||
paddRight = DisplayUtils.dip2px(context, 60);
|
||||
}
|
||||
} else {
|
||||
gameServerType.setBackgroundResource(R.drawable.textview_orange_up);
|
||||
paddRight = DisplayUtils.dip2px(context, 30);
|
||||
}
|
||||
gameServerType.setText(serverRemark);
|
||||
gameServerType.setBackgroundResource(R.drawable.textview_orange_up);
|
||||
paddRight = DisplayUtils.dip2px(context, 50);
|
||||
}
|
||||
gameName.setPadding(0, 0, paddRight, 0);
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
SpeedUtils.getSpeed(downloadEntity.getSpeed()),
|
||||
SpeedUtils.getRemainTime(downloadEntity.getSize(), downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
|
||||
viewHolder.dmDelete.setVisibility(View.GONE);
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.detail_downloading_normal_style);
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
|
||||
viewHolder.dmStartorpause.setText("暂停");
|
||||
viewHolder.dmStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
viewHolder.dmSpeed.setText(downloadEntity.getPercent() + "%");
|
||||
@ -246,7 +246,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
|
||||
viewHolder.dmDelete.setVisibility(View.GONE);
|
||||
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.detail_downloading_normal_style);
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
|
||||
viewHolder.dmStartorpause.setText("暂停");
|
||||
viewHolder.dmStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
|
||||
@ -273,7 +273,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
|
||||
viewHolder.dmDelete.setVisibility(View.GONE);
|
||||
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.detail_downloading_normal_style);
|
||||
viewHolder.dmStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
|
||||
viewHolder.dmStartorpause.setText("暂停");
|
||||
viewHolder.dmStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
statusMap.put(url, "downloading");
|
||||
|
||||
@ -54,10 +54,10 @@ class GameEntity : Parcelable {
|
||||
@SerializedName("libao_exists")
|
||||
var isLibaoExists: Boolean = false
|
||||
|
||||
@SerializedName("server_type")
|
||||
var serverType: String? = null
|
||||
@SerializedName("server_remark")
|
||||
var serverRemark: String? = null
|
||||
|
||||
@SerializedName("server")
|
||||
@SerializedName("servers")
|
||||
var serverList: List<KaiFuCalendarEntity>? = null
|
||||
|
||||
var kaifuTimeHint: Long? = null
|
||||
@ -170,7 +170,7 @@ class GameEntity : Parcelable {
|
||||
dest.writeByte(if (this.isNewsExists) 1.toByte() else 0.toByte())
|
||||
dest.writeString(this.downloadOffText)
|
||||
dest.writeByte(if (this.isLibaoExists) 1.toByte() else 0.toByte())
|
||||
dest.writeString(this.serverType)
|
||||
dest.writeString(this.serverRemark)
|
||||
dest.writeValue(this.kaifuTimeHint)
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class GameEntity : Parcelable {
|
||||
this.isNewsExists = `in`.readByte().toInt() != 0
|
||||
this.downloadOffText = `in`.readString()
|
||||
this.isLibaoExists = `in`.readByte().toInt() != 0
|
||||
this.serverType = `in`.readString()
|
||||
this.serverRemark = `in`.readString()
|
||||
this.kaifuTimeHint = `in`.readValue(Long::class.java.classLoader) as Long?
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import android.view.View
|
||||
import com.gh.base.fragment.BaseFragment
|
||||
import com.gh.download.DownloadManager
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.databinding.FragmentGameBinding
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
@ -72,10 +73,9 @@ class GameFragment : BaseFragment<Any>() {
|
||||
})
|
||||
|
||||
mBinding?.gameRefresh?.setOnRefreshListener {
|
||||
mViewModel?.loadStatus?.postValue(LoadStatus.INIT_LOADING)
|
||||
mViewModel?.initData()
|
||||
}
|
||||
|
||||
mBinding?.gameRefresh?.isRefreshing
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,10 +17,7 @@ import com.gh.gamecenter.*
|
||||
import com.gh.gamecenter.adapter.ImagePagerAdapter
|
||||
import com.gh.gamecenter.adapter.viewholder.*
|
||||
import com.gh.gamecenter.baselist.LoadStatus
|
||||
import com.gh.gamecenter.databinding.GameHeadItemBinding
|
||||
import com.gh.gamecenter.databinding.GameHorizontalListBinding
|
||||
import com.gh.gamecenter.databinding.GameItemBinding
|
||||
import com.gh.gamecenter.databinding.GameViewpagerItemBinding
|
||||
import com.gh.gamecenter.databinding.*
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.halo.assistant.fragment.game.GamePluginAdapter
|
||||
@ -28,6 +25,7 @@ import com.halo.assistant.fragment.game.GamePluginViewHolder
|
||||
import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
|
||||
|
||||
@ -50,7 +48,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
|
||||
|
||||
fun setItemDataList(itemDataList: MutableList<ItemData>) {
|
||||
mItemDataList = itemDataList
|
||||
mItemDataList = itemDataList.toMutableList()
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@ -61,17 +59,17 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
if (position == 0) return ItemViewType.GAME_SLIDE
|
||||
if (itemCount == position + 1) return ItemViewType.LOADING
|
||||
|
||||
val itemData = mItemDataList[position]
|
||||
if (itemData.subjectDigest != null || itemData.slideList != null) return ItemViewType.GAME_SLIDE
|
||||
if (itemData.pluginList != null) return ItemViewType.GAME_PULGIN
|
||||
if (itemData.columnHead != null) return ItemViewType.COLUMN_HEADER
|
||||
if (itemData.game != null) return ItemViewType.GAME_NORMAL
|
||||
if (itemData.image != null) return ItemViewType.GAME_IMAGE
|
||||
if (itemData.horizontalColumn != null) return ItemViewType.GAME_SUBJECT
|
||||
|
||||
throw NullPointerException()
|
||||
return ItemViewType.LOADING
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder? {
|
||||
@ -91,9 +89,8 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
ItemViewType.GAME_NORMAL -> {
|
||||
GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
|
||||
}
|
||||
|
||||
ItemViewType.GAME_IMAGE -> {
|
||||
GameImageViewHolder(mLayoutInflater.inflate(R.layout.game_image_item, parent, false))
|
||||
GameImageViewHolder(GameImageItemBinding.bind(mLayoutInflater.inflate(R.layout.game_image_item, parent, false)))
|
||||
}
|
||||
ItemViewType.COLUMN_HEADER -> {
|
||||
GameHeadViewHolder(GameHeadItemBinding.bind(mLayoutInflater.inflate(R.layout.game_head_item, parent, false)))
|
||||
@ -116,7 +113,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
holder.binding.headMore.setOnClickListener({
|
||||
if ("all" == column?.home) {
|
||||
SubjectActivity.startSubjectActivity(mContext, column.id, column.name, column.isOrder, "(游戏-专题:" + column.name + "-全部)")
|
||||
} else{
|
||||
} else {
|
||||
holder.binding.headPb.visibility = View.VISIBLE
|
||||
mViewModel.changeSubjectGame(column?.id!!)
|
||||
}
|
||||
@ -195,7 +192,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
val subjectDigestList = mItemDataList[position].subjectDigest
|
||||
val binding = holder.binding
|
||||
binding.list = subjectDigestList
|
||||
binding.clickListener = OnViewClickListener { _, data ->
|
||||
binding.clickListener = OnViewClickListener { v, data ->
|
||||
if (data is Int) {
|
||||
when (data) {
|
||||
0, 1, 2, 3 -> {
|
||||
@ -212,6 +209,8 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
DataCollectionUtils.uploadPosition(mContext, "游戏", "4", "开服表")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,9 +289,12 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
ItemViewType.GAME_IMAGE -> {
|
||||
if (holder is GameImageViewHolder) {
|
||||
val entity = mItemDataList[position].image
|
||||
holder.binding.game = entity
|
||||
|
||||
val name = entity?.name
|
||||
val link = entity?.link
|
||||
holder.image.setOnClickListener(View.OnClickListener {
|
||||
ImageUtils.getInstance().display(holder.binding.gameImageIcon, entity?.image, mContext.resources.displayMetrics.widthPixels - DisplayUtils.dip2px(mContext, 16F))
|
||||
holder.binding.gameImageIcon.setOnClickListener({
|
||||
val kv = HashMap<String, Any>()
|
||||
kv["名字"] = name!!
|
||||
kv["位置"] = "大图"
|
||||
@ -338,7 +340,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel) : BaseRecycler
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mItemDataList.size + 1
|
||||
return if (mItemDataList.size > 0) mItemDataList.size + 1 else mItemDataList.size
|
||||
}
|
||||
|
||||
fun notifyItemByDownload(download: DownloadEntity) {
|
||||
|
||||
@ -33,7 +33,7 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
|
||||
var subjectList: MutableList<SubjectEntity> = ArrayList() // 专题
|
||||
var subjectDigestList: List<SubjectDigestEntity>? = null // 专题入口
|
||||
|
||||
var itemDataList: MutableLiveData<List<ItemData>> = MutableLiveData() // 轮播图
|
||||
var itemDataList: MutableLiveData<List<ItemData>> = MutableLiveData()
|
||||
|
||||
val loadStatus = MutableLiveData<LoadStatus>()
|
||||
|
||||
@ -53,10 +53,14 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
|
||||
}
|
||||
|
||||
fun initData() {
|
||||
slideList = null
|
||||
pluginList = null
|
||||
subjectList.clear()
|
||||
subjectDigestList = null
|
||||
|
||||
itemDataListCache.clear()
|
||||
loadStatus.postValue(LoadStatus.INIT_LOADED)
|
||||
getSlideData(true)
|
||||
initPlugin()
|
||||
}
|
||||
|
||||
fun initPlugin() {
|
||||
@ -130,11 +134,19 @@ class GameViewModel(application: Application) : AndroidViewModel(application) {
|
||||
.subscribe(object : Response<List<SubjectDigestEntity>>() {
|
||||
override fun onResponse(response: List<SubjectDigestEntity>) {
|
||||
subjectDigestList = response
|
||||
if (initData) getSubjectList(initData)
|
||||
transformationItemData()
|
||||
if (initData) {
|
||||
initPlugin()
|
||||
getSubjectList(initData)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException) {
|
||||
if (initData) getSubjectList(initData)
|
||||
transformationItemData()
|
||||
if (initData) {
|
||||
initPlugin()
|
||||
getSubjectList(initData)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -309,23 +309,14 @@ public class GameDetailFragment extends NormalFragment {
|
||||
}
|
||||
|
||||
int paddRight = 0;
|
||||
String serverType = mGameEntity.getServerType();
|
||||
if (TextUtils.isEmpty(serverType)) {
|
||||
String serverRemark = mGameEntity.getServerRemark();
|
||||
if (TextUtils.isEmpty(serverRemark)) {
|
||||
mServerType.setVisibility(View.GONE);
|
||||
} else {
|
||||
mServerType.setVisibility(View.VISIBLE);
|
||||
mServerType.setText(serverType);
|
||||
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
|
||||
mServerType.setBackgroundResource(R.drawable.textview_server_tag);
|
||||
if ("删档内测".equals(serverType)) {
|
||||
paddRight = DisplayUtils.dip2px(getContext(), 50);
|
||||
} else {
|
||||
paddRight = DisplayUtils.dip2px(getContext(), 60);
|
||||
}
|
||||
} else {
|
||||
mServerType.setBackgroundResource(R.drawable.textview_orange_up);
|
||||
paddRight = DisplayUtils.dip2px(getContext(), 30);
|
||||
}
|
||||
mServerType.setText(serverRemark);
|
||||
mServerType.setBackgroundResource(R.drawable.textview_orange_up);
|
||||
paddRight = DisplayUtils.dip2px(getContext(), 50);
|
||||
}
|
||||
mGameName.setPadding(0, 0, paddRight, 0);
|
||||
|
||||
|
||||
@ -215,7 +215,7 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
} else if (viewType == 1) {
|
||||
return new KaiFuTimeViewHolder(mLayoutInflater.inflate(R.layout.kaifu_item_time, parent, false));
|
||||
} else {
|
||||
return new GameTestViewHolder(mLayoutInflater.inflate(R.layout.game_test_item, parent, false));
|
||||
return new GameTestViewHolder(mLayoutInflater.inflate(R.layout.kaifu_game_item, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,6 +276,10 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
|
||||
remarkTv.setText(remark);
|
||||
remarkTv.setBackgroundColor(ContextCompat.getColor(mContext, R.color.tag_orange));
|
||||
}
|
||||
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.topMargin = DisplayUtils.dip2px(5);
|
||||
viewHolder.gameLabelList.addView(view, params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user