|
@@ -25,7 +25,6 @@ import com.yingyangfly.baselib.utils.RxBusCodes
|
|
|
import com.yingyangfly.baselib.utils.User
|
|
|
import com.yingyangfly.evaluation.R
|
|
|
import com.yingyangfly.evaluation.databinding.ActivityHospitalBinding
|
|
|
-import com.yingyangfly.evaluation.entity.SlideshowBean
|
|
|
import com.youth.banner.indicator.RectangleIndicator
|
|
|
|
|
|
|
|
@@ -37,8 +36,9 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
View.OnTouchListener {
|
|
|
|
|
|
private lateinit var adapterGuide: GuidePageAdapter
|
|
|
- private var imageList = mutableListOf<SlideshowBean>()
|
|
|
+ private var imageList = mutableListOf<String>()
|
|
|
|
|
|
+ private var snCode = ""
|
|
|
private var reviewTaskId = ""
|
|
|
private var taskId = ""
|
|
|
|
|
@@ -76,14 +76,6 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
|
|
|
override fun initData() {
|
|
|
initLiveData()
|
|
|
- PermissionList.readPhoneState.check(this) {
|
|
|
- binding.tvSnCode.text = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
|
- "终端号:" + Build.getSerial()
|
|
|
- } else {
|
|
|
- "终端号:" + Build.SERIAL
|
|
|
- }
|
|
|
- getSlideShowList()
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private fun initLiveData() {
|
|
@@ -112,10 +104,8 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
val voicePlayerDao = db?.getVoicePlayerDao()
|
|
|
if (voicePlayerDao != null) {
|
|
|
val voicePlayerBean = voicePlayerDao.getVoicePlayerBean(desn)
|
|
|
- if (voicePlayerBean != null) {
|
|
|
- if (voicePlayer != null) {
|
|
|
- voicePlayer?.play(voicePlayerBean.url) {}
|
|
|
- }
|
|
|
+ if (voicePlayerBean != null && voicePlayer != null) {
|
|
|
+ voicePlayer?.play(voicePlayerBean.url) {}
|
|
|
} else {
|
|
|
getVoiceUrl(desn)
|
|
|
}
|
|
@@ -201,6 +191,7 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
if (TextUtils.isEmpty(User.getToken())) {
|
|
@@ -210,6 +201,17 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
binding.imageLoginOut.show(true)
|
|
|
binding.tvLoginOut.show(true)
|
|
|
}
|
|
|
+ PermissionList.readPhoneState.check(this) {
|
|
|
+ snCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
|
+ Build.getSerial()
|
|
|
+ } else {
|
|
|
+ Build.SERIAL
|
|
|
+ }
|
|
|
+ binding.tvSnCode.text = "终端号:$snCode"
|
|
|
+ if (TextUtils.isEmpty(snCode).not()) {
|
|
|
+ getSlideShowList()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -217,22 +219,29 @@ class HospitalActivity : BaseTvMVVMActivity<ActivityHospitalBinding, HospitalVie
|
|
|
*/
|
|
|
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
|
|
|
private fun getSlideShowList() {
|
|
|
- viewModel.getSlideShowList(Build.SERIAL, fail = {
|
|
|
+ viewModel.getSlideShowList(snCode, fail = {
|
|
|
it.toast()
|
|
|
}, success = {
|
|
|
imageList.clear()
|
|
|
if (it != null) {
|
|
|
- if (it.slideshows.isNullOrEmpty().not()) {
|
|
|
- val data = it.slideshows[0]
|
|
|
- binding.guide.setLoopTime(data.speed.toLong())
|
|
|
- imageList.addAll(it.slideshows)
|
|
|
+ if (it.slideshow != null) {
|
|
|
+ it.slideshow.let {
|
|
|
+ binding.guide.setLoopTime(it.speed * 1000)
|
|
|
+ if (it.imgUrl.contains(",")) {
|
|
|
+ val data = it.imgUrl.split(",")
|
|
|
+ imageList.addAll(data)
|
|
|
+ } else {
|
|
|
+ imageList.add(it.imgUrl)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(it.logo).not()) {
|
|
|
+ GlideImgUtil.loadImgHeadCircle(mContext, it.logo, binding.hospitalImage)
|
|
|
}
|
|
|
- if (TextUtils.isEmpty(it.logo)) {
|
|
|
- GlideImgUtil.loadImg(mContext, it.logo, binding.hospitalImage)
|
|
|
+ binding.tvOrgName.text = if (TextUtils.isEmpty(it.orgName)) {
|
|
|
+ ""
|
|
|
} else {
|
|
|
- GlideImgUtil.loadImgNoPlaceHolder(
|
|
|
- mContext, R.mipmap.icon_hospital_logo, binding.hospitalImage
|
|
|
- )
|
|
|
+ it.orgName
|
|
|
}
|
|
|
binding.tvLocation.text = "终端位置:" + if (TextUtils.isEmpty(it.location)) {
|
|
|
""
|