|
@@ -3,96 +3,73 @@ package com.wdkl.app.ncs.callingdoor.adapter
|
|
|
import android.content.Context
|
|
|
import android.graphics.Color
|
|
|
import android.graphics.drawable.Drawable
|
|
|
-import android.os.Build
|
|
|
import android.support.v7.widget.RecyclerView
|
|
|
import android.text.TextUtils
|
|
|
import android.util.Log
|
|
|
+import android.view.Gravity
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
+import android.view.animation.AlphaAnimation
|
|
|
+import android.view.animation.Animation
|
|
|
+import android.view.animation.LinearInterpolator
|
|
|
import android.widget.ImageView
|
|
|
import android.widget.LinearLayout
|
|
|
import android.widget.TextView
|
|
|
+import com.bumptech.glide.Glide
|
|
|
+import com.bumptech.glide.load.engine.DiskCacheStrategy
|
|
|
import com.wdkl.app.ncs.callingdoor.R
|
|
|
+import com.wdkl.ncs.android.lib.utils.DensityUtils
|
|
|
import com.wdkl.ncs.android.middleware.common.Constant
|
|
|
import com.wdkl.ncs.android.middleware.model.dto.NurseConfigDto
|
|
|
import com.wdkl.ncs.android.middleware.model.vo.FrameBedVO
|
|
|
import com.wdkl.ncs.android.middleware.utils.CommonUtils
|
|
|
-import com.wdkl.ncs.android.middleware.utils.StringUtil
|
|
|
|
|
|
class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
|
|
|
|
|
|
private var context: Context
|
|
|
private var data: ArrayList<FrameBedVO>
|
|
|
private var configList = ArrayList<NurseConfigDto>()
|
|
|
+ private var flickBedNames = ArrayList<String>()
|
|
|
|
|
|
private var drawableMale: Drawable
|
|
|
private var drawableFemale: Drawable
|
|
|
private var drawableEmpty: Drawable
|
|
|
- private var iconMale: Drawable
|
|
|
- private var iconFemale: Drawable
|
|
|
+ //private var iconMale: Drawable
|
|
|
+ //private var iconFemale: Drawable
|
|
|
|
|
|
constructor(context: Context, data: ArrayList<FrameBedVO>) {
|
|
|
this.context = context
|
|
|
this.data = data
|
|
|
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty2)
|
|
|
- drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
|
|
|
- drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male2)
|
|
|
- drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
|
|
|
- drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female2)
|
|
|
- drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
|
|
|
- iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male2)
|
|
|
- iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
|
|
|
- iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female2)
|
|
|
- iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
|
|
|
- } else {
|
|
|
- drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty)
|
|
|
- drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
|
|
|
- drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male)
|
|
|
- drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
|
|
|
- drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female)
|
|
|
- drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
|
|
|
- iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male)
|
|
|
- iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
|
|
|
- iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female)
|
|
|
- iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
|
|
|
- }
|
|
|
+ drawableEmpty = context.resources.getDrawable(R.mipmap.ic_custom_empty)
|
|
|
+ drawableEmpty.setBounds(0, 0, drawableEmpty.minimumWidth, drawableEmpty.minimumHeight)
|
|
|
+ drawableMale = context.resources.getDrawable(R.mipmap.ic_custom_male)
|
|
|
+ drawableMale.setBounds(0, 0, drawableMale.minimumWidth, drawableMale.minimumHeight)
|
|
|
+ drawableFemale = context.resources.getDrawable(R.mipmap.ic_custom_female)
|
|
|
+ drawableFemale.setBounds(0, 0, drawableFemale.minimumWidth, drawableFemale.minimumHeight)
|
|
|
+ //iconMale = context.resources.getDrawable(R.mipmap.ic_gender_male)
|
|
|
+ //iconMale.setBounds(0, 0, iconMale.minimumWidth, iconMale.minimumHeight)
|
|
|
+ //iconFemale = context.resources.getDrawable(R.mipmap.ic_gender_female)
|
|
|
+ //iconFemale.setBounds(0, 0, iconFemale.minimumWidth, iconFemale.minimumHeight)
|
|
|
}
|
|
|
|
|
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): BedViewHolder {
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- if (Constant.DEVICE_HEIGHT == 1280 && Constant.DEVICE_WIDTH == 800) {
|
|
|
- val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed_rk3288_800, parent, false)
|
|
|
- return BedViewHolder(view)
|
|
|
- } else {
|
|
|
- val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed_rk3288, parent, false)
|
|
|
- return BedViewHolder(view)
|
|
|
- }
|
|
|
- } else {
|
|
|
- val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed, parent, false)
|
|
|
- return BedViewHolder(view)
|
|
|
- }
|
|
|
+ val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_bed, parent, false)
|
|
|
+ return BedViewHolder(view)
|
|
|
}
|
|
|
|
|
|
override fun onBindViewHolder(holder: BedViewHolder, position: Int) {
|
|
|
try {
|
|
|
- initDefaultNursingConfigs()
|
|
|
val pos = position % data.size
|
|
|
-
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- showBedInfoRk3288(holder, data.get(pos))
|
|
|
- } else {
|
|
|
- showBedInfo(holder, data.get(pos))
|
|
|
- }
|
|
|
+ showBedInfo(holder, data.get(pos))
|
|
|
} catch (e: Exception) {
|
|
|
e.printStackTrace()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun getItemCount(): Int {
|
|
|
- if (data.size <= 3) {
|
|
|
+ if (data.size <= 2) {
|
|
|
return data.size
|
|
|
} else {
|
|
|
return Int.MAX_VALUE
|
|
@@ -104,286 +81,187 @@ class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
|
|
|
notifyDataSetChanged()
|
|
|
}
|
|
|
|
|
|
- private fun initDefaultNursingConfigs() {
|
|
|
- //初始化默认护理项
|
|
|
- configList.clear()
|
|
|
- for (index in 1..5) {
|
|
|
- var item = NurseConfigDto()
|
|
|
- item.nurseConfigName = StringUtil.getResString(R.string.default_nurse_config_name)
|
|
|
- item.nurseOptionName = StringUtil.getResString(R.string.str_empty)
|
|
|
- item.nurseColorRbg = "D7D7D7"
|
|
|
- configList.add(item)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private fun showBedInfo(holder: BedViewHolder, bedVO: FrameBedVO) {
|
|
|
- holder.bedName.text = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
|
|
|
- if (TextUtils.isEmpty(bedVO.cardNo)) {
|
|
|
- holder.cardNo.text = ""
|
|
|
- } else {
|
|
|
- holder.cardNo.text = StringUtil.getResString(R.string.card_no) + bedVO.cardNo
|
|
|
- }
|
|
|
-
|
|
|
- if (TextUtils.isEmpty(bedVO.customerName)) {
|
|
|
- //空床位
|
|
|
- holder.customName.setText(R.string.str_empty)
|
|
|
- holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
|
|
|
- holder.customAge.visibility = View.GONE
|
|
|
- holder.doctorIcon.visibility = View.GONE
|
|
|
- holder.doctorTitle.visibility = View.GONE
|
|
|
- holder.doctorName.visibility = View.GONE
|
|
|
- holder.nurseIcon.visibility = View.GONE
|
|
|
- holder.nurseTitle.visibility = View.GONE
|
|
|
- holder.nurseName.visibility = View.GONE
|
|
|
- } else {
|
|
|
- //有入住
|
|
|
- holder.customName.text = bedVO.customerName
|
|
|
- holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
|
|
|
- holder.customAge.visibility = View.VISIBLE
|
|
|
- holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
- if (bedVO.customerSex == 0) {
|
|
|
- holder.customName.setCompoundDrawables(null, drawableFemale, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
|
|
|
- } else if (bedVO.customerSex == 1) {
|
|
|
- holder.customName.setCompoundDrawables(null, drawableMale, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(iconMale, null, null, null)
|
|
|
- } else {
|
|
|
- holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(null, null, null, null)
|
|
|
- }
|
|
|
- holder.doctorName.text = bedVO.doctorName
|
|
|
- holder.nurseName.text = bedVO.nurseName
|
|
|
-
|
|
|
- if (!TextUtils.isEmpty(Constant.doctorTitle)) {
|
|
|
- holder.doctorTitle.text = Constant.doctorTitle
|
|
|
+ try {
|
|
|
+ val name = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
|
|
|
+ holder.bedName.text = name
|
|
|
+ if (TextUtils.isEmpty(bedVO.cardNo)) {
|
|
|
+ holder.cardNo.text = ""
|
|
|
} else {
|
|
|
- holder.doctorTitle.setText(R.string.doctor_title)
|
|
|
+ holder.cardNo.text = "住院号: " + bedVO.cardNo
|
|
|
}
|
|
|
|
|
|
- if (!TextUtils.isEmpty(Constant.nurseTitle)) {
|
|
|
- holder.nurseTitle.text = Constant.nurseTitle
|
|
|
+ //检查是否有呼叫,更新背景动画效果
|
|
|
+ if (flickBedNames.contains(name)) {
|
|
|
+ Log.e("showBed", "show animator: $name")
|
|
|
+ holder.bedItem.setBackgroundResource(R.color.bed_light_color)
|
|
|
+ holder.bedName.setTextColor(Color.parseColor("#FFFD3B30"))
|
|
|
+ startAnimator(holder.bedName)
|
|
|
} else {
|
|
|
- holder.nurseTitle.setText(R.string.nurse_title)
|
|
|
+ Log.e("showBed", "clear animator: $name")
|
|
|
+ holder.bedItem.setBackgroundResource(R.color.right_item_select)
|
|
|
+ holder.bedName.setTextColor(Color.parseColor("#2F9DF1"))
|
|
|
+ clearAnimator(holder.bedName)
|
|
|
}
|
|
|
|
|
|
- if (Constant.doctorValid == 1) {
|
|
|
- holder.doctorIcon.visibility = View.VISIBLE
|
|
|
- holder.doctorTitle.visibility = View.VISIBLE
|
|
|
- holder.doctorName.visibility = View.VISIBLE
|
|
|
+ /*if (data.size == 1) {
|
|
|
+ val layoutParams = LinearLayout.LayoutParams(DensityUtils.dp2px(context, 392f), ViewGroup.LayoutParams.MATCH_PARENT)
|
|
|
+ layoutParams.setMargins(214, 4, 4, 4)
|
|
|
+ layoutParams.gravity = Gravity.CENTER
|
|
|
+ holder.bedItem.setLayoutParams(layoutParams)
|
|
|
} else {
|
|
|
+ val layoutParams = LinearLayout.LayoutParams(DensityUtils.dp2px(context, 392f), ViewGroup.LayoutParams.MATCH_PARENT)
|
|
|
+ layoutParams.setMargins(4, 4, 4, 4)
|
|
|
+ layoutParams.gravity = Gravity.CENTER
|
|
|
+ holder.bedItem.setLayoutParams(layoutParams)
|
|
|
+ }*/
|
|
|
+
|
|
|
+ if (TextUtils.isEmpty(bedVO.customerName)) {
|
|
|
+ //空床位
|
|
|
+ holder.customName.setText("空床位")
|
|
|
+ //holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
|
|
|
+ holder.customAge.visibility = View.GONE
|
|
|
holder.doctorIcon.visibility = View.GONE
|
|
|
holder.doctorTitle.visibility = View.GONE
|
|
|
holder.doctorName.visibility = View.GONE
|
|
|
- }
|
|
|
-
|
|
|
- if (Constant.nurseValid == 1) {
|
|
|
- holder.nurseIcon.visibility = View.VISIBLE
|
|
|
- holder.nurseTitle.visibility = View.VISIBLE
|
|
|
- holder.nurseName.visibility = View.VISIBLE
|
|
|
- } else {
|
|
|
holder.nurseIcon.visibility = View.GONE
|
|
|
holder.nurseTitle.visibility = View.GONE
|
|
|
holder.nurseName.visibility = View.GONE
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ //有入住
|
|
|
+ holder.customName.text = bedVO.customerName
|
|
|
+ //holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
|
|
|
+ holder.customAge.visibility = View.VISIBLE
|
|
|
+ //holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
+ if (bedVO.customerSex == 0) {
|
|
|
+ //holder.customName.setCompoundDrawables(drawableFemale, null, null, null)
|
|
|
+ //holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
|
|
|
+ holder.customAge.text = "女 " + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
+ } else if (bedVO.customerSex == 1) {
|
|
|
+ //holder.customName.setCompoundDrawables(drawableMale, null, null, null)
|
|
|
+ //holder.customAge.setCompoundDrawables(iconMale, null, null, null)
|
|
|
+ holder.customAge.text = "男 " + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
+ } else {
|
|
|
+ //holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
|
|
|
+ //holder.customAge.setCompoundDrawables(null, null, null, null)
|
|
|
+ holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
+ }
|
|
|
+ holder.doctorName.text = bedVO.doctorName
|
|
|
+ holder.nurseName.text = bedVO.nurseName
|
|
|
|
|
|
- val nursingConfigs = bedVO.nurseConfigDtos
|
|
|
- if (nursingConfigs != null && nursingConfigs.size > 0) {
|
|
|
- for ((index, e) in nursingConfigs.withIndex()) {
|
|
|
- if (index < configList.size) {
|
|
|
- configList.set(index, e)
|
|
|
- } else {
|
|
|
- configList.add(e)
|
|
|
- }
|
|
|
+ if (!TextUtils.isEmpty(Constant.doctorTitle)) {
|
|
|
+ holder.doctorTitle.text = Constant.doctorTitle
|
|
|
+ } else {
|
|
|
+ holder.doctorTitle.setText("责任医生")
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(Constant.nurseTitle)) {
|
|
|
+ holder.nurseTitle.text = Constant.nurseTitle
|
|
|
+ } else {
|
|
|
+ holder.nurseTitle.setText("责任护士")
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtil.notEmpty(configList[0].nurseColorRbg)) {
|
|
|
- holder.nursingColor1.setBackgroundColor(Color.parseColor("#" + configList[0].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor1.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName1.setText(configList[0].nurseConfigName)
|
|
|
- holder.nursingValue1.setText(configList[0].nurseOptionName)
|
|
|
+ if (Constant.doctorValid == 1) {
|
|
|
+ holder.doctorIcon.visibility = View.VISIBLE
|
|
|
+ holder.doctorTitle.visibility = View.VISIBLE
|
|
|
+ holder.doctorName.visibility = View.VISIBLE
|
|
|
+
|
|
|
+ Glide.with(context)
|
|
|
+ .load(bedVO.doctorFace)
|
|
|
+ //.skipMemoryCache(true)
|
|
|
+ .diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
|
+ .placeholder(R.mipmap.doctor_default)//占位图
|
|
|
+ .into(holder.doctorIcon)
|
|
|
+ } else {
|
|
|
+ holder.doctorIcon.visibility = View.GONE
|
|
|
+ holder.doctorTitle.visibility = View.GONE
|
|
|
+ holder.doctorName.visibility = View.GONE
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtil.notEmpty(configList[1].nurseColorRbg)) {
|
|
|
- holder.nursingColor2.setBackgroundColor(Color.parseColor("#" + configList[1].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor2.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
+ if (Constant.nurseValid == 1) {
|
|
|
+ holder.nurseIcon.visibility = View.VISIBLE
|
|
|
+ holder.nurseTitle.visibility = View.VISIBLE
|
|
|
+ holder.nurseName.visibility = View.VISIBLE
|
|
|
+
|
|
|
+ Glide.with(context)
|
|
|
+ .load(bedVO.nurseFace)
|
|
|
+ //.skipMemoryCache(true)
|
|
|
+ .diskCacheStrategy(DiskCacheStrategy.NONE)
|
|
|
+ .placeholder(R.mipmap.nurse_default)//占位图
|
|
|
+ .into(holder.nurseIcon)
|
|
|
+ } else {
|
|
|
+ holder.nurseIcon.visibility = View.GONE
|
|
|
+ holder.nurseTitle.visibility = View.GONE
|
|
|
+ holder.nurseName.visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
- holder.nursingName2.setText(configList[1].nurseConfigName)
|
|
|
- holder.nursingValue2.setText(configList[1].nurseOptionName)
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtil.notEmpty(configList[2].nurseColorRbg)) {
|
|
|
- holder.nursingColor3.setBackgroundColor(Color.parseColor("#" + configList[2].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor3.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
+ override fun onViewRecycled(holder: BedViewHolder?) {
|
|
|
+ if (holder != null) {
|
|
|
+ Glide.clear(holder.doctorIcon)
|
|
|
+ Glide.clear(holder.nurseIcon)
|
|
|
}
|
|
|
- holder.nursingName3.setText(configList[2].nurseConfigName)
|
|
|
- holder.nursingValue3.setText(configList[2].nurseOptionName)
|
|
|
+ super.onViewRecycled(holder)
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtil.notEmpty(configList[3].nurseColorRbg)) {
|
|
|
- holder.nursingColor4.setBackgroundColor(Color.parseColor("#" + configList[3].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor4.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName4.setText(configList[3].nurseConfigName)
|
|
|
- holder.nursingValue4.setText(configList[3].nurseOptionName)
|
|
|
+ private fun startAnimator(view: View) {
|
|
|
+ /*val animator: ValueAnimator = ObjectAnimator.ofInt(view, "backgroundColor", 0x22ff0000, 0x77ff0000) //对背景色颜色进行改变,操作的属性为"backgroundColor",此处必须这样写,不能全小写,后面的颜色为在对应颜色间进行渐变
|
|
|
+ animator.duration = 1500
|
|
|
+ animator.repeatCount = ValueAnimator.INFINITE //表示重复多次
|
|
|
+ animator.repeatMode = ValueAnimator.REVERSE //表示动画结束后,反过来再执行;RESTART表示从头开始,REVERSE表示从末尾倒播
|
|
|
+ animator.setEvaluator(ArgbEvaluator()) //如果要颜色渐变必须要ArgbEvaluator,来实现颜色之间的平滑变化,否则会出现颜色不规则跳动
|
|
|
+ animator.start()*/
|
|
|
+
|
|
|
+
|
|
|
+ val alphaAnimation = AlphaAnimation(1.0f, 0.1f)
|
|
|
+ alphaAnimation.duration = 1500
|
|
|
+ alphaAnimation.interpolator = LinearInterpolator()
|
|
|
+ alphaAnimation.repeatCount = Animation.INFINITE //表示重复多次
|
|
|
+ alphaAnimation.repeatMode = Animation.REVERSE //表示动画结束后,反过来再执行;RESTART表示从头开始,REVERSE表示从末尾倒播
|
|
|
+ view.startAnimation(alphaAnimation)
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtil.notEmpty(configList[4].nurseColorRbg)) {
|
|
|
- holder.nursingColor5.setBackgroundColor(Color.parseColor("#" + configList[4].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor5.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName5.setText(configList[4].nurseConfigName)
|
|
|
- holder.nursingValue5.setText(configList[4].nurseOptionName)
|
|
|
+ private fun clearAnimator(view: View) {
|
|
|
+ view.clearAnimation()
|
|
|
}
|
|
|
|
|
|
- private fun showBedInfoRk3288(holder: BedViewHolder, bedVO: FrameBedVO) {
|
|
|
- holder.bedName.text = CommonUtils.subStringAfter(bedVO.frameBed.fullName, "-")
|
|
|
- if (TextUtils.isEmpty(bedVO.cardNo)) {
|
|
|
- holder.cardNo.text = ""
|
|
|
- } else {
|
|
|
- holder.cardNo.text = StringUtil.getResString(R.string.card_no) + bedVO.cardNo
|
|
|
+ fun addFlickBedItem(name: String) {
|
|
|
+ synchronized(flickBedNames) {
|
|
|
+ flickBedNames.add(name)
|
|
|
+ notifyDataSetChanged()
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if (TextUtils.isEmpty(bedVO.customerName)) {
|
|
|
- //空床位
|
|
|
- holder.customName.setText(R.string.str_empty)
|
|
|
- holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
|
|
|
- holder.customAge.visibility = View.GONE
|
|
|
- holder.doctorIcon.visibility = View.GONE
|
|
|
- holder.doctorTitle.visibility = View.GONE
|
|
|
- holder.doctorName.visibility = View.GONE
|
|
|
- holder.nurseIcon.visibility = View.GONE
|
|
|
- holder.nurseTitle.visibility = View.GONE
|
|
|
- holder.nurseName.visibility = View.GONE
|
|
|
- } else {
|
|
|
- //有入住
|
|
|
- holder.customName.text = bedVO.customerName
|
|
|
- holder.customName.setCompoundDrawables(null, drawableEmpty, null, null)
|
|
|
- holder.customAge.visibility = View.VISIBLE
|
|
|
- holder.customAge.text = "" + bedVO.customerAge + bedVO.customerAgeUnit
|
|
|
- if (bedVO.customerSex == 0) {
|
|
|
- holder.customName.setCompoundDrawables(drawableFemale, null, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(iconFemale, null, null, null)
|
|
|
- } else if (bedVO.customerSex == 1) {
|
|
|
- holder.customName.setCompoundDrawables(drawableMale, null, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(iconMale, null, null, null)
|
|
|
- } else {
|
|
|
- holder.customName.setCompoundDrawables(drawableEmpty, null, null, null)
|
|
|
- holder.customAge.setCompoundDrawables(null, null, null, null)
|
|
|
- }
|
|
|
- holder.doctorName.text = bedVO.doctorName
|
|
|
- holder.nurseName.text = bedVO.nurseName
|
|
|
-
|
|
|
- if (!TextUtils.isEmpty(Constant.doctorTitle)) {
|
|
|
- holder.doctorTitle.text = Constant.doctorTitle
|
|
|
- } else {
|
|
|
- holder.doctorTitle.setText(R.string.doctor_title)
|
|
|
- }
|
|
|
-
|
|
|
- if (!TextUtils.isEmpty(Constant.nurseTitle)) {
|
|
|
- holder.nurseTitle.text = Constant.nurseTitle
|
|
|
- } else {
|
|
|
- holder.nurseTitle.setText(R.string.nurse_title)
|
|
|
- }
|
|
|
-
|
|
|
- if (Constant.doctorValid == 1) {
|
|
|
- holder.doctorIcon.visibility = View.VISIBLE
|
|
|
- holder.doctorTitle.visibility = View.VISIBLE
|
|
|
- holder.doctorName.visibility = View.VISIBLE
|
|
|
- } else {
|
|
|
- holder.doctorIcon.visibility = View.GONE
|
|
|
- holder.doctorTitle.visibility = View.GONE
|
|
|
- holder.doctorName.visibility = View.GONE
|
|
|
- }
|
|
|
-
|
|
|
- if (Constant.nurseValid == 1) {
|
|
|
- holder.nurseIcon.visibility = View.VISIBLE
|
|
|
- holder.nurseTitle.visibility = View.VISIBLE
|
|
|
- holder.nurseName.visibility = View.VISIBLE
|
|
|
- } else {
|
|
|
- holder.nurseIcon.visibility = View.GONE
|
|
|
- holder.nurseTitle.visibility = View.GONE
|
|
|
- holder.nurseName.visibility = View.GONE
|
|
|
- }
|
|
|
-
|
|
|
- val nursingConfigs = bedVO.nurseConfigDtos
|
|
|
- if (nursingConfigs != null && nursingConfigs.size > 0) {
|
|
|
- for ((index, e) in nursingConfigs.withIndex()) {
|
|
|
- if (index < configList.size) {
|
|
|
- configList.set(index, e)
|
|
|
- } else {
|
|
|
- configList.add(e)
|
|
|
+ fun removeFlickBedItem(name: String) {
|
|
|
+ synchronized(flickBedNames) {
|
|
|
+ if (flickBedNames.size > 0) {
|
|
|
+ val iterator = flickBedNames.iterator()
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ val it = iterator.next()
|
|
|
+ if (it == name) {
|
|
|
+ iterator.remove()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ notifyDataSetChanged()
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- if (StringUtil.notEmpty(configList[0].nurseColorRbg)) {
|
|
|
- holder.nursingColor1.setBackgroundColor(Color.parseColor("#" + configList[0].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor1.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName1.setText(configList[0].nurseConfigName)
|
|
|
- holder.nursingValue1.setText(configList[0].nurseOptionName)
|
|
|
-
|
|
|
- if (StringUtil.notEmpty(configList[1].nurseColorRbg)) {
|
|
|
- holder.nursingColor2.setBackgroundColor(Color.parseColor("#" + configList[1].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor2.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName2.setText(configList[1].nurseConfigName)
|
|
|
- holder.nursingValue2.setText(configList[1].nurseOptionName)
|
|
|
-
|
|
|
- if (StringUtil.notEmpty(configList[2].nurseColorRbg)) {
|
|
|
- holder.nursingColor3.setBackgroundColor(Color.parseColor("#" + configList[2].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor3.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName3.setText(configList[2].nurseConfigName)
|
|
|
- holder.nursingValue3.setText(configList[2].nurseOptionName)
|
|
|
-
|
|
|
- if (StringUtil.notEmpty(configList[3].nurseColorRbg)) {
|
|
|
- holder.nursingColor4.setBackgroundColor(Color.parseColor("#" + configList[3].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor4.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
- }
|
|
|
- holder.nursingName4.setText(configList[3].nurseConfigName)
|
|
|
- holder.nursingValue4.setText(configList[3].nurseOptionName)
|
|
|
-
|
|
|
- if (StringUtil.notEmpty(configList[4].nurseColorRbg)) {
|
|
|
- holder.nursingColor5.setBackgroundColor(Color.parseColor("#" + configList[4].nurseColorRbg))
|
|
|
- } else {
|
|
|
- holder.nursingColor5.setBackgroundColor(Color.parseColor("#D7D7D7"))
|
|
|
+ fun resetFlickBedItems() {
|
|
|
+ synchronized(flickBedNames) {
|
|
|
+ flickBedNames.clear()
|
|
|
+ notifyDataSetChanged()
|
|
|
}
|
|
|
- holder.nursingName5.setText(configList[4].nurseConfigName)
|
|
|
- holder.nursingValue5.setText(configList[4].nurseOptionName)
|
|
|
}
|
|
|
|
|
|
class BedViewHolder: RecyclerView.ViewHolder {
|
|
|
+ var bedItem : LinearLayout
|
|
|
var bedName : TextView
|
|
|
var cardNo : TextView
|
|
|
- var nursingColor1 : View
|
|
|
- var nursingName1 : TextView
|
|
|
- var nursingValue1 : TextView
|
|
|
- var nursingColor2 : View
|
|
|
- var nursingName2 : TextView
|
|
|
- var nursingValue2 : TextView
|
|
|
- var nursingColor3 : View
|
|
|
- var nursingName3 : TextView
|
|
|
- var nursingValue3 : TextView
|
|
|
- var nursingColor4 : View
|
|
|
- var nursingName4 : TextView
|
|
|
- var nursingValue4 : TextView
|
|
|
- var nursingColor5 : View
|
|
|
- var nursingName5 : TextView
|
|
|
- var nursingValue5 : TextView
|
|
|
- var nursingView : LinearLayout
|
|
|
-
|
|
|
|
|
|
var customName : TextView
|
|
|
var customAge : TextView
|
|
@@ -395,24 +273,9 @@ class FrameRoomAdapter : RecyclerView.Adapter<FrameRoomAdapter.BedViewHolder> {
|
|
|
var nurseName : TextView
|
|
|
|
|
|
constructor(itemView: View): super(itemView) {
|
|
|
+ bedItem = itemView.findViewById(R.id.ll_item_bed)
|
|
|
bedName = itemView.findViewById(R.id.tv_bed_name_title)
|
|
|
cardNo = itemView.findViewById(R.id.tv_bed_card_no)
|
|
|
- nursingColor1 = itemView.findViewById(R.id.nurse_config_item_color1)
|
|
|
- nursingName1 = itemView.findViewById(R.id.nurse_config_item_name1)
|
|
|
- nursingValue1 = itemView.findViewById(R.id.nurse_config_item_value1)
|
|
|
- nursingColor2 = itemView.findViewById(R.id.nurse_config_item_color2)
|
|
|
- nursingName2 = itemView.findViewById(R.id.nurse_config_item_name2)
|
|
|
- nursingValue2 = itemView.findViewById(R.id.nurse_config_item_value2)
|
|
|
- nursingColor3 = itemView.findViewById(R.id.nurse_config_item_color3)
|
|
|
- nursingName3 = itemView.findViewById(R.id.nurse_config_item_name3)
|
|
|
- nursingValue3 = itemView.findViewById(R.id.nurse_config_item_value3)
|
|
|
- nursingColor4 = itemView.findViewById(R.id.nurse_config_item_color4)
|
|
|
- nursingName4 = itemView.findViewById(R.id.nurse_config_item_name4)
|
|
|
- nursingValue4 = itemView.findViewById(R.id.nurse_config_item_value4)
|
|
|
- nursingColor5 = itemView.findViewById(R.id.nurse_config_item_color5)
|
|
|
- nursingName5 = itemView.findViewById(R.id.nurse_config_item_name5)
|
|
|
- nursingValue5 = itemView.findViewById(R.id.nurse_config_item_value5)
|
|
|
- nursingView = itemView.findViewById(R.id.ll_nurse_configs)
|
|
|
|
|
|
customName = itemView.findViewById(R.id.bed_customer_name)
|
|
|
customAge = itemView.findViewById(R.id.bed_customer_age)
|