Compare commits

...

2 Commits

Author SHA1 Message Date
yezhiqiu
dd3beea20e 1.套餐名字去掉Premium显示
2.套餐价格显示保留2位小数点
3.解绑设备时,有连接蓝牙会发送清除设备端数据指令: 0x1A消息,驱动 Tracker 把状态设置为:2.出厂状态。
2026-01-09 10:40:08 +08:00
yezhiqiu
9fad836335 默认关闭声音,声音图标指示声音关闭,但调手机音量键开启声音后,声音图标仍然指示声音关闭 2026-01-07 17:41:34 +08:00
11 changed files with 105 additions and 166 deletions

View File

@@ -28,9 +28,9 @@ android {
applicationId "com.abbidot.tracker" applicationId "com.abbidot.tracker"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 35 targetSdkVersion 35
versionCode 2101 versionCode 2103
// versionName "2.1.1" // versionName "2.1.3"
versionName "2.1.1-Beta15" versionName "2.1.3-Beta1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -35,12 +35,12 @@ class ChoosePlanAdapter(
getTextView(R.id.tv_choose_plan_item_money).apply { getTextView(R.id.tv_choose_plan_item_money).apply {
text = String.format( text = String.format(
mContext.getString(R.string.txt_money_unit), mContext.getString(R.string.txt_money_unit),
Utils.formatDecimal(item.planPrice / item.planTimeMonthsCount, 1) Utils.formatDecimal(item.planPrice / item.planTimeMonthsCount, 2)
) )
} }
getTextView(R.id.tv_choose_plan_item_plan_money).text = String.format( getTextView(R.id.tv_choose_plan_item_plan_money).text = String.format(
mContext.getString(R.string.txt_money_unit), "${item.planPrice}" mContext.getString(R.string.txt_money_unit), Utils.formatDecimal(item.planPrice, 2)
) )
getTextView(R.id.tv_choose_plan_item_unit).text = getTextView(R.id.tv_choose_plan_item_unit).text =

View File

@@ -43,7 +43,8 @@ class MySubscriptionAdapter(
holder: RecyclerViewHolder?, position: Int, item: SubscriptionsOrderBean holder: RecyclerViewHolder?, position: Int, item: SubscriptionsOrderBean
) { ) {
holder!!.setText(R.id.tv_my_subscription_device_out_id, item.deviceOutId) holder!!.setText(R.id.tv_my_subscription_device_out_id, item.deviceOutId)
holder.setText(R.id.tv_my_subscription_plan_name, "${item.mealName}(${item.planCategory})") // holder.setText(R.id.tv_my_subscription_plan_name, "${item.mealName}(${item.planCategory})")
holder.setText(R.id.tv_my_subscription_plan_name, item.mealName)
holder.getTextView(R.id.tv_my_subscription_auto_subscription_tips).apply { holder.getTextView(R.id.tv_my_subscription_auto_subscription_tips).apply {
visibility = if (item.subscriptionStatus == ConstantInt.Open) { visibility = if (item.subscriptionStatus == ConstantInt.Open) {
text = if (item.mealUnit == ConstantString.PackageUnitYear) String.format( text = if (item.mealUnit == ConstantString.PackageUnitYear) String.format(

View File

@@ -64,7 +64,7 @@ class SubscriptionHistoryAdapter(
) )
//保险时长不足一年按12个月算 //保险时长不足一年按12个月算
val insuranceTime = val insuranceTime =
if (item.planTimeMonthsCount > 12) item.mealPeriod else 1 if (item.mealUnit == ConstantString.PackageUnitYear) item.mealPeriod else 1
holder.setText( holder.setText(
R.id.tv_subscription_annual_care_expiry_time, Utils.formatTime( R.id.tv_subscription_annual_care_expiry_time, Utils.formatTime(
Utils.getAfterHowTimestamp( Utils.getAfterHowTimestamp(

View File

@@ -13,6 +13,7 @@ import com.abbidot.tracker.R
import com.abbidot.tracker.base.BaseActivity import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.base.BaseDialog import com.abbidot.tracker.base.BaseDialog
import com.abbidot.tracker.bean.DeviceBean import com.abbidot.tracker.bean.DeviceBean
import com.abbidot.tracker.bean.ReceiveDeviceData
import com.abbidot.tracker.constant.ConstantInt import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString import com.abbidot.tracker.constant.ConstantString
import com.abbidot.tracker.constant.GetResultCallback import com.abbidot.tracker.constant.GetResultCallback
@@ -21,6 +22,7 @@ import com.abbidot.tracker.databinding.ActivityDeleteTracker1Binding
import com.abbidot.tracker.dialog.CommonDialog1 import com.abbidot.tracker.dialog.CommonDialog1
import com.abbidot.tracker.util.Util import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
import com.abbidot.tracker.util.bluetooth.SRBleUtil import com.abbidot.tracker.util.bluetooth.SRBleUtil
import com.abbidot.tracker.vm.TrackerSetViewModel import com.abbidot.tracker.vm.TrackerSetViewModel
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@@ -62,7 +64,16 @@ class DeleteTracker1Activity :
lifecycleScope.launch { lifecycleScope.launch {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
mDeviceBean?.let { device -> mDeviceBean?.let { device ->
SRBleUtil.instance.disconnectToMac(device.macId) //是否连接了蓝牙
if (SRBleUtil.instance.isMacConnect(device.macId)) {
SRBleUtil.instance.getConnectMacDevice(device.macId)
?.let { ble ->
SRBleUtil.instance.writeData(
ble.bleDevice,
SRBleCmdUtil.instance.setWorkingStatus(status = 2)
)
}
}
//删除设备成功后,把本地数据库中的设备也删除 //删除设备成功后,把本地数据库中的设备也删除
MyDatabase.deviceDao().deleteByParams( MyDatabase.deviceDao().deleteByParams(
ConstantString.DeviceId, ConstantString.DeviceId,
@@ -83,6 +94,19 @@ class DeleteTracker1Activity :
} }
}) })
} }
//接收蓝牙返回数据
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
mDeviceBean?.apply {
if (macId == receiveData.mac) {
receiveData.data?.let {
val data0 = SRBleCmdUtil.instance.byteToInt(it[0])
if (data0 == 0x1A) {
SRBleUtil.instance.disconnectToMac(macId)
}
}
}
}
}
} }
private fun showDeleteDialog() { private fun showDeleteDialog() {

View File

@@ -2,10 +2,12 @@ package com.abbidot.tracker.ui.activity.map
import android.content.Intent import android.content.Intent
import android.graphics.Typeface import android.graphics.Typeface
import android.view.KeyEvent
import android.view.View import android.view.View
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.commit import androidx.fragment.app.commit
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
@@ -1025,6 +1027,33 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
isOpenSound = !isOpenSound isOpenSound = !isOpenSound
} }
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
if (mViewBinding.ilLiveV2BluetoothFindDevice.root.isVisible) {
when (keyCode) {
KeyEvent.KEYCODE_VOLUME_DOWN -> {
val volume = mFindBleDeviceViewModel.getVolume()
if (volume == 1 && isOpenSound) {
isOpenSound = false
mViewBinding.ilLiveV2BluetoothFindDevice.ivLiveV2FindDeviceSound.setImageResource(
R.drawable.icon_sound_off_svg
)
}
LogUtil.e("音量减小--,$volume")
}
KeyEvent.KEYCODE_VOLUME_UP -> {
LogUtil.e("音量增加++")
if (!isOpenSound) {
isOpenSound = true
mViewBinding.ilLiveV2BluetoothFindDevice.ivLiveV2FindDeviceSound.setImageResource(
R.drawable.icon_sound_on_svg
)
}
}
}
}
return super.onKeyDown(keyCode, event)
}
override fun onClick(v: View?) { override fun onClick(v: View?) {
mViewBinding.apply { mViewBinding.apply {
when (v!!) { when (v!!) {
@@ -1048,6 +1077,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
if (isLiveJump) { if (isLiveJump) {
isOpenSound = true isOpenSound = true
setSound() setSound()
mFindBleDeviceViewModel.stopPlay()
showAndHideFindLayout() showAndHideFindLayout()
} else { } else {
mFindBleDeviceViewModel.stopFindDevice() mFindBleDeviceViewModel.stopFindDevice()

View File

@@ -68,15 +68,7 @@ class SubscriptionHistoryActivity :
for (l in list) { for (l in list) {
mSubscriptionsOrderList.add(l) mSubscriptionsOrderList.add(l)
if (l.annualCareType == ConstantInt.Type1) { if (l.annualCareType == ConstantInt.Type1) {
val subscriptionsOrder = SubscriptionsOrderBean(MultipleEntity.IMG) val subscriptionsOrder = l.copy(menuType = MultipleEntity.IMG)
subscriptionsOrder.orderNum = l.orderNum
subscriptionsOrder.createTime = l.createTime
subscriptionsOrder.enabled = l.enabled
subscriptionsOrder.surplusDays = l.surplusDays
subscriptionsOrder.subscriptionStatus = l.subscriptionStatus
subscriptionsOrder.mealPeriod = l.mealPeriod
subscriptionsOrder.annualCareType = l.annualCareType
subscriptionsOrder.annualCarePrice = l.annualCarePrice
mSubscriptionsOrderList.add(subscriptionsOrder) mSubscriptionsOrderList.add(subscriptionsOrder)
} }
} }

View File

@@ -109,125 +109,6 @@ class SureSubscriptionPlanActivity :
bottom = AppUtils.dpToPx(4) bottom = AppUtils.dpToPx(4)
) )
// mOrderBean?.let {
// ilSubscribePlanDetail.tvSureSubscribePlanDeviceId.text = it.deviceOutId
// val nowTimestamp = System.currentTimeMillis()
//
// mPackageBean?.let { p ->
// ilSubscribePlanDetail.tvSureSubscribePlanPer.text = String.format(
// getString(R.string.txt_month_unit), "${p.planTimeMonthsCount}"
// )
// val renewalString = if (p.mealUnit == ConstantString.PackageUnitYear) {
//// ilSubscribePlanDetail.tvSureSubscribePlanPer.text =
//// String.format(getString(R.string.txt_year_unit), p.period)
// val renewalTimestamp =
// Utils.getAfterHowTimestamp(nowTimestamp, p.period * 365L)
// val renewalDate =
// Utils.formatTime(renewalTimestamp, Utils.DATE_FORMAT_PATTERN_EN7)
// if (p.period > 1) {
// String.format(
// getString(R.string.txt_renewal_years),
// "${p.autoRenewPrice}",
// "${p.period}",
// renewalDate
// )
// } else {
// String.format(
// getString(R.string.txt_renewal_year),
// "${p.autoRenewPrice}",
// renewalDate
// )
// }
// } else {
// val renewalTimestamp =
// Utils.getAfterHowTimestamp(nowTimestamp, 30L * p.planTimeMonthsCount)
// val renewalDate =
// Utils.formatTime(renewalTimestamp, Utils.DATE_FORMAT_PATTERN_EN7)
// if (p.planTimeMonthsCount > 1) {
// String.format(
// getString(R.string.txt_renewal_months),
// "${p.autoRenewPrice}",
// "${p.planTimeMonthsCount}",
// renewalDate
// )
// } else {
// String.format(
// getString(R.string.txt_renewal_month),
// "${p.autoRenewPrice}",
// renewalDate
// )
// }
// }
// ilSubscribePlanDetail.tvSureSubscribePlanUnderused.text = renewalString
// ilSubscribePlanDetail.tvSureSubscribePlanMoneySum.text = String.format(
// getString(R.string.txt_money_unit), "${p.autoRenewPrice}"
// )
//
// val packageName = "${p.planName}(${p.planCategory})"
// ilSubscribePlanDetail.tvSureSubscribePlanName.text = packageName
// val price = p.planPrice
//// val price = if (p.discountedPrice > 0.0) p.discountedPrice else p.planPrice
// val priceString = String.format(
// getString(R.string.txt_money_unit),
// Utils.formatDecimal(price / p.planTimeMonthsCount, 1)
// )
// ilSubscribePlanDetail.tvSureSubscribePlanMoney.text = priceString
//
// ViewUtil.instance.addMenuBean(
// mSummaryAdapter.getData(),
// p.planName,
// "$price",
// colorRedId = R.color.data_black_color
// )
// mTotalMoney += price
// mSumInsuranceMoney =
// Utils.formatDecimal(p.everyMonthSafeFee * p.period * 12, 1).toDouble()
// ViewUtil.instance.addMenuBean(
// mSummaryAdapter.getData(),
// getString(R.string.txt_annual_care_text),
// "$mSumInsuranceMoney",
// colorRedId = R.color.data_black_color
// )
// mTotalMoney += mSumInsuranceMoney
//
// val insuranceMoneyString =
// String.format(getString(R.string.txt_month_unit), "${p.period * 12}")
// ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
// insuranceMoneyString
// ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePerMoney.text =
// String.format(getString(R.string.txt_money_unit), "${p.everyMonthSafeFee}")
// ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text =
// String.format(getString(R.string.txt_money_unit), "$mSumInsuranceMoney")
//
// if (isUpgrade) {
// mTotalMoney -= mResidualMoney
// ViewUtil.instance.addMenuBean(
// mSummaryAdapter.getData(),
// getString(R.string.txt_residual_value),
// Utils.formatDecimal(mResidualMoney, 1),
// colorRedId = R.color.red_color5,
// isSwitch = true
// )
// }
// ViewUtil.instance.addMenuBean(
// mSummaryAdapter.getData(),
// getString(R.string.txt_sales_tax),
// "0",
// colorRedId = R.color.data_black_color
// )
// }
//
// //判断套餐是否过期
// if (!TextUtils.isEmpty(it.orderNum) && it.surplusDays == 0L && it.subscriptionStatus == ConstantInt.Close) {
// mOrderBean?.reactivation = 1
// mSubscriptionViewModel.getReactivationFee(it.orderNum)
// } else {
// mOrderBean?.reactivation = 0
// mOrderBean?.reactivatePrice = 0.0
// updateMoney()
// }
// }
//添加下划线 //添加下划线
ilSubscribePlanDetail.tvSureSubscribePlanTermsConditions.paint.flags = ilSubscribePlanDetail.tvSureSubscribePlanTermsConditions.paint.flags =
Paint.UNDERLINE_TEXT_FLAG Paint.UNDERLINE_TEXT_FLAG
@@ -297,6 +178,7 @@ class SureSubscriptionPlanActivity :
val nowTimestamp = System.currentTimeMillis() val nowTimestamp = System.currentTimeMillis()
mPackageBean?.let { p -> mPackageBean?.let { p ->
val autoRenewPrice = Utils.formatDecimal(p.autoRenewPrice, 2)
ilSubscribePlanDetail.tvSureSubscribePlanPer.text = ilSubscribePlanDetail.tvSureSubscribePlanPer.text =
if (p.mealUnit == ConstantString.PackageUnitDay) String.format( if (p.mealUnit == ConstantString.PackageUnitDay) String.format(
getString(R.string.txt_day_unit), "${p.planTimeMonthsCount}" getString(R.string.txt_day_unit), "${p.planTimeMonthsCount}"
@@ -312,15 +194,13 @@ class SureSubscriptionPlanActivity :
if (p.planTimeMonthsCount > 12) { if (p.planTimeMonthsCount > 12) {
String.format( String.format(
getString(R.string.txt_renewal_years), getString(R.string.txt_renewal_years),
"${p.autoRenewPrice}", autoRenewPrice,
"${p.period}", "${p.period}",
renewalDate renewalDate
) )
} else { } else {
String.format( String.format(
getString(R.string.txt_renewal_year), getString(R.string.txt_renewal_year), autoRenewPrice, renewalDate
"${p.autoRenewPrice}",
renewalDate
) )
} }
} else if (p.mealUnit == ConstantString.PackageUnitDay) { } else if (p.mealUnit == ConstantString.PackageUnitDay) {
@@ -330,7 +210,7 @@ class SureSubscriptionPlanActivity :
Utils.formatTime(renewalTimestamp, Utils.DATE_FORMAT_PATTERN_EN7) Utils.formatTime(renewalTimestamp, Utils.DATE_FORMAT_PATTERN_EN7)
String.format( String.format(
getString(R.string.txt_renewal_day), getString(R.string.txt_renewal_day),
"${p.autoRenewPrice}", autoRenewPrice,
"${p.period}", "${p.period}",
renewalDate renewalDate
) )
@@ -342,30 +222,27 @@ class SureSubscriptionPlanActivity :
if (p.planTimeMonthsCount > 1) { if (p.planTimeMonthsCount > 1) {
String.format( String.format(
getString(R.string.txt_renewal_months), getString(R.string.txt_renewal_months),
"${p.autoRenewPrice}", autoRenewPrice,
"${p.planTimeMonthsCount}", "${p.planTimeMonthsCount}",
renewalDate renewalDate
) )
} else { } else {
String.format( String.format(
getString(R.string.txt_renewal_month), getString(R.string.txt_renewal_month), autoRenewPrice, renewalDate
"${p.autoRenewPrice}",
renewalDate
) )
} }
} }
ilSubscribePlanDetail.tvSureSubscribePlanUnderused.text = renewalString ilSubscribePlanDetail.tvSureSubscribePlanUnderused.text = renewalString
ilSubscribePlanDetail.tvSureSubscribePlanMoneySum.text = String.format( ilSubscribePlanDetail.tvSureSubscribePlanMoneySum.text =
getString(R.string.txt_money_unit), "${p.autoRenewPrice}" String.format(getString(R.string.txt_money_unit), autoRenewPrice)
)
val packageName = "${p.planName}(${p.planCategory})" // val packageName = "${p.planName}(${p.planCategory})"
ilSubscribePlanDetail.tvSureSubscribePlanName.text = packageName ilSubscribePlanDetail.tvSureSubscribePlanName.text = p.planName
val price = p.planPrice val price = p.planPrice
// val price = if (p.discountedPrice > 0.0) p.discountedPrice else p.planPrice // val price = if (p.discountedPrice > 0.0) p.discountedPrice else p.planPrice
val priceString = String.format( val priceString = String.format(
getString(R.string.txt_money_unit), getString(R.string.txt_money_unit),
Utils.formatDecimal(price / p.planTimeMonthsCount, 1) Utils.formatDecimal(price / p.planTimeMonthsCount, 2)
) )
ilSubscribePlanDetail.tvSureSubscribePlanMoney.text = priceString ilSubscribePlanDetail.tvSureSubscribePlanMoney.text = priceString
@@ -380,7 +257,7 @@ class SureSubscriptionPlanActivity :
val insuranceTime = val insuranceTime =
if (p.planTimeMonthsCount > 12) p.planTimeMonthsCount else 12 if (p.planTimeMonthsCount > 12) p.planTimeMonthsCount else 12
mSumInsuranceMoney = mSumInsuranceMoney =
Utils.formatDecimal(p.everyMonthSafeFee * insuranceTime, 1).toDouble() Utils.formatDecimal(p.everyMonthSafeFee * insuranceTime, 2).toDouble()
ViewUtil.instance.addMenuBean( ViewUtil.instance.addMenuBean(
mSummaryAdapter.getData(), mSummaryAdapter.getData(),
getString(R.string.txt_annual_care_text), getString(R.string.txt_annual_care_text),
@@ -403,7 +280,7 @@ class SureSubscriptionPlanActivity :
ViewUtil.instance.addMenuBean( ViewUtil.instance.addMenuBean(
mSummaryAdapter.getData(), mSummaryAdapter.getData(),
getString(R.string.txt_residual_value), getString(R.string.txt_residual_value),
Utils.formatDecimal(mResidualMoney, 1), Utils.formatDecimal(mResidualMoney, 2),
colorRedId = R.color.red_color5, colorRedId = R.color.red_color5,
isSwitch = true isSwitch = true
) )
@@ -471,7 +348,7 @@ class SureSubscriptionPlanActivity :
//升级套餐把之前剩余保险费退还再重新买1年的保险 //升级套餐把之前剩余保险费退还再重新买1年的保险
mTotalMoney -= surplusSafeValidFee mTotalMoney -= surplusSafeValidFee
mResidualMoney = Utils.formatDecimal( mResidualMoney = Utils.formatDecimal(
mResidualMoney + surplusSafeValidFee, 1 mResidualMoney + surplusSafeValidFee, 2
).toDouble() ).toDouble()
val insuranceTime = val insuranceTime =
if (p.planTimeMonthsCount > 12) p.planTimeMonthsCount else 12 if (p.planTimeMonthsCount > 12) p.planTimeMonthsCount else 12
@@ -481,7 +358,7 @@ class SureSubscriptionPlanActivity :
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text = mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
insuranceMoneyString insuranceMoneyString
mSumInsuranceMoney = mSumInsuranceMoney =
Utils.formatDecimal(p.everyMonthSafeFee * insuranceTime, 1) Utils.formatDecimal(p.everyMonthSafeFee * insuranceTime, 2)
.toDouble() .toDouble()
mTotalMoney += mSumInsuranceMoney mTotalMoney += mSumInsuranceMoney
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text = mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text =
@@ -501,7 +378,7 @@ class SureSubscriptionPlanActivity :
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text = mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
insuranceMoneyString insuranceMoneyString
mSumInsuranceMoney = Utils.formatDecimal( mSumInsuranceMoney = Utils.formatDecimal(
howSafeValidMonths * p.everyMonthSafeFee, 1 howSafeValidMonths * p.everyMonthSafeFee, 2
).toDouble() ).toDouble()
mTotalMoney += mSumInsuranceMoney mTotalMoney += mSumInsuranceMoney
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text = mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text =
@@ -547,14 +424,14 @@ class SureSubscriptionPlanActivity :
private fun updateMoney() { private fun updateMoney() {
mViewBinding.apply { mViewBinding.apply {
val list = mSummaryAdapter.getData() val list = mSummaryAdapter.getData()
val taxMoney = abs(Utils.formatDecimal(mTaxRate * mTotalMoney, 1).toDouble()) val taxMoney = abs(Utils.formatDecimal(mTaxRate * mTotalMoney, 2).toDouble())
mOrderBean?.tax = taxMoney mOrderBean?.tax = taxMoney
list[list.size - 1].menuValue = taxMoney.toString() list[list.size - 1].menuValue = taxMoney.toString()
mTotalWithTaxMoney = taxMoney + mTotalMoney mTotalWithTaxMoney = taxMoney + mTotalMoney
mTotalWithTaxMoney = abs(mTotalWithTaxMoney) mTotalWithTaxMoney = abs(mTotalWithTaxMoney)
ilSubscribePlanSummary.ilSureSubscribePlanTotalLayout.tvSubscribeSummaryItemMoney.text = ilSubscribePlanSummary.ilSureSubscribePlanTotalLayout.tvSubscribeSummaryItemMoney.text =
String.format( String.format(
getString(R.string.txt_money_unit), Utils.formatDecimal(mTotalWithTaxMoney, 1) getString(R.string.txt_money_unit), Utils.formatDecimal(mTotalWithTaxMoney, 2)
) )
mSummaryAdapter.notifyItemRangeChanged(0, list.size) mSummaryAdapter.notifyItemRangeChanged(0, list.size)
@@ -591,13 +468,13 @@ class SureSubscriptionPlanActivity :
mealUnit = cPlan.mealUnit mealUnit = cPlan.mealUnit
planCategory = cPlan.planCategory planCategory = cPlan.planCategory
autoRenewPrice = autoRenewPrice =
Utils.formatDecimal(cPlan.autoRenewPrice + cPlan.autoRenewPrice * mTaxRate, 1) Utils.formatDecimal(cPlan.autoRenewPrice + cPlan.autoRenewPrice * mTaxRate, 2)
.toDouble() .toDouble()
// autoRenewPrice = cPlan.autoRenewPrice // autoRenewPrice = cPlan.autoRenewPrice
mealDesc = mealDesc =
mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString() mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString()
} }
totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 1).toDouble() totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble()
Intent(mContext, PaymentMethodActivity::class.java).let { Intent(mContext, PaymentMethodActivity::class.java).let {
it.putExtra(ConstantString.LkSetMeal, this) it.putExtra(ConstantString.LkSetMeal, this)
it.putExtra(ConstantString.RechargeType, mRechargeType) it.putExtra(ConstantString.RechargeType, mRechargeType)

View File

@@ -354,9 +354,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
} }
} }
private val mPermissionsTips =
"ABBIDOT APP collects location data,The route and distance between the current location and the device can be calculated."
/** /**
* 弹窗说明需要位置权限做什么,上架市场需要 * 弹窗说明需要位置权限做什么,上架市场需要
*/ */
@@ -371,13 +368,17 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
if (type == 0) checkPermissions(type) if (type == 0) checkPermissions(type)
} else { } else {
ViewUtil.instance.showDialog( ViewUtil.instance.showDialog(
mContext!!, mPermissionsTips, object : BaseDialog.OnDialogOkListener { mContext!!,
getString(R.string.txt_location_tip),
object : BaseDialog.OnDialogOkListener {
override fun onOkClick(dialog: BaseDialog<*>) { override fun onOkClick(dialog: BaseDialog<*>) {
dialog.dismiss() dialog.dismiss()
if (type == 0) checkPermissions(type) if (type == 0) checkPermissions(type)
else Util.checkLocationPermissionsGpsEnabled(mContext!!, {}) else Util.checkLocationPermissionsGpsEnabled(mContext!!, {})
} }
}, okTextResId = R.string.txt_accept, cancelTextResId = R.string.txt_deny },
okTextResId = R.string.txt_accept,
cancelTextResId = R.string.txt_deny
) )
} }
} }

View File

@@ -80,7 +80,7 @@ class FindBleDeviceViewModel : ViewModel() {
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
mAudioManager = activity.getSystemService(Service.AUDIO_SERVICE) as AudioManager mAudioManager = activity.getSystemService(Service.AUDIO_SERVICE) as AudioManager
mPhoneOriginalVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC) mPhoneOriginalVolume = getVolume()
mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)
setVolume(0) setVolume(0)
@@ -181,6 +181,13 @@ class FindBleDeviceViewModel : ViewModel() {
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0) mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0)
} }
/**
* 获取系统当前的音量
*/
fun getVolume(): Int {
return mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
}
/** /**
* 创建SoundPool ,注意 api 等级 * 创建SoundPool ,注意 api 等级
*/ */
@@ -198,6 +205,8 @@ class FindBleDeviceViewModel : ViewModel() {
} }
val fd = activity.assets.openFd("find_device.mp3") val fd = activity.assets.openFd("find_device.mp3")
mSoundID = mSoundPool?.load(fd, 1)!! mSoundID = mSoundPool?.load(fd, 1)!!
} else {
if (mStreamID != 0) mSoundPool?.resume(mStreamID)
} }
} }
@@ -283,6 +292,10 @@ class FindBleDeviceViewModel : ViewModel() {
setVolume(mPhoneOriginalVolume) setVolume(mPhoneOriginalVolume)
} }
fun stopPlay() {
mSoundPool?.pause(mStreamID)
}
override fun onCleared() { override fun onCleared() {
super.onCleared() super.onCleared()
LogUtil.e("FindBleDeviceViewModel onCleared") LogUtil.e("FindBleDeviceViewModel onCleared")

View File

@@ -1060,6 +1060,7 @@
<string name="txt_per_day">/day</string> <string name="txt_per_day">/day</string>
<string name="txt_renewal_day">Renewal: $%s/%s day on %s</string> <string name="txt_renewal_day">Renewal: $%s/%s day on %s</string>
<string name="txt_day_unit">/day x%s</string> <string name="txt_day_unit">/day x%s</string>
<string name="txt_location_tip"> "ABBIDOT APP collects location data,The route and distance between the current location and the device can be calculated."</string>
<string name="txt_auto_subscription_day">(Renew at $%s per %s day thereafter)</string> <string name="txt_auto_subscription_day">(Renew at $%s per %s day thereafter)</string>
</resources> </resources>