中建365-二期开发-bug优化

develop
wlh 1 year ago
parent 9ce9e3bcfc
commit c8e33e9ceb

@ -156,6 +156,9 @@
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name="com.zj365.dc.activity.WarningMsgAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity android:name=".activity.OneKeyBinderDeviceAct"
android:launchMode="singleTop"

@ -23,6 +23,8 @@ class MessageDetailNewAct: BaseVmAct<BaseVm>() {
var msgBean : MessageTypeDataBean.MessageTypeBean? = null
var warningBean:MessageBean.SysMsg ? = null
override fun liveObserver() {
}
@ -52,7 +54,18 @@ class MessageDetailNewAct: BaseVmAct<BaseVm>() {
}
}else if(it.containsKey("WarnningBean")){
warningBean=it.getSerializable("WarnningBean") as MessageBean.SysMsg
warningBean?.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,ImageGetterUtils.MyImageGetter(this,binding.tvMsgContent),null)
}
}else{
}
}
onEventObject(

@ -46,7 +46,6 @@ class WarningMsgAct : BaseListAct<HealthVm>() {
override fun initAdapter() {
binding.mRecycle.layoutManager = LinearLayoutManager(this)
binding.mRecycle.adapter = adapter
binding.mRecycle.addItemDecoration(RecycleItem(this, 30))
adapter.addChildClickViewIds(R.id.mContentView)
adapter.setOnItemChildClickListener { adapter, view, position ->
var bean = adapter.getItem(position)
@ -59,8 +58,8 @@ class WarningMsgAct : BaseListAct<HealthVm>() {
clickPosition = position
} else {
bundle.clear()
bundle.putSerializable("bean", data)
RouteManager.goAct(ARouterUrl.MESSAGE_DETAIL, bundle)
bundle.putSerializable("WarnningBean", data)
RouteManager.goAct(ARouterUrl.MESSAGE_DETAIL_NEW, bundle)
}
}
}
@ -73,8 +72,8 @@ class WarningMsgAct : BaseListAct<HealthVm>() {
(adapter.data[clickPosition]).notifyStatus = 1
adapter.notifyItemChanged(clickPosition)
bundle.clear()
bundle.putSerializable("bean", clickBean)
RouteManager.goAct(ARouterUrl.MESSAGE_DETAIL, bundle)
bundle.putSerializable("WarnningBean", clickBean)
RouteManager.goAct(ARouterUrl.MESSAGE_DETAIL_NEW, bundle)
}
mViewModel.warningMsgLive.observe(this) {
it?.let {

@ -31,7 +31,7 @@ class WarningMessageAdapter():BaseAdapter<MessageBean.SysMsg>(R.layout.item_warn
}
draw.mutate()
draw.setBounds(0,0,draw.minimumWidth,draw.minimumHeight)
tv.setCompoundDrawables(draw,null,null,null)
tv.setCompoundDrawables(null,null,draw,null)
}
}

@ -65,6 +65,7 @@ import com.zj365.dc.databinding.FragDynamicManagementBinding
import com.zj365.dc.vm.DynamicManagementVm
import com.zj365.health.vm.ReportVm
import com.zj365.health.weight.DialogTip
import com.zj365.health.weight.DialogTipNew
import com.zj365.mime.weight.FactorySettingDialog
import com.zj365.mime.weight.NoticeSettingDialog
import io.reactivex.Observable
@ -249,8 +250,8 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
//点击事件
private fun setOnClickListener() {
binding.mMsgLayout.setOnClickListener(onClickListener)
binding.mMsg.setOnClickListener(onClickListener)
/* binding.mMsgLayout.setOnClickListener(onClickListener)
binding.mMsg.setOnClickListener(onClickListener)*/
binding.mHeader.mCard.setOnClickListener(onClickListener)
binding.mHeader.mBtnBind.setOnClickListener(onClickListener)
binding.mGriddingList.mSub.setOnClickListener(onClickListener)
@ -264,13 +265,14 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
binding.mHealthReport.llHebdomadReport.setOnClickListener(onClickListener)
binding.mHealthReport.llThirtyDaysReport.setOnClickListener(onClickListener)
binding.mHeader.mHealthRecords.setOnClickListener(onClickListener)
binding.mHeader.tvWarningNum.setOnClickListener(onClickListener)
}
//点击事件响应
private var onClickListener = View.OnClickListener {
when (it.id) {
//消息
R.id.mMsg, R.id.mMsgLayout -> {
R.id.tv_warning_num/*, R.id.mMsgLayout*/ -> {
RouteManager.goAct(ARouterUrl.WARNING_MSG)
}
//健康档案
@ -518,12 +520,12 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
}else{
if (EasyPermissions.somePermissionDenied(requireActivity(), Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION)){
DialogTip(
/*DialogTip(
requireContext(),
"中健365需要定位权限,需要打开设置页面么?"
) {
JumpPermissionManagement.GoToSetting(requireActivity())
}.show()
}.show()*/
}else{
FactorySettingDialog(
requireContext(),
@ -739,7 +741,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
override fun observer() {
//预警消息
mViewModel.warningMsgLive.observe(this) {
/* mViewModel.warningMsgLive.observe(this) {
updateBadgeNum(it.data.noReadNum)
val systemMessage = it.data.systemMessage
if (systemMessage !=null && systemMessage.isNotEmpty()) {
@ -748,7 +750,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
} else {
updateWarningInfo(null)
}
}
}*/
mViewModel.weatherLiveDate.observe(this){
if(it.data == null){
@ -1477,7 +1479,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
}
private fun updateBadgeNum(num: Int) {
if (num > 0) {
/*if (num > 0) {
val badgeText = if (num > 99) "99+" else "$num"
binding.mBadge.text = badgeText
binding.mBadge.post {
@ -1496,7 +1498,7 @@ class DynamicManagementFrag : BaseVmFrag<DynamicManagementVm>() , EasyPermission
binding.mBadgeCard.visibility = View.VISIBLE
} else {
binding.mBadgeCard.visibility = View.GONE
}
}*/
}
private fun updateWarningInfo(sysMsg: MessageBean.SysMsg?) {

@ -287,11 +287,17 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
}
}else{
contentData.jumpUrl?.let {
bundle.clear()
bundle.putString("title", contentData.name)
bundle.putString("url", contentData.jumpUrl)
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
contentData.jumpUrl?.let {
bundle.clear()
bundle.putString(
"web_site_url",
"${it}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}
}
}
@ -408,11 +414,18 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
}
2->{
contentData.jumpUrl?.let {
bundle.clear()
bundle.putString("title", contentData.name)
bundle.putString("url", contentData.jumpUrl)
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
contentData.jumpUrl?.let {
bundle.clear()
bundle.putString(
"web_site_url",
"${it}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}
}
}

@ -108,23 +108,7 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
//刷新注册
refresh()
Const.mainLiveData.value?.let {
user = it.user
binding.mName.text = it.user.name
binding.mPhone.text = "${it.user.phone}"
// binding.mDk.text = it.clock.toString()
// binding.mLevel.text = it.grade
if (it.user.avatarUrl.isNullOrEmpty()) {
binding.mImage.setImageResource(defaultIcon[if (it.user.sex - 1 < 0) 0 else it.user.sex - 1])
} else {
binding.mImage.setImageUser(
requireContext(),
it.user.avatarUrl,
it.user.sex.toString()
)
Const.CHAT_IMAGE = it.user.avatarUrl
}
}
binding.clInfo.setOnClickListener {
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
@ -222,7 +206,7 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
bundle.clear()
bundle.putString(
"web_site_url",
"${it.start_business}"
"${it.vip_server}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}else{
@ -412,6 +396,46 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
}
}
binding.llMagicTest.setOnClickListener {
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
otherInfo?.let {
if (!TextUtils.isEmpty(it.magic_mirror)){
bundle.clear()
bundle.putString(
"web_site_url",
"${it.magic_mirror}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}else{
CommonToastUtils.showToast("敬请期待")
}
}
}
}
binding.llInternetThing.setOnClickListener {
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
}else {
otherInfo?.let {
if (!TextUtils.isEmpty(it.miot)){
bundle.clear()
bundle.putString(
"web_site_url",
"${it.miot}"
)
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
}else{
CommonToastUtils.showToast("敬请期待")
}
}
}
}
binding.llOperationGuide.setOnClickListener {
if(MMkvHelper.getLong(Const.USER_ID).toString() == "0"){
RouteManager.goAct(ARouterUrl.LOGIN_ACT)
@ -542,6 +566,24 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
Const.userDeviceLiveData.value?:mViewModel.getUserDeviceInfo(showIdInfo)
mViewModel.searchInviteInfo()
mViewModel.getUserOtherInfo()
Const.mainLiveData.value?.let {
user = it.user
binding.mName.text = it.user.name
binding.mPhone.text = "${it.user.phone}"
// binding.mDk.text = it.clock.toString()
// binding.mLevel.text = it.grade
if (it.user.avatarUrl.isNullOrEmpty()) {
binding.mImage.setImageResource(defaultIcon[if (it.user.sex - 1 < 0) 0 else it.user.sex - 1])
} else {
binding.mImage.setImageUser(
requireContext(),
it.user.avatarUrl,
it.user.sex.toString()
)
Const.CHAT_IMAGE = it.user.avatarUrl
}
}
}
if(isLogin){
@ -564,6 +606,18 @@ class MineFrag : BaseVmFrag<SettingVm>() , EasyPermissions.PermissionCallbacks{
binding.mllServerOrder.visibility = View.GONE
}
if(TextUtils.isEmpty(it.data.magic_mirror)){
binding.llMagicTest.visibility = View.GONE
}else{
binding.llMagicTest.visibility = View.VISIBLE
}
if(TextUtils.isEmpty(it.data.miot)){
binding.llInternetThing.visibility = View.GONE
}else{
binding.llInternetThing.visibility = View.VISIBLE
}
if(TextUtils.isEmpty(it.data.start_business)){
binding.llStartBs.visibility = View.GONE
}else{

@ -16,7 +16,7 @@
android:orientation="horizontal"
android:visibility="gone" />
<FrameLayout
<!--<FrameLayout
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="@dimen/dp_86">
@ -30,7 +30,7 @@
android:visibility="gone"
android:orientation="horizontal">
<!-- 我的家人列表 -->
&lt;!&ndash; 我的家人列表 &ndash;&gt;
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mRecycle"
android:layout_width="0dp"
@ -83,7 +83,7 @@
</LinearLayout>
</FrameLayout>
</FrameLayout>-->
<!-- 下拉刷新控件 -->
<com.scwang.smart.refresh.layout.SmartRefreshLayout

@ -653,7 +653,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="权益工具"
android:text="健康物联"
android:layout_marginLeft="@dimen/dp_10"
android:textStyle="bold"
android:textColor="@color/col_313"
@ -666,55 +666,57 @@
android:weightSum="4"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_start_bs"
android:id="@+id/ll_daily_poster"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_mine_start_bs"
android:background="@mipmap/icon_daily_poster"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2999创业"
android:text="今日海报"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_daily_poster"
android:id="@+id/ll_wearable_device"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_daily_poster"
android:background="@mipmap/icon_wearable_device"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="今日海报"
android:text="穿戴手表"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_wearable_device"
android:id="@+id/ll_magic_test"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -724,12 +726,12 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_wearable_device"
android:background="@mipmap/icon_magic_test"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="穿戴设备"
android:text="魔镜体测"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
@ -737,26 +739,23 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_internet_thing"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="invisible"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_family_health"
android:background="@mipmap/icon_health_internet_thing"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="家人健康"
android:text="健康物联"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
@ -764,6 +763,7 @@
</LinearLayout>
</LinearLayout>
</LinearLayout>
@ -802,6 +802,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
android:weightSum="4"
android:orientation="horizontal">
<LinearLayout
@ -850,8 +851,9 @@
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_about_us"
android:id="@+id/ll_shipping_address"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -861,18 +863,19 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_about_us"
android:background="@mipmap/icon_shipping_address"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="关于我们"
android:text="收货地址"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_up_graded"
android:layout_width="0dp"
@ -904,10 +907,13 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
android:layout_marginBottom="@dimen/dp_22"
android:weightSum="4"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_shipping_address"
android:id="@+id/ll_start_bs"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -917,12 +923,12 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_shipping_address"
android:background="@mipmap/icon_mine_start_bs"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收货地址"
android:text="2999创业"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
@ -953,7 +959,7 @@
android:textColor="@color/col_7c7"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_setting"
android:id="@+id/ll_about_us"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@ -963,12 +969,12 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_setting"
android:background="@mipmap/icon_about_us"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置"
android:text="关于我们"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"
@ -976,22 +982,22 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_setting"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:visibility="invisible"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/icon_up_graded"
android:background="@mipmap/icon_setting"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="版本升级"
android:text="设置"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
android:layout_marginTop="@dimen/dp_12"

@ -1,24 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mContentView"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/dp_10"
app:cardElevation="@dimen/dp_0"
android:background="@color/white"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:orientation="vertical">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:gravity="center_vertical"
@ -26,12 +16,13 @@
<TextView
android:id="@+id/mTitle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawablePadding="@dimen/dp_10"
android:textColor="@color/col_455"
android:textSize="@dimen/dp_16" />
tools:text="eeeeeee"
android:layout_centerVertical="true"
android:textColor="@color/col_313"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/mTvTime"
@ -40,16 +31,11 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/dp_10"
android:textColor="@color/col_919"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentTop="true"
android:background="@color/col_f1f" />
android:textColor="@color/col_7c7"
tools:text="eeeeee"
android:textSize="@dimen/sp_13" />
</RelativeLayout>
<TextView
android:id="@+id/mContent"
android:layout_width="match_parent"
@ -58,10 +44,8 @@
android:ellipsize="end"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:maxLines="2"
android:textColor="@color/col_B8B"
android:textSize="@dimen/dp_14" />
</LinearLayout>
android:maxLines="1"
android:textColor="@color/col_7c7"
android:textSize="@dimen/sp_13" />
</androidx.cardview.widget.CardView>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.hjq.toast.ToastUtils
import com.xty.common.LogUtils
import com.xty.common.app.MyApp
import com.xty.common.util.CommonUtils
import com.xty.network.ApiInterface
import com.xty.network.MyRetrofit
@ -38,23 +39,29 @@ open class BaseVm(var loading: Dialog?) : ViewModel() {
}
when (throwable) {
is ConnectException -> ToastUtils.show("网络异常")
is ConnectException -> if(MyApp.activityCount> 0) ToastUtils.show("网络异常")
is HttpException -> {
var exception = throwable
when ((exception as HttpException).code()) {
500 -> ToastUtils.show("服务器繁忙,请稍后重试")
502 -> ToastUtils.show("当前网络状态不佳,请稍后重试")
504 -> ToastUtils.show("请求超时,请检查网络")
else -> ToastUtils.show("连接异常错误码:${(exception as HttpException).code()}")
500 -> if(MyApp.activityCount> 0) ToastUtils.show("服务器繁忙,请稍后重试")
502 -> if(MyApp.activityCount> 0) ToastUtils.show("当前网络状态不佳,请稍后重试")
504 -> if(MyApp.activityCount> 0) ToastUtils.show("请求超时,请检查网络")
else -> if(MyApp.activityCount> 0) ToastUtils.show("连接异常错误码:${(exception as HttpException).code()}")
}
return@CoroutineExceptionHandler
}
is SocketTimeoutException -> {
ToastUtils.show("连接超时")
if(MyApp.activityCount> 0){
ToastUtils.show("连接超时")
}
return@CoroutineExceptionHandler
}
is UnknownHostException -> {
ToastUtils.show("当前网络状态不佳,请再试一次")
if(MyApp.activityCount> 0){
ToastUtils.show("当前网络状态不佳,请再试一次")
}
return@CoroutineExceptionHandler
}
}

@ -1,6 +1,7 @@
package com.xty.common.app
import android.annotation.SuppressLint
import android.app.Activity
import android.app.ActivityManager
import android.app.Application
import android.bluetooth.BluetoothAdapter
@ -9,6 +10,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.os.Bundle
import android.util.Log
import cat.ereza.customactivityoncrash.CustomActivityOnCrash
import cat.ereza.customactivityoncrash.config.CaocConfig
@ -47,8 +49,11 @@ class MyApp : Application() {
private lateinit var blueToothReceiver: BluetoothMonitorReceiver
companion object {
var instance: MyApp? = null
var activityCount = 0
private fun getInstance(app: MyApp) {
instance = app
}
@ -107,6 +112,36 @@ class MyApp : Application() {
MMkvHelper.put(Const.VERSION_NAME, AppUtils.getPackageVersionName(this))
MMkvHelper.put(Const.VERSION_CODES, AppUtils.getVersionCode(this))
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks{
override fun onActivityCreated(p0: Activity, p1: Bundle?) {
}
override fun onActivityStarted(p0: Activity) {
LogUtils.e("APP","前台呀")
activityCount++
}
override fun onActivityResumed(p0: Activity) {
}
override fun onActivityPaused(p0: Activity) {
}
override fun onActivityStopped(p0: Activity) {
LogUtils.e("APP","后台")
activityCount--
LogUtils.e("APP","后台${activityCount}")
}
override fun onActivitySaveInstanceState(p0: Activity, p1: Bundle) {
}
override fun onActivityDestroyed(p0: Activity) {
}
})
}
// private fun forceStopApp(){

@ -2,8 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/col_f1f"
android:background="@color/white"
android:orientation="vertical">
<include
@ -13,7 +12,8 @@
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/mRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<com.scwang.smart.refresh.header.ClassicsHeader
android:layout_width="match_parent"
@ -23,11 +23,8 @@
android:id="@+id/mRecycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:orientation="vertical"
android:overScrollMode="never" />
/>
<com.scwang.smart.refresh.footer.ClassicsFooter

@ -9,4 +9,6 @@ data class UserOtherInfo(
var coupons_count:Int,
var serviceOrderCount:Int,
var vip_server:String,
var magic_mirror:String,
var miot:String,
var placard:String)

Loading…
Cancel
Save