Commit 10e5860a authored by mengcuiguang's avatar mengcuiguang

代码优化

parent de953559
...@@ -103,6 +103,7 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean> ...@@ -103,6 +103,7 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 金币 // 金币
holder.itemTaskMoney.text = " " + taskBean.baseConfig.coinText holder.itemTaskMoney.text = " " + taskBean.baseConfig.coinText
// holder.itemTaskImg.setImageDrawable(mContext.resources.getDrawable(taskBean.imageSrc)) // holder.itemTaskImg.setImageDrawable(mContext.resources.getDrawable(taskBean.imageSrc))
if (taskBean.baseConfig.buttonText == null) { if (taskBean.baseConfig.buttonText == null) {
holder.itemTaskClick.visibility = View.GONE holder.itemTaskClick.visibility = View.GONE
} else { } else {
...@@ -140,26 +141,28 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean> ...@@ -140,26 +141,28 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
} }
} }
// 进度条 // otherConfig - 进度 进度条
if (taskBean.otherConfig != null) { if (taskBean.otherConfig != null) {
if (taskBean.baseConfig != null && taskBean.otherConfig.max != 0) {
// 判断进度最大值>0 展示进度和绿值
if (taskBean.otherConfig.max > 0) {
holder.itemTaskPb.visibility = View.VISIBLE holder.itemTaskPb.visibility = View.VISIBLE
holder.itemTaskPb.max = taskBean.otherConfig.max holder.itemTaskPb.max = taskBean.otherConfig.max
holder.itemTaskPb.progress = taskBean.otherConfig.complete holder.itemTaskPb.progress = taskBean.otherConfig.complete
} else {
holder.itemTaskPb.visibility = View.GONE // 展示进度条绿字
if (taskBean.baseConfig != null && taskBean.baseConfig.runingText != null) {
holder.itemTaskProgress.visibility = View.VISIBLE
holder.itemTaskProgress.text = taskBean.baseConfig.runingText
} }
} else { } else {
holder.itemTaskProgress.visibility = View.GONE
holder.itemTaskPb.visibility = View.GONE holder.itemTaskPb.visibility = View.GONE
holder.itemTaskProgress.visibility = View.GONE
} }
if (taskBean.baseConfig.runingText != null) {
holder.itemTaskProgress.visibility = View.VISIBLE
holder.itemTaskProgress.text = taskBean.baseConfig.runingText
} else { } else {
holder.itemTaskProgress.visibility = View.GONE holder.itemTaskProgress.visibility = View.GONE
holder.itemTaskPb.visibility = View.GONE
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment