Browse Source

1.测评历史添加智能测评历史记录列表和详情功能

王鹏鹏 2 years ago
parent
commit
7fe07ab7d6

+ 56 - 55
personalcenter/src/main/java/com/yingyang/personalcenter/personalcenter/PersonalCenterActivity.kt

@@ -68,38 +68,40 @@ class PersonalCenterActivity :
         viewModel.getUserInfo(fail = {
             it.toast()
         }, success = {
-            if (it != null) {
-                binding.data = it
-                if (TextUtils.isEmpty(it.mobile).not()) {
-                    User.saveMobile(it.mobile)
-                }
-                if (TextUtils.isEmpty(it.idCard).not()) {
-                    User.saveIdCard(it.idCard)
-                }
-                //保存用户头像
-                if (TextUtils.isEmpty(it.avatar).not()) {
-                    User.saveAvatar(it.avatar)
-                }
-                //保存用户名
-                if (TextUtils.isEmpty(it.name).not()) {
-                    User.saveName(it.name)
-                }
-                if (TextUtils.isEmpty(it.orgCode).not()) {
-                    User.saveOrgCode(it.orgCode)
-                }
-                User.saveUserSex(it.getSex())
-                User.saveUserAge(it.getAgeInfo())
-                if (TextUtils.isEmpty(it.id).not()) {
-                    User.saveUserId(it.id)
-                }
-                if (TextUtils.isEmpty(it.padNo).not()) {
-                    User.savePadNo(it.padNo)
-                }
-                if (it.diagnoseResult.isNullOrEmpty().not()) {
-                    diagnosisList.addAll(it.diagnoseResult)
+            runOnUiThread {
+                if (it != null) {
+                    binding.data = it
+                    if (TextUtils.isEmpty(it.mobile).not()) {
+                        User.saveMobile(it.mobile)
+                    }
+                    if (TextUtils.isEmpty(it.idCard).not()) {
+                        User.saveIdCard(it.idCard)
+                    }
+                    //保存用户头像
+                    if (TextUtils.isEmpty(it.avatar).not()) {
+                        User.saveAvatar(it.avatar)
+                    }
+                    //保存用户名
+                    if (TextUtils.isEmpty(it.name).not()) {
+                        User.saveName(it.name)
+                    }
+                    if (TextUtils.isEmpty(it.orgCode).not()) {
+                        User.saveOrgCode(it.orgCode)
+                    }
+                    User.saveUserSex(it.getSex())
+                    User.saveUserAge(it.getAgeInfo())
+                    if (TextUtils.isEmpty(it.id).not()) {
+                        User.saveUserId(it.id)
+                    }
+                    if (TextUtils.isEmpty(it.padNo).not()) {
+                        User.savePadNo(it.padNo)
+                    }
+                    if (it.diagnoseResult.isNullOrEmpty().not()) {
+                        diagnosisList.addAll(it.diagnoseResult)
+                    }
                 }
+                diagnosisAdapter.setData(diagnosisList)
             }
-            diagnosisAdapter.setData(diagnosisList)
         })
     }
 
@@ -107,9 +109,7 @@ class PersonalCenterActivity :
     override fun onTouch(v: View, event: MotionEvent): Boolean {
         when (event.action) {
             MotionEvent.ACTION_DOWN -> {
-                if (v.id == R.id.layoutHome || v.id == R.id.tvServiceAgreement || v.id == R.id.tvPrivacyPolicy ||
-                    v.id == R.id.tvEquipmentServices || v.id == R.id.settingLayout || v.id == R.id.btnLoginOut
-                ) {
+                if (v.id == R.id.layoutHome || v.id == R.id.tvServiceAgreement || v.id == R.id.tvPrivacyPolicy || v.id == R.id.tvEquipmentServices || v.id == R.id.settingLayout || v.id == R.id.btnLoginOut) {
                     v.startAnimation(getScaleAnimation())
                 }
             }
@@ -150,9 +150,7 @@ class PersonalCenterActivity :
             }
 
             MotionEvent.ACTION_CANCEL -> {
-                if (v.id == R.id.layoutHome || v.id == R.id.tvServiceAgreement || v.id == R.id.tvPrivacyPolicy ||
-                    v.id == R.id.tvEquipmentServices || v.id == R.id.settingLayout || v.id == R.id.btnLoginOut
-                ) {
+                if (v.id == R.id.layoutHome || v.id == R.id.tvServiceAgreement || v.id == R.id.tvPrivacyPolicy || v.id == R.id.tvEquipmentServices || v.id == R.id.settingLayout || v.id == R.id.btnLoginOut) {
                     v.startAnimation(getEndAnimation())
                 }
             }
@@ -167,26 +165,29 @@ class PersonalCenterActivity :
         viewModel.logout(fail = {
             "退出失败,请重试".toast()
         }, success = {
-            User.saveUserId("")
-            User.saveName("")
-            User.saveAvatar("")
-            User.saveUserAge("")
-            User.saveUserSex("")
-            User.saveToken("")
-            User.saveMobile("")
-            User.saveIdCard("")
-            User.saveOrgCode("")
-            User.savePadNo("")
-            V2TIMManager.getInstance().logout(object : V2TIMCallback {
-                override fun onSuccess() {
-                }
+            runOnUiThread {
+                User.saveUserId("")
+                User.saveName("")
+                User.saveAvatar("")
+                User.saveUserAge("")
+                User.saveUserSex("")
+                User.saveToken("")
+                User.saveMobile("")
+                User.saveIdCard("")
+                User.saveOrgCode("")
+                User.savePadNo("")
+                V2TIMManager.getInstance().logout(object : V2TIMCallback {
+                    override fun onSuccess() {
+                    }
 
-                override fun onError(p0: Int, p1: String?) {
-                }
-            })
-            LiveEventBusUtil.send(RxBusCodes.LOGINOUT, "")
-            JumpUtil.jumpActivity(RouterUrlCommon.login, mContext)
-            finish()
+                    override fun onError(p0: Int, p1: String?) {
+
+                    }
+                })
+                LiveEventBusUtil.send(RxBusCodes.LOGINOUT, "")
+                JumpUtil.jumpActivity(RouterUrlCommon.login, mContext)
+                finish()
+            }
         })
     }
 }