中建365-bug修复

develop
wlh 1 year ago
parent f8a47c454f
commit bf9a24d132

@ -159,7 +159,7 @@ class MainActivity : BaseVmAct<MainVm>(), Consumer<AbstractMeasureData> {
mViewModel.getUserEquipmentInformationizationRequest(userId)
mViewModel.getBanners(userId,3)
mViewModel.getIsDemonstate()
mViewModel.searchInviteInfo()
if(EasyPermissions.hasPermissions(this, Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION)) {

@ -7,6 +7,7 @@ import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.Dateutils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.util.ImageGetterUtils
import com.xty.network.model.MessageBean
import com.xty.network.model.MessageTypeDataBean
import com.zj365.dc.databinding.ActMessageDetailNewBinding
@ -40,7 +41,8 @@ class MessageDetailNewAct: BaseVmAct<BaseVm>() {
msgBean?.let {
binding.tvMsgTitle.text = it.notifyTitle
binding.tvMsgTime.text = Dateutils.formatTime(it.notifyCreateTime,Dateutils.YYYY_MM_DD_HH_MM)
binding.tvMsgContent.text = Html.fromHtml(it.notifyContent)
binding.tvMsgContent.text = Html.fromHtml(it.notifyContent,ImageGetterUtils.MyImageGetter(this,binding.tvMsgContent),null)
}

@ -4,7 +4,6 @@ import android.Manifest
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.text.TextUtils
import android.view.View
import androidx.annotation.RequiresApi
import com.xty.base.dialog.AppUpdateDialog
@ -12,7 +11,6 @@ import com.xty.base.fragment.BaseVmFrag
import com.xty.common.*
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.bracelet.YCBBlueConnectHelper
import com.xty.common.event.AddSuccessEvent
import com.xty.common.event.BindDevEvent
import com.xty.common.event.LoginOrRegisterEvent
@ -20,14 +18,15 @@ import com.xty.common.event.LoginOutEvent
import com.xty.common.event.MyInfoEvent
import com.xty.common.util.CommonToastUtils
import com.xty.common.util.CommonUtils
import com.xty.network.model.InviteCustodyBean
import com.xty.network.model.SettingBean
import com.zj365.dc.BuildConfig
import com.zj365.dc.activity.MainActivity
import com.zj365.dc.databinding.FragMineBinding
import com.zj365.health.act.HealthMainAct
import com.zj365.health.vm.ReportVm
import com.zj365.health.weight.DialogTip
import com.zj365.health.weight.DialogTipNew
import com.zj365.mime.act.DevInfoAct
import com.zj365.mime.vm.SettingVm
import org.greenrobot.eventbus.EventBus
@ -64,12 +63,27 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
var user: SettingBean.User? = null
private var showIdInfo = "" //需要显示的信息的id
var inviteCustodyBean: InviteCustodyBean? = null
private val dialogBind by lazy {
DialogTip(requireContext(), "需绑定中健三六五健康手表,才能查看", "去绑定") {
RouteManager.goAct(ARouterUrl.DEVICE_CHOICE)
}
}
val dialogInvite by lazy {
DialogTipNew(requireContext(), "监护邀请","", "确认","取消",false,{
inviteCustodyBean?.let {
mViewModel.confirmInvite(it.id,"1")
}
}){
inviteCustodyBean?.let {
mViewModel.confirmInvite(it.id,"0")
}
}
}
override fun setViewModel() = SettingVm()
@RequiresApi(Build.VERSION_CODES.O)
@ -84,10 +98,15 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
isDemonstrate = (requireActivity() as MainActivity).isDemonstrate
//刷新注册
refresh()
binding.mNoNetwork.mRefreshBtn.isSelected = true
binding.mNoNetwork.mRefreshBtn.setOnClickListener {
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.searchInviteInfo()
}
binding.clInfo.setOnClickListener {
@ -368,6 +387,17 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
}
}
private fun refresh() {
refresh.setRefresh(binding.mRefresh) {
mViewModel.getMySetting()
// }
mViewModel.getAllInfo(showIdInfo,false)
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
}
}
override fun onResume() {
super.onResume()
/* if (!checkNetworkAvailable(requireContext())) {
@ -378,7 +408,8 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
// }
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.getScore(1)
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
// }
}
@ -399,6 +430,17 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
}
}
mViewModel.findInfoLiveData.observe(this){
binding.imgRedDot.visibility = View.GONE
if (it.data != null){
binding.imgRedDot.visibility = View.VISIBLE
inviteCustodyBean = it.data
dialogInvite.setContentNew("${CommonUtils.replaceMiddleNumber(it.data.phone)}用户邀请您成为 监护人")
dialogInvite.show()
}
}
Const.mainLiveData.observe(this) {
if (null == it) {
@ -448,7 +490,8 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
MMkvHelper.getLong(Const.USER_ID).toString()
}
mViewModel.getMySetting()
mViewModel.getScore(1)
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
}
@Subscribe(threadMode = ThreadMode.MAIN)
@ -460,20 +503,22 @@ class MineFrag : BaseVmFrag<SettingVm>(),EasyPermissions.PermissionCallbacks {
fun addSuccess(event: AddSuccessEvent){
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.getScore(1)
// mViewModel.getScore(1)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun bindDevSuccess(event:BindDevEvent){
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.getScore(1)
// mViewModel.getScore(1)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun refreshUI(event: MyInfoEvent){
mViewModel.getMySetting()
mViewModel.getAllInfo(showIdInfo,false)
mViewModel.getScore(1)
// mViewModel.getScore(1)
mViewModel.searchInviteInfo()
}

@ -26,12 +26,11 @@
<!-- 经典下拉头部 -->
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundTint="@color/white"
app:srlAccentColor="@color/white"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="@color/white" />
<androidx.core.widget.NestedScrollView

@ -13,6 +13,23 @@
android:layout_height="match_parent"
android:visibility="gone" />
<!-- 下拉刷新控件 -->
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/mRefresh"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="@dimen/dp_30"
app:srlAccentColor="@color/white">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foregroundTint="@color/white"
android:visibility="visible"
app:srlAccentColor="@color/black"
app:srlPrimaryColor="@color/white" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -481,11 +498,25 @@
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@mipmap/icon_health_family"
android:scaleType="centerCrop"/>
<ImageView
android:id="@+id/img_red_dot"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_10"
android:visibility="gone"
android:background="@drawable/shape_red_dot_white"
android:layout_gravity="end"
/>
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -952,4 +983,8 @@
</androidx.core.widget.NestedScrollView>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</LinearLayout>

@ -15,10 +15,11 @@
<com.ruffian.library.widget.RImageView
android:id="@+id/img_activies"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_500"
android:maxWidth="@dimen/dp_312"
android:maxHeight="@dimen/dp_500"
android:layout_height="@dimen/dp_600"
android:minWidth="@dimen/dp_312"
android:minHeight="@dimen/dp_500"
android:adjustViewBounds="true"
android:scaleType="fitXY"
app:is_circle="false"
app:corner_radius="@dimen/dp_8"

@ -0,0 +1,89 @@
package com.xty.common.util;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.Html;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
public class ImageGetterUtils {
public static MyImageGetter getImageGetter(Context context, TextView textView) {
MyImageGetter myImageGetter = new MyImageGetter(context, textView);
return myImageGetter;
}
public static class MyImageGetter implements Html.ImageGetter {
private URLDrawable urlDrawable = null;
private TextView textView;
private Context context;
public MyImageGetter(Context context, TextView textView) {
this.textView = textView;
this.context = context;
}
@Override
public Drawable getDrawable(final String source) {
urlDrawable = new URLDrawable();
Glide.with(context).asBitmap().load(source).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
urlDrawable.bitmap = changeBitmapSize(resource);
urlDrawable.setBounds(0, 0, changeBitmapSize(resource).getWidth(), changeBitmapSize(resource).getHeight());
textView.invalidate();
textView.setText(textView.getText());//不加这句显示不出来图片,原因不详
}
});
return urlDrawable;
}
public class URLDrawable extends BitmapDrawable {
public Bitmap bitmap;
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
if (bitmap != null) {
canvas.drawBitmap(bitmap, 0, 0, getPaint());
}
}
}
private Bitmap changeBitmapSize(Bitmap bitmap) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
//设置想要的大小
int newWidth = width;
int newHeight = height;
//计算压缩的比率
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
//获取想要缩放的matrix
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
//获取新的bitmap
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
bitmap.getWidth();
bitmap.getHeight();
return bitmap;
}
}
}

@ -0,0 +1,16 @@
package com.xty.common.weight
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import androidx.recyclerview.widget.RecyclerView
class CustomerRecyclerview @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : RecyclerView(context, attrs) {
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
parent.requestDisallowInterceptTouchEvent(true)
return super.dispatchTouchEvent(ev)
}
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<stroke android:color="@color/white" android:width="@dimen/dp_2"/>
<solid android:color="@color/col_2621"/>
</shape>

@ -46,7 +46,7 @@ class FamilyHealthAct : BaseListAct<FamilyHealthVm>() {
setRecycleRefresh(binding.recyclerView, binding.mRefresh, true)
binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = mAdapter
mAdapter.addChildClickViewIds(R.id.tv_add_cancel, R.id.tv_watch,R.id.tv_current_time,R.id.ll_avatar)
mAdapter.addChildClickViewIds(R.id.tv_add_cancel, R.id.tv_watch,R.id.tv_current_time,R.id.user_avatar_recycler,R.id.tv_num)
mAdapter.setOnItemChildClickListener { adapter, view, position ->
val familyHealthBean = adapter.data[position] as FamilyHealthBean
when (view.id) {
@ -57,8 +57,11 @@ class FamilyHealthAct : BaseListAct<FamilyHealthVm>() {
mViewModel.exitCustody(familyHealthBean.id.toString())
}
}
R.id.tv_num ->{
RouteManager.goAct(ARouterUrl.FAMILY_GUARDIAN_LIST_ACT)
R.id.ll_avatar ->{
}
R.id.user_avatar_recycler ->{
RouteManager.goAct(ARouterUrl.FAMILY_GUARDIAN_LIST_ACT)
}
}

@ -4,11 +4,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseListAct
import com.xty.common.arouter.ARouterUrl
import com.xty.common.event.AddSuccessEvent
import com.xty.network.model.FamilyGuardianBean
import com.xty.network.model.FamilyHealthBean
import com.zj365.health.R
import com.zj365.health.adapter.familyhealth.FamilyHealthGuardianAdapter
import com.zj365.health.databinding.ActFamilyHealthGuardianBinding
import com.zj365.health.vm.FamilyHealthVm
import org.greenrobot.eventbus.EventBus
@Route(path = ARouterUrl.FAMILY_GUARDIAN_LIST_ACT)
class FamilyHealthGuardianListAct : BaseListAct<FamilyHealthVm>() {
@ -22,13 +25,14 @@ class FamilyHealthGuardianListAct : BaseListAct<FamilyHealthVm>() {
binding.recyclerView.adapter = adapter
adapter.addChildClickViewIds(R.id.cb_frist, R.id.img_delete)
adapter.setOnItemChildClickListener { adapter, view, position ->
val familyHealthBean = adapter.data[position] as FamilyHealthBean
val familyGuardianBean = adapter.data[position] as FamilyGuardianBean
when (view.id) {
R.id.img_delete -> {
mViewModel.exitCustody(familyHealthBean.id.toString())
mViewModel.deleteGuardian(familyGuardianBean.id)
// mViewModel.exitCustody(familyHealthBean.id.toString())
}
R.id.cb_frist->{
mViewModel.setFirstGuardian(familyGuardianBean.id)
}
}
}
@ -52,6 +56,17 @@ class FamilyHealthGuardianListAct : BaseListAct<FamilyHealthVm>() {
mViewModel.familyGuardianLiveData.observe(this){
adapter.setNewInstance(it.data)
}
mViewModel.deleteGuardianLiveData.observe(this){
page =1
loadData()
EventBus.getDefault().post(AddSuccessEvent())
}
mViewModel.firstGuardianLiveData.observe(this){
page =1
loadData()
}
}
override fun setLayout()= binding.root

@ -6,6 +6,8 @@ import androidx.recyclerview.widget.RecyclerView
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.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.setImageUser
import com.xty.network.model.FamilyHealthBean
import com.zj365.health.R

@ -14,6 +14,11 @@ class FamilyHealthVm :BaseVm() {
val familyGuardianLiveData by lazy { MutableLiveData<RespBody<MutableList<FamilyGuardianBean>>>() }
val exitCustody by lazy { MutableLiveData<RespBody<Any>>() }
val firstGuardianLiveData by lazy { MutableLiveData<RespBody<Any>>() }
val deleteGuardianLiveData by lazy { MutableLiveData<RespBody<Any>>() }
fun getFamilyHealthList(){
startHttp (true){
@ -40,4 +45,23 @@ class FamilyHealthVm :BaseVm() {
}
fun setFirstGuardian(id:Long){
startHttp {
val json = JSONObject()
json.put("id",id)
val request = apiInterface().setFirstGuardian(retrofits.getRequestBody(json.toString()))
request.getCodeStatus(firstGuardianLiveData,nowData)
}
}
fun deleteGuardian(id:Long){
startHttp {
val json = JSONObject()
json.put("id",id)
val request = apiInterface().deleteGuardian(retrofits.getRequestBody(json.toString()))
request.getCodeStatus(deleteGuardianLiveData,nowData)
}
}
}

@ -128,6 +128,7 @@
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_avatar_recycler"
android:clickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView

@ -4,13 +4,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="@dimen/dp_70">
android:paddingLeft="@dimen/dp_16"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:paddingRight="@dimen/dp_16"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/img_avatar"
android:layout_width="@dimen/dp_49"
android:layout_width="@dimen/dp_50"
android:layout_centerVertical="true"
android:layout_height="@dimen/dp_49"/>
android:scaleType="centerCrop"
android:layout_height="@dimen/dp_50"/>
<LinearLayout
android:layout_width="wrap_content"
@ -36,7 +41,7 @@
android:textColor="@color/col_7c7"
android:id="@+id/tv_phone"
tools:text="13652458945"
android:layout_marginTop="@dimen/dp_10"/>
android:layout_marginTop="@dimen/dp_5"/>
</LinearLayout>
@ -47,7 +52,7 @@
android:id="@+id/img_delete"
android:background="@mipmap/icon_close_delet"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_15"/>
/>
<CheckBox
android:id="@+id/cb_frist"
@ -74,5 +79,12 @@
android:layout_centerVertical="true"
/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:layout_marginTop="@dimen/dp_8"
android:background="@color/col_0f2"
android:layout_below="@+id/img_avatar"
android:layout_marginLeft="@dimen/dp_57"/>
</RelativeLayout>

@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.common.Const
import com.xty.network.model.FamilyBean
import com.xty.network.model.InviteCustodyBean
import com.xty.network.model.MainBean
import com.xty.network.model.ProgrammeBean
import com.xty.network.model.RespBody
@ -29,6 +30,10 @@ class SettingVm : BaseVm() {
val updateLive by lazy { MutableLiveData<RespBody<Update>>() }
val allData by lazy { MutableLiveData<RespBody<MainBean>>() }
val findInfoLiveData by lazy { MutableLiveData<RespBody<InviteCustodyBean>>() }
val confirmInviteLiveData by lazy { MutableLiveData<RespBody<Any>>() }
fun getNesProg(id: String) {
startHttp {
@ -160,4 +165,23 @@ class SettingVm : BaseVm() {
body.getCodeStatus(allData,nowData)
}
}
fun searchInviteInfo(){
startHttp(false) {
var json = JSONObject()
val response = apiInterface().findConfirmInfo(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(findInfoLiveData, nowData)
}
}
fun confirmInvite(id:String, status:String){
startHttp(false) {
var json = JSONObject()
json.put("id",id)
json.put("status",status)
val response = apiInterface().confirmInvited(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(confirmInviteLiveData,nowData)
}
}
}

@ -1724,6 +1724,18 @@ interface ApiInterface {
@POST("customer/family/getGuardianList")
suspend fun getFamilyGuardianList(@Body rb:RequestBody) : RespBody<MutableList<FamilyGuardianBean>>
/**
* 设置第一监护人
*/
@POST("customer/family/setFirstGuardian")
suspend fun setFirstGuardian(@Body rb:RequestBody) : RespBody<Any>
/**
* 删除监护人
*/
@POST("customer/family/deleteGuardian")
suspend fun deleteGuardian(@Body rb:RequestBody) : RespBody<Any>
/**
* 退出监护
*/

Loading…
Cancel
Save