1.修复充电中,Map 显示Off, 但设备管理中显示Strong signal bug

2.修复GPS 没信号还是为绿点bug
3.超过30天后,退款按钮呈灰色不可点,点击后提示“Refund period has expired”,续订订单不显示按钮
4.历史订单列表页,增加退款说明
This commit is contained in:
yezhiqiu
2026-04-29 10:27:29 +08:00
parent 8d1a44bf89
commit 587697954d
21 changed files with 297 additions and 71 deletions

View File

@@ -1,12 +1,13 @@
package com.abbidot.tracker.adapter
import android.graphics.Typeface
import android.widget.ImageView
import android.util.TypedValue
import androidx.appcompat.widget.AppCompatImageView
import androidx.core.content.ContextCompat
import com.abbidot.baselibrary.util.AppUtils
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.MenuTxtBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.MultipleEntity
import com.abbidot.tracker.widget.TypefaceTextView
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
@@ -32,6 +33,8 @@ class HelpTextImageTypeAdapter(list: MutableList<MenuTxtBean>?) :
addItemType(MultipleEntity.IMG_IMG, R.layout.layout_help_title1)
//显示14sp大小的文字内容
addItemType(MultipleEntity.IMG_TEXT_IMG, R.layout.layout_help_title2)
//显示多大字体,是否粗体,字体颜色
addItemType(MultipleEntity.TEXT_TEXT_IMG, R.layout.layout_help_title2)
}
override fun convert(holder: BaseViewHolder, item: MenuTxtBean) {
@@ -67,6 +70,23 @@ class HelpTextImageTypeAdapter(list: MutableList<MenuTxtBean>?) :
holder.getView<TypefaceTextView>(R.id.tv_help_title_two).text = item.menuName
holder.itemView.setPadding(0, AppUtils.dpToPx(14), 0, 0)
}
MultipleEntity.TEXT_TEXT_IMG -> {
holder.getView<TypefaceTextView>(R.id.tv_help_title_two).apply {
//是否粗体
val typefaceBold =
if (item.isSwitch) Typeface.create(Typeface.DEFAULT, Typeface.BOLD)
else Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)
typeface = typefaceBold
text = item.menuName
setTextSize(TypedValue.COMPLEX_UNIT_SP, item.state.toFloat())
val tColor = if (item.colorRedId == ConstantInt.Type0) R.color.data_black_color
else item.colorRedId
setTextColor(ContextCompat.getColor(context, tColor))
}
// holder.itemView.setPadding(0, AppUtils.dpToPx(14), 0, 0)
}
}
}

View File

@@ -1,5 +1,6 @@
package com.abbidot.tracker.adapter
import android.content.Context
import android.content.Intent
import android.view.View
import android.widget.TextView
@@ -16,6 +17,8 @@ import com.abbidot.tracker.ui.activity.subscribe.SubscriptionHistoryActivity
import com.abbidot.tracker.widget.TypefaceRoundButton
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hjq.toast.Toaster
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButtonDrawable
/**
*Created by .yzq on 2024/8/19/019.
@@ -114,35 +117,39 @@ class SubscriptionHistoryAdapter(
visibility = View.VISIBLE
when (item.orderStatus) {
1 -> {
if (item.isAutoRenewal == ConstantInt.Type1) {
visibility = View.GONE
} else {
setRefundState(context, item.isRefundable, this)
}
// val updateTimestamp = Utils.stringToTimestamp(item.updateTime, isUtc = true)
// val nowTimestamp = System.currentTimeMillis()
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
visibility = View.GONE
} else if (item.mealUnit == ConstantString.PackageUnitDay) {
visibility = View.VISIBLE
setText(R.string.txt_refund)
} else if (item.mealUnit == ConstantString.PackageUnitMonth) {
// if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
// visibility = View.GONE
// } else if (item.mealUnit == ConstantString.PackageUnitDay) {
// visibility = View.VISIBLE
// setText(R.string.txt_refund)
// } else if (item.mealUnit == ConstantString.PackageUnitMonth) {
// val day7Timestamp = 7 * 24 * 60 * 60 * 1000L
//套餐超出7天不能退款
// //套餐超出7天不能退款
// if (nowTimestamp - updateTimestamp <= day7Timestamp) {
if (item.isRefundable == ConstantInt.Type1) {
visibility = View.VISIBLE
setText(R.string.txt_refund)
} else {
visibility = View.GONE
}
} else {
// visibility = View.VISIBLE
// setText(R.string.txt_refund)
// } else {
// visibility = View.GONE
// }
// } else {
// val day30Timestamp = 30 * 24 * 60 * 60 * 1000L
//套餐超出30天不能退款
// //套餐超出30天不能退款
// if (nowTimestamp - updateTimestamp <= day30Timestamp) {
if (item.isRefundable == ConstantInt.Type1) {
visibility = View.VISIBLE
setText(R.string.txt_refund)
} else {
visibility = View.GONE
}
}
setTextColor(ContextCompat.getColor(context, R.color.select_color))
// visibility = View.VISIBLE
// setText(R.string.txt_refund)
// } else {
// visibility = View.GONE
// }
// }
// setTextColor(ContextCompat.getColor(context, R.color.select_color))
}
4 -> setText(R.string.txt_waiting)
@@ -160,6 +167,10 @@ class SubscriptionHistoryAdapter(
setChangeAlphaWhenPress(true)
setOnClickListener {
if (item.orderStatus == ConstantInt.Type1) {
if (item.isRefundable == ConstantInt.Type0) {
Toaster.show(R.string.txt_refund_expired)
return@setOnClickListener
}
Intent(context, RequestRefundActivity::class.java).apply {
putExtra(ConstantString.SetMeal, item)
mHistoryActivity.startActivity(this)
@@ -185,4 +196,24 @@ class SubscriptionHistoryAdapter(
}
}
private fun setRefundState(
context: Context, isRefundable: Int, roundButton: TypefaceRoundButton
) {
roundButton.apply {
var textColor = R.color.select_color
val strokeColor = if (isRefundable == ConstantInt.Type1) {
R.color.block_color
} else {
textColor = R.color.line_color1
R.color.permission_no_check_color
}
(background as QMUIRoundButtonDrawable).let {
it.setStroke(
it.strokeWidth, ContextCompat.getColor(context, strokeColor)
)
}
setTextColor(ContextCompat.getColor(context, textColor))
}
}
}

View File

@@ -56,6 +56,7 @@ data class SubscriptionsOrderBean(
var refundTime: Long,
var planTimeMonthsCount: Int,
var isRefundable: Int,//是否显示退款按钮 1:是 0:否
var isAutoRenewal: Int,//是否是自动续订 1:是 0:否
@MultipleEntity var menuType: Int,
var isUpdateOrder: Int = 0//是否是升级订单 1:是 0:否
) : Parcelable, MultiItemEntity {
@@ -103,6 +104,7 @@ data class SubscriptionsOrderBean(
0L,
0,
0,
0,
menuType,
0
)
@@ -150,6 +152,8 @@ data class SubscriptionsOrderBean(
0L,
0L,
0,
0,
0,
MultipleEntity.TEXT,
0
)

View File

@@ -279,8 +279,8 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
private fun setDeviceData(mapDeviceBean: MapDeviceBean) {
mapDeviceBean.apply {
mLedMode=ledMode
mLedSwitch=ledSwitch
mLedMode = ledMode
mLedSwitch = ledSwitch
mViewBinding.let {
it.ledLightOpenAndClose.switch.isChecked = ledSwitch == ConstantInt.Open
@@ -373,8 +373,10 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
if (ilLedLightIssueLayout.root.isGone) {
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
ilLedLightIssueLayout.root.visibility = View.VISIBLE
vLedIssueShadeView.visibility = View.VISIBLE
}.playOn(ilLedLightIssueLayout.root)
} else {
vLedIssueShadeView.visibility = View.GONE
YoYo.with(Techniques.SlideOutDown).duration(600).onEnd {
ilLedLightIssueLayout.root.visibility = View.GONE
}.playOn(ilLedLightIssueLayout.root)
@@ -414,7 +416,9 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
if (BleManager.getInstance().isConnected(deviceMacId)) {
//蓝牙控制
SRBleUtil.instance.getConnectMacDevice(deviceMacId)?.let {
SRBleUtil.instance.setBleLedSwitch(this@LedLightActivity, it.bleDevice, ledSwitch)
SRBleUtil.instance.setBleLedSwitch(
this@LedLightActivity, it.bleDevice, ledSwitch
)
}
} else {
//远程控制

View File

@@ -11,8 +11,6 @@ import com.abbidot.tracker.util.ViewUtil
class HelpCreatePetFenceActivity :
BaseActivity<ActivityHelpCreatePetFenceBinding>(ActivityHelpCreatePetFenceBinding::inflate) {
private lateinit var mHelpCreateFenceAdapter: HelpTextImageTypeAdapter
override fun getTopBar() = mViewBinding.ilHelpCreatePetFenceBar.titleTopBar
override fun initData() {
@@ -46,9 +44,9 @@ class HelpCreatePetFenceActivity :
menuList, "", imageResId = R.drawable.create_fence_help4, menuType = MultipleEntity.IMG
)
mHelpCreateFenceAdapter = HelpTextImageTypeAdapter(menuList)
val helpCreateFenceAdapter = HelpTextImageTypeAdapter(menuList)
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
mContext, mViewBinding.rvHelpCreatePetFenceContent, mHelpCreateFenceAdapter
mContext, mViewBinding.rvHelpCreatePetFenceContent, helpCreateFenceAdapter
)
}
}

View File

@@ -11,7 +11,6 @@ import com.abbidot.tracker.util.ViewUtil
class HelpTrackerBatteryActivity :
BaseActivity<ActivityHelpTrackerBatteryBinding>(ActivityHelpTrackerBatteryBinding::inflate) {
private lateinit var mHelpBatteryAdapter: HelpTextImageTypeAdapter
override fun getTopBar() = mViewBinding.ilHelpTrackerBatteryBar.titleTopBar
@@ -69,10 +68,7 @@ class HelpTrackerBatteryActivity :
menuType = MultipleEntity.IMG_IMG
)
ViewUtil.instance.addMenuBean(
menuList,
"",
imageResId = R.drawable.battery_life_help3,
menuType = MultipleEntity.IMG
menuList, "", imageResId = R.drawable.battery_life_help3, menuType = MultipleEntity.IMG
)
ViewUtil.instance.addMenuBean(menuList, getString(R.string.txt_gps_update_interval))
@@ -87,10 +83,7 @@ class HelpTrackerBatteryActivity :
menuType = MultipleEntity.IMG_TEXT_IMG
)
ViewUtil.instance.addMenuBean(
menuList,
"",
imageResId = R.drawable.battery_life_help4,
menuType = MultipleEntity.IMG
menuList, "", imageResId = R.drawable.battery_life_help4, menuType = MultipleEntity.IMG
)
ViewUtil.instance.addMenuBean(menuList, getString(R.string.txt_in_live_mode))
@@ -106,15 +99,12 @@ class HelpTrackerBatteryActivity :
menuType = MultipleEntity.IMG_IMG
)
ViewUtil.instance.addMenuBean(
menuList,
"",
imageResId = R.drawable.battery_life_help5,
menuType = MultipleEntity.IMG
menuList, "", imageResId = R.drawable.battery_life_help5, menuType = MultipleEntity.IMG
)
mHelpBatteryAdapter = HelpTextImageTypeAdapter(menuList)
val helpBatteryAdapter = HelpTextImageTypeAdapter(menuList)
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
mContext, mViewBinding.rvHelpTrackerBatteryContent, mHelpBatteryAdapter
mContext, mViewBinding.rvHelpTrackerBatteryContent, helpBatteryAdapter
)
}
}

View File

@@ -1,12 +1,16 @@
package com.abbidot.tracker.ui.activity.subscribe
import android.view.View
import androidx.activity.viewModels
import androidx.core.view.isGone
import com.abbidot.baselibrary.constant.EventName
import com.abbidot.baselibrary.eventbus.XEventBus
import com.abbidot.baselibrary.util.AppUtils
import com.abbidot.tracker.R
import com.abbidot.tracker.adapter.HelpTextImageTypeAdapter
import com.abbidot.tracker.adapter.SubscriptionHistoryAdapter
import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.bean.MenuTxtBean
import com.abbidot.tracker.bean.SubscriptionsOrderBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString
@@ -15,6 +19,8 @@ import com.abbidot.tracker.constant.MultipleEntity
import com.abbidot.tracker.databinding.ActivitySubscriptionHistoryBinding
import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.vm.SubscriptionManageViewModel
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
class SubscriptionHistoryActivity :
BaseActivity<ActivitySubscriptionHistoryBinding>(ActivitySubscriptionHistoryBinding::inflate) {
@@ -34,15 +40,78 @@ class SubscriptionHistoryActivity :
setLeftBackImage(R.drawable.icon_white_back_svg)
mHistoryAdapter = SubscriptionHistoryAdapter(mSubscriptionsOrderList)
intent?.extras?.apply {
subscriptionId = getString(ConstantString.Id, "")
}
mViewBinding.apply {
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
mContext, rvSubscriptionHistoryList, mHistoryAdapter, bottom = AppUtils.dpToPx(12)
)
setOnClickListenerViews(btnSubscriptionRefundIssue, tvCloseRefundIssueBtn)
}
intent?.extras?.apply {
subscriptionId = getString(ConstantString.Id, "")
}
initIssue()
}
private fun initIssue() {
val menuList = mutableListOf<MenuTxtBean>()
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_refund_policy),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
isSwitch = true,
state = 16
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_automatic_refund),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
isSwitch = true,
state = 12
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_automatic_refund_dec),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
state = 12
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_standard_refund),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
isSwitch = true,
state = 12
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_standard_refund_dec),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
state = 12
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_no_refund),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
isSwitch = true,
state = 12
)
ViewUtil.instance.addMenuBean(
menuList,
getString(R.string.txt_no_refund_dec),
menuType = MultipleEntity.TEXT_TEXT_IMG,
colorRedId = R.color.data_black_color,
state = 12
)
val helpBatteryAdapter = HelpTextImageTypeAdapter(menuList)
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
mContext, mViewBinding.rvSubscriptionRefundIssueList, helpBatteryAdapter
)
}
override fun onResume() {
@@ -78,4 +147,31 @@ class SubscriptionHistoryActivity :
})
}
}
/**
* 显示问题
*/
private fun showLedIssue() {
mViewBinding.apply {
if (llSubscriptionRefundIssueLayout.isGone) {
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
llSubscriptionRefundIssueLayout.visibility = View.VISIBLE
vRefundIssueShadeView.visibility = View.VISIBLE
}.playOn(llSubscriptionRefundIssueLayout)
} else {
vRefundIssueShadeView.visibility = View.GONE
YoYo.with(Techniques.SlideOutDown).duration(600).onEnd {
llSubscriptionRefundIssueLayout.visibility = View.GONE
}.playOn(llSubscriptionRefundIssueLayout)
}
}
}
override fun onClick(v: View?) {
mViewBinding.apply {
when (v!!) {
btnSubscriptionRefundIssue, tvCloseRefundIssueBtn -> showLedIssue()
}
}
}
}

View File

@@ -157,8 +157,11 @@ class RouteV3Fragment : BaseFragment<FragmentRouteV3Binding>(FragmentRouteV3Bind
llMapRouteLineV3ZoomingLayout.setOnTouchListener { _, event ->
if (rlMapRouteLineV3TimeLayout.isVisible) {
//获取初始高度
if (mTotalHeight == 0) {
mTotalHeight = cvHomeRouteV3Card.height + svHomeRouteMapScroll.height
}
if (mLastScrollViewHeight == 0 && mHistoryFenceAdapter.getData().size == 1) {
mCalendarLayoutHaveSeekBarHeight = rlHomeRouteCalendarV3Layout.height
mLastScrollViewHeight = svHomeRouteMapScroll.height
}

View File

@@ -653,7 +653,7 @@ class HomeTrackFragment :
}
//是否超时上报
val isTimeoutReport = Util.isTimeoutReport(updateTime,gnssInterval)
val isTimeoutReport = Util.isTimeoutReport(updateTime, gnssInterval)
mTrackStateList[0].let {
it.menuValue =
if (isTimeoutReport || lteSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2) {
@@ -667,14 +667,14 @@ class HomeTrackFragment :
mTrackStateList[1].let {
it.colorRedId = R.color.blue_color1
it.menuValue =
if (isTimeoutReport || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1) {
if (isTimeoutReport || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1) {
it.colorRedId = R.color.orange_color3
getString(R.string.tracker_manage_set_led_off)
} else if (gpsSignal > ConstantInt.WeakSignal) {
getString(R.string.txt_strong_signal)
} else {
getString(R.string.txt_weak_signal)
}
} else if (gpsSignal > ConstantInt.WeakSignal) getString(R.string.txt_strong_signal)
else if (gpsSignal == ConstantInt.NoSignal) {
it.colorRedId = R.color.orange_color3
getString(R.string.txt_no_signal)
} else getString(R.string.txt_weak_signal)
}
mTrackStateList[2].let {
it.menuValue =
@@ -1172,7 +1172,9 @@ class HomeTrackFragment :
if (BleManager.getInstance().isConnected(it.deviceMacId)) {
//蓝牙控制
getBleTrackDeviceBean(false)?.let { ble ->
SRBleUtil.instance.setBleLedSwitch(getHomeV2Activity()!!, ble.bleDevice, ledSwitch)
SRBleUtil.instance.setBleLedSwitch(
getHomeV2Activity()!!, ble.bleDevice, ledSwitch
)
}
} else {
// setLedState(ledSwitch)

View File

@@ -830,12 +830,16 @@ class ViewUtil private constructor() {
colorRedId: Int = R.color.orange_color3,
isSwitch: Boolean = false,
type: Int = ConstantInt.Type0,
state: Int = ConstantInt.Type0,
@MultipleEntity menuType: Int = MultipleEntity.TEXT
) {
val menuTxtBean = MenuTxtBean(name, value, menuType)
if (imageResId > 0) {
menuTxtBean.imageId = imageResId
}
if (state > 0) {
menuTxtBean.state = state
}
if (!TextUtils.isEmpty(imageUrl)) {
menuTxtBean.imageUrl = imageUrl
}

View File

@@ -346,7 +346,10 @@ class MapViewModel : ViewModel() {
menuType = ConstantInt.Close
context.getString(R.string.tracker_manage_set_led_off)
} else if (it.gpsSignal > ConstantInt.WeakSignal) context.getString(R.string.txt_strong_signal)
else if (it.gpsSignal == ConstantInt.NoSignal) context.getString(R.string.txt_no_signal)
else if (it.gpsSignal == ConstantInt.NoSignal) {
menuType = ConstantInt.Close
context.getString(R.string.txt_no_signal)
}
else context.getString(R.string.txt_weak_signal)
value = context.getString(R.string.tracker_manage_set_gps) + "$gpsValue"
}