|
|
@@ -1,6 +1,7 @@
|
|
|
package com.grkj.iscs_mc.view.fragment
|
|
|
|
|
|
import android.view.View
|
|
|
+import com.bumptech.glide.Glide
|
|
|
import com.grkj.iscs_mc.R
|
|
|
import com.grkj.iscs_mc.databinding.FragmentMaterialReplacementBinding
|
|
|
import com.grkj.iscs_mc.extentions.navigateTo
|
|
|
@@ -39,7 +40,12 @@ class MaterialReplacementFragment :
|
|
|
vo: ManualReplacementListRespVO.MaterialsPageVO,
|
|
|
position: Int
|
|
|
) {
|
|
|
- holder.setText(R.id.tv_name, vo.materialsName?:"")
|
|
|
+ holder.setText(R.id.tv_name, vo.materialsName ?: "")
|
|
|
+ holder.setText(R.id.tv_rfid, vo.materialsRfid ?: "")
|
|
|
+ Glide.with(this@MaterialReplacementFragment).load(vo.materialsTypePicture).into(holder.getView(R.id.iv_icon))
|
|
|
+ holder.setText(R.id.tv_tip, getStatusStr(vo.status))
|
|
|
+ holder.setBackgroundRes(R.id.ll_tip, getStatusColor(vo.status))
|
|
|
+ holder.setImageResource(R.id.iv_tip, getStatusIcon(vo.status))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -79,6 +85,33 @@ class MaterialReplacementFragment :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ fun getStatusStr(status: String?): String {
|
|
|
+ return when (status) {
|
|
|
+ "0" -> getString(R.string.normal)
|
|
|
+ "1" -> getString(R.string.expired)
|
|
|
+ "2" -> getString(R.string.damaged)
|
|
|
+ else -> ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun getStatusColor(status: String?): Int {
|
|
|
+ return when (status) {
|
|
|
+ "0" -> R.color.common_btn_green_bg
|
|
|
+ "1" -> R.color.common_btn_yellow_bg
|
|
|
+ "2" -> R.color.common_btn_red_bg
|
|
|
+ else -> R.color.main_color
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fun getStatusIcon(status: String?): Int {
|
|
|
+ return when (status) {
|
|
|
+ "0" -> R.mipmap.ok_normal
|
|
|
+ "1" -> R.mipmap.expired_normal
|
|
|
+ "2" -> R.mipmap.damaged_normal
|
|
|
+ else -> R.mipmap.ok_normal
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override fun initPresenter(): MaterialReplacementPresenter {
|
|
|
return MaterialReplacementPresenter()
|
|
|
}
|