中建365-绑定设备
@ -1,15 +1,17 @@
|
||||
package com.zj365.dc.adapter
|
||||
|
||||
|
||||
import android.widget.ImageView
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.network.model.DeviceBean
|
||||
import com.zj365.dc.R
|
||||
|
||||
class DeviceChoiceAdapter:BaseAdapter<DeviceBean>(R.layout.item_device_choice) {
|
||||
|
||||
override fun convert(holder: BaseViewHolder, item: DeviceBean) {
|
||||
holder.setImageResource(R.id.iv_device_icon,item.resId)
|
||||
holder.setText(R.id.tv_device_name,item.name)
|
||||
holder.getView<ImageView>(R.id.iv_device_icon).setImage(context,item.imageUrl)
|
||||
holder.setText(R.id.tv_device_name,"${item.watchTypeName}(${item.deviceType})")
|
||||
}
|
||||
}
|
@ -1,7 +1,21 @@
|
||||
package com.zj365.dc.vm
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.network.model.DeviceBean
|
||||
import com.xty.network.model.RespBody
|
||||
import org.json.JSONObject
|
||||
|
||||
class DeviceChoiceVm:BaseVm() {
|
||||
|
||||
val deviceTypeListLiveData by lazy { MutableLiveData<RespBody<MutableList<DeviceBean>>> ()}
|
||||
|
||||
fun getDeviceType(){
|
||||
startHttp {
|
||||
var json = JSONObject()
|
||||
val response = apiInterface().getDeviceTypeList(retrofits.getRequestBody(json.toString()))
|
||||
response.getCodeStatus(deviceTypeListLiveData, nowData)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 886 B |
@ -0,0 +1,44 @@
|
||||
package com.xty.base.dialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.view.View
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.xty.base.databinding.DialogActivitiesBinding
|
||||
import com.xty.common.R
|
||||
import com.xty.common.SizeUtil
|
||||
import com.xty.common.setBigImage
|
||||
import com.xty.common.setImage
|
||||
import com.xty.common.setImageUser
|
||||
|
||||
class DialogActivities (context:Context,var imgUrl:String?): BaseDialog(context) {
|
||||
val binding by lazy { DialogActivitiesBinding.inflate(layoutInflater) }
|
||||
override fun setLayout() = binding.root
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
setDialogPadding(SizeUtil.dp2px(context, 30f), 0, SizeUtil.dp2px(context, 30f), 0)
|
||||
imgUrl?.let {
|
||||
|
||||
binding.imgActivies.setImage(context,it)
|
||||
/* Glide.with(context).asBitmap().load(it).error(R.mipmap.ic_welcome_main_bg)
|
||||
.into(object : SimpleTarget<Bitmap?>() {
|
||||
override fun onResourceReady(
|
||||
resource: Bitmap,
|
||||
transition: Transition<in Bitmap?>?
|
||||
) {
|
||||
if (resource != null) {
|
||||
binding.imgActivies.setImageBitmap(resource)
|
||||
}
|
||||
}
|
||||
})*/
|
||||
}
|
||||
binding.imgClose.setOnClickListener { dismiss() }
|
||||
|
||||
binding.imgActivies.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/img_close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_9"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="32dp"
|
||||
android:background="@mipmap/icon_close"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_activies"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="@dimen/dp_306"
|
||||
android:scaleType="centerCrop"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,4 @@
|
||||
package com.xty.common.event
|
||||
|
||||
class AddSuccessEvent {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_7"/>
|
||||
<stroke android:width="@dimen/dp_0_5"
|
||||
android:color="#FDA481"/>
|
||||
<solid android:color="#FDF5F2"/>
|
||||
</shape>
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 587 B |
@ -1,11 +1,113 @@
|
||||
package com.zj365.health.adapter.familyhealth
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.impl.GlideEngine
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.util.SpannableUtils
|
||||
import com.xty.network.model.FamilyHealthBean
|
||||
import com.zj365.health.R
|
||||
|
||||
class HealthFamilyTargetAdapter : BaseAdapter<String>(R.layout.item_health_family_target) {
|
||||
override fun convert(holder: BaseViewHolder, item: String) {
|
||||
TODO("Not yet implemented")
|
||||
class HealthFamilyTargetAdapter : BaseAdapter<FamilyHealthBean.FamilyTargetBean>(R.layout.item_health_family_target) {
|
||||
|
||||
//器官名
|
||||
private val units = arrayOf(
|
||||
R.string.info_1_unit, R.string.info_3_unit, R.string.info_7_unit,
|
||||
R.string.info_4_unit, R.string.info_2_unit, R.string.info_9_unit,
|
||||
R.string.info_8_unit,
|
||||
R.string.info_10_unit, R.string.info_6_unit
|
||||
)
|
||||
|
||||
override fun convert(holder: BaseViewHolder, item: FamilyHealthBean.FamilyTargetBean) {
|
||||
var imgTarget = holder.getView<ImageView>(R.id.img_target)
|
||||
var tvValue = holder.getView<TextView>(R.id.tv_value)
|
||||
holder.setText(R.id.tv_name,item.name)
|
||||
var contentValue =""
|
||||
if(item.type == 5){
|
||||
if(item.value == "0/0"){
|
||||
contentValue = "--"
|
||||
}else{
|
||||
contentValue = item.value
|
||||
}
|
||||
}else{
|
||||
contentValue = if (item.value == "0") "--" else item.value
|
||||
}
|
||||
|
||||
|
||||
if(item.status == 1){
|
||||
tvValue.setTextColor(Color.parseColor("#7C7C7C"))
|
||||
tvValue.text = SpannableUtils.setStrSpan(
|
||||
"${contentValue}${context.getString(units[item.type-1])}",
|
||||
14,
|
||||
ContextCompat.getColor(
|
||||
context, R.color.col_c7c
|
||||
),
|
||||
Typeface.BOLD,
|
||||
0,
|
||||
"${contentValue}${context.getString(units[item.type-1])}".length -
|
||||
context.getString(units[item.type-1]).length)
|
||||
}else{
|
||||
tvValue.setTextColor(Color.parseColor("#F7891D"))
|
||||
tvValue.text = SpannableUtils.setStrSpan(
|
||||
"${contentValue}${context.getString(units[item.type-1])}",
|
||||
14,
|
||||
ContextCompat.getColor(
|
||||
context, R.color.col_91d
|
||||
),
|
||||
Typeface.BOLD,
|
||||
0,
|
||||
"${contentValue}${context.getString(units[item.type-1])}".length -
|
||||
context.getString(units[item.type-1]).length)
|
||||
}
|
||||
|
||||
|
||||
when(item.type){
|
||||
1 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_xl)
|
||||
|
||||
|
||||
}
|
||||
|
||||
2 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_oo)
|
||||
|
||||
}
|
||||
|
||||
3 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_h_breath)
|
||||
|
||||
}
|
||||
|
||||
4 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_temp)
|
||||
|
||||
}
|
||||
|
||||
5 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_xya)
|
||||
|
||||
}
|
||||
|
||||
6 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_steps)
|
||||
|
||||
|
||||
}
|
||||
7 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_bloodsugar)
|
||||
|
||||
|
||||
}
|
||||
8 ->{
|
||||
imgTarget.setImageResource(R.mipmap.ic_niaosuan)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.zj365.health.vm
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.network.model.FamilyHealthBean
|
||||
import com.xty.network.model.RespBody
|
||||
import org.json.JSONObject
|
||||
|
||||
class FamilyHealthVm :BaseVm() {
|
||||
|
||||
val familyHealthListData by lazy { MutableLiveData<RespBody<MutableList<FamilyHealthBean>>>() }
|
||||
|
||||
val exitCustody by lazy { MutableLiveData<RespBody<Any>>() }
|
||||
fun getFamilyHealthList(){
|
||||
startHttp (true){
|
||||
|
||||
val json = JSONObject()
|
||||
val request = apiInterface().getFamilyList(retrofits.getRequestBody(json.toString()))
|
||||
request.getCodeStatus(familyHealthListData,nowData)
|
||||
}
|
||||
}
|
||||
|
||||
fun exitCustody(id:String){
|
||||
startHttp (true){
|
||||
val request = apiInterface().exitCustody(id)
|
||||
request.getCodeStatus(exitCustody,nowData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.0 KiB |
@ -1,3 +1,3 @@
|
||||
package com.xty.network.model
|
||||
|
||||
data class DeviceBean(val resId:Int,val name:String,val type:Int)
|
||||
data class DeviceBean(val imageUrl:String,val watchTypeName:String,val watchType:Int,val deviceType:String)
|
||||
|
@ -0,0 +1,4 @@
|
||||
package com.xty.network.model
|
||||
|
||||
data class InviteCustodyBean(val phone:String,val id:String) {
|
||||
}
|