套餐优化

This commit is contained in:
yezhiqiu
2025-10-15 09:39:31 +08:00
parent 8930bba35f
commit 05f62cf33c
25 changed files with 392 additions and 174 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*.iml
.gradle
.idea
/local.properties
/.idea/caches
/.idea/libraries
@@ -13,3 +14,4 @@
.externalNativeBuild
.cxx
local.properties
/.idea/

View File

@@ -4,6 +4,14 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-10-09T01:39:35.620630500Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=H:\androidAvd\.android\avd\Pixel_9_Pro.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>

5
.idea/gradle.xml generated
View File

@@ -4,9 +4,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="gradleJvm" value="jbr-21" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
@@ -19,5 +19,6 @@
</option>
</GradleProjectSettings>
</option>
<option name="offlineMode" value="true" />
</component>
</project>

3
.idea/misc.xml generated
View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -30,7 +30,7 @@ android {
targetSdkVersion 35
versionCode 2020
// versionName "2.0.20"
versionName "2.0.20-Beta2"
versionName "2.0.20-Beta4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -1,7 +1,6 @@
package com.abbidot.tracker.adapter
import android.content.Context
import android.graphics.Paint
import android.view.View
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.list.RecyclerViewHolder
@@ -9,7 +8,6 @@ import com.abbidot.baselibrary.util.Utils
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.PackageBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString
/**
*Created by .yzq on 2024/8/6/006.
@@ -32,49 +30,31 @@ class ChoosePlanAdapter(
setText(R.id.tv_choose_plan_item_name, item.planName)
val price = if (item.discountedPrice > 0) item.discountedPrice else item.planPrice
// val price = if (item.discountedPrice > 0) item.discountedPrice else item.planPrice
getTextView(R.id.tv_choose_plan_item_money).apply {
text = if (item.mealUnit == ConstantString.PackageUnitMonth) {
String.format(
mContext.getString(R.string.txt_money_unit), Utils.formatDecimal(price, 2)
)
} else {
val monthPrice = Utils.formatDecimal(price / (item.period * 12), 2)
String.format(mContext.getString(R.string.txt_money_unit), monthPrice)
}
}
getTextView(R.id.tv_choose_plan_item_year_money).let {
it.text = String.format(
text = String.format(
mContext.getString(R.string.txt_money_unit),
Utils.formatDecimal(item.discountedPrice, 2)
Utils.formatDecimal(item.planPrice / item.planTimeMonthsCount, 1)
)
it.visibility = if (item.discount > 0) View.VISIBLE
else View.GONE
}
getTextView(R.id.tv_choose_plan_item_discount_money).let {
it.text = String.format(
mContext.getString(R.string.txt_money_unit),
Utils.formatDecimal(item.planPrice, 2)
)
it.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
it.visibility = if (item.discount > 0) View.VISIBLE
else View.GONE
}
getTextView(R.id.tv_choose_plan_item_plan_money).text = String.format(
mContext.getString(R.string.txt_money_unit), "${item.planPrice}"
)
getTextView(R.id.tv_choose_plan_item_billed_money).text = item.billedMode
getView(R.id.ll_choose_plan_item_discount_percent).let {
it.visibility = if (item.discount > 0) View.VISIBLE
else View.GONE
}
getTextView(R.id.tv_choose_plan_item_discount_percent).let {
it.text = "${item.discount}%"
it.visibility = if (item.popularType == ConstantInt.Type1) View.VISIBLE
else View.INVISIBLE
}
// getTextView(R.id.tv_choose_plan_item_discount_percent).let {
// it.text = "${item.discount}%"
// }
getView(R.id.cv_choose_plan_item_popular).let {
if (item.popularType == ConstantInt.Type1) it.visibility = View.VISIBLE
if (item.popularType == ConstantInt.Type1) it.visibility = View.GONE
else it.visibility = View.GONE
}
}

View File

@@ -4,9 +4,9 @@ import android.content.Context
import android.widget.RelativeLayout
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.list.RecyclerViewHolder
import com.abbidot.baselibrary.util.Utils
import com.abbidot.tracker.R
import com.abbidot.tracker.bean.PackageTypeBean
import com.abbidot.tracker.constant.ConstantInt
/**
*Created by .yzq on 2024/3/19/019.
@@ -32,10 +32,16 @@ class SubscriptionPlanAdapter(
relativeLayout.setBackgroundResource(0)
// popularCardView.visibility = View.GONE
}
holder.setText(R.id.tv_subscribe_plan_item_name, item.name)
val packageName = when (item.nameCode) {
ConstantInt.Type1 -> mContext.getString(R.string.txt_basic)
ConstantInt.Type2 -> mContext.getString(R.string.txt_premium)
else -> item.name
}
holder.setText(R.id.tv_subscribe_plan_item_name, packageName)
holder.setText(
R.id.tv_subscribe_plan_item_money,
String.format(mContext.getString(R.string.txt_money_unit), Utils.formatDecimal( item.price, 2))
String.format(mContext.getString(R.string.txt_money_unit), "${item.price}")
)
// subscription.text =
// String.format(mContext.getString(R.string.txt_per_year_money), item.subscriptionFee)

View File

@@ -25,7 +25,19 @@ class SubscriptionPlanDetailAdapter(
checkBox.setOnClickListener {
checkBox.isChecked = !checkBox.isChecked
}
holder.setText(R.id.tv_subscribe_plan_detail_name, item.title)
val titleName = when (item.titleCode) {
ConstantInt.Type1 -> mContext.getString(R.string.txt_real_time_tracking)
ConstantInt.Type2 -> mContext.getString(R.string.txt_activity_logs)
ConstantInt.Type3 -> mContext.getString(R.string.txt_notifications_emergencies)
ConstantInt.Type4 -> mContext.getString(R.string.txt_customized_led)
5 -> mContext.getString(R.string.txt_bluetooth_radar)
6 -> mContext.getString(R.string.txt_geofencing)
7 -> mContext.getString(R.string.txt_route_records)
8 -> mContext.getString(R.string.txt_family_sharing)
9 -> mContext.getString(R.string.txt_customer_support)
else -> item.title
}
holder.setText(R.id.tv_subscribe_plan_detail_name, titleName)
checkBox.isChecked = item.status == ConstantInt.Open
}
}

View File

@@ -21,5 +21,8 @@ data class PackageBean(
var planPrice: Double,
var discount: Int,
var active: Int,
var planTimeMonthsCount: Int,
var everyMonthSafeFee: Double,
var billedMode: String,
var selected: Boolean
) : Parcelable

View File

@@ -5,4 +5,4 @@ package com.abbidot.tracker.bean
* @link
* @description:
*/
data class PackageBenefitsBean(var title: String, var status: Int)
data class PackageBenefitsBean(var title: String, var status: Int, var titleCode: Int)

View File

@@ -10,5 +10,6 @@ data class PackageTypeBean(
var name: String,
var packageId: String,
var list: MutableList<PackageBenefitsBean>?,
var selected: Boolean
var selected: Boolean,
val nameCode: Int,
)

View File

@@ -50,6 +50,7 @@ data class SubscriptionsOrderBean(
var username: String,
var iccid: String,
var endTime: Long,
var planTimeMonthsCount: Int,
var isUpdateOrder: Int = 0//是否是升级订单 1:是 0:否
) : Parcelable {
constructor() : this(
@@ -93,6 +94,7 @@ data class SubscriptionsOrderBean(
"",
"",
0L,
0,
0
)
}

View File

@@ -1302,6 +1302,7 @@ interface INetworkService {
@Field("customerId") customerId: String,
@Field("orderNum") orderNum: String,
@Field("isUpdateOrder") isUpdateOrder: Int,
@Field("planTimeMonthsCount") planTimeMonthsCount: Int,
@Field("subscriptionId") subscriptionId: String
): BaseResponse<PayResultBean>
@@ -1338,6 +1339,7 @@ interface INetworkService {
@Field("customerId") customerId: String,
@Field("orderNum") orderNum: String,
@Field("isUpdateOrder") isUpdateOrder: Int,
@Field("planTimeMonthsCount") planTimeMonthsCount: Int,
@Field("subscriptionId") subscriptionId: String
): BaseResponse<PayResultBean>

View File

@@ -1185,6 +1185,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
customerId,
orderNum,
isUpdateOrder,
planTimeMonthsCount,
subscriptionId
)
}
@@ -1226,6 +1227,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
"",
orderNum,
isUpdateOrder,
planTimeMonthsCount,
subscriptionId
)
}

View File

@@ -9,21 +9,30 @@ import com.abbidot.baselibrary.constant.MMKVKey
import com.abbidot.baselibrary.eventbus.XEventBus
import com.abbidot.baselibrary.util.LogUtil
import com.abbidot.baselibrary.util.MMKVUtil
import com.abbidot.baselibrary.util.Utils
import com.abbidot.tracker.R
import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.bean.PetBean
import com.abbidot.tracker.bean.SubscriptionsOrderBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString
import com.abbidot.tracker.constant.GetResultCallback
import com.abbidot.tracker.databinding.ActivityAddPairedSuccessBinding
import com.abbidot.tracker.deprecated.ui.activity.vm.AddTrackerDeviceViewModel
import com.abbidot.tracker.ui.activity.pet.first.FirstSetPetTypeActivity
import com.abbidot.tracker.ui.activity.device.wifi.AddWifiPowerZone1Activity
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionPlanActivity
import com.abbidot.tracker.util.Util
import com.abbidot.tracker.vm.PetInfoViewModel
import com.abbidot.tracker.vm.PetRelationViewModel
import com.abbidot.tracker.vm.UserProfileViewModel
class AddPairedSuccessActivity :
BaseActivity<ActivityAddPairedSuccessBinding>(ActivityAddPairedSuccessBinding::inflate) {
private val mAddTrackerViewModel: AddTrackerDeviceViewModel by viewModels()
private val mPetViewModel: PetInfoViewModel by viewModels()
private val mUserProfileViewModel: UserProfileViewModel by viewModels()
private val mPetRelationViewModel: PetRelationViewModel by viewModels()
private lateinit var mSubscriptionsOrderBean: SubscriptionsOrderBean
@@ -31,6 +40,7 @@ class AddPairedSuccessActivity :
private var mDeviceOutId = ""
private var mDeviceId = ""
private var mMac = ""
private var mPetBean: PetBean? = null
override fun getTopBar() = mViewBinding.ilAddPairedSuccessTopBar.titleTopBar
@@ -111,17 +121,18 @@ class AddPairedSuccessActivity :
//更新设备绑定状态
mUpdatePayDeviceStateLiveData.observe(this@AddPairedSuccessActivity) {
setButtonEnabled(mViewBinding.btnPairSuccessActivate, ConstantInt.Type1)
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
XEventBus.post(EventName.RefreshDevice)
if (isFirstBind) {
val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
startActivityFinish(intent)
}
finish()
mUserProfileViewModel.updateMeasureUnit(
this@AddPairedSuccessActivity, ConstantInt.Type1
)
// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
// intent.putExtra(ConstantString.isFirstBind, isFirstBind)
// startActivityFinish(intent)
} else finish()
}
override fun onRequestError(exceptionCode: String?) {
@@ -136,6 +147,78 @@ class AddPairedSuccessActivity :
}
})
}
//默认单位设置
mUserProfileViewModel.mUpdateMeasureUnitLiveData.observe(this@AddPairedSuccessActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
it.getOrNull()?.apply {
MMKVUtil.putInt(MMKVKey.MeasureUnit, ConstantInt.Type1)
PetBean().let { pet ->
pet.petName = "My Pet"
pet.deviceId = mDeviceId
pet.petType = ConstantInt.DogPetType
pet.gender = ConstantInt.WoMan
pet.macID = mMac
pet.birthdayDate = "2024-01-01"
pet.height = Utils.formatDecimal(Util.inToCm(20.0), 1).toFloat()
pet.weight = Utils.formatDecimal(Util.lbsToKg(25.0), 1).toFloat()
mPetBean = pet
mPetViewModel.addPet(this@AddPairedSuccessActivity, pet)
}
}
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
setButtonEnabled(mViewBinding.btnPairSuccessActivate, ConstantInt.Type1)
}
})
}
//添加默认宠物
mPetViewModel.mAddPetLiveData.observe(this@AddPairedSuccessActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
it.getOrNull()?.let { pet ->
mPetBean?.let { petBean ->
petBean.petId = pet.petId
mPetRelationViewModel.bindPet(
this@AddPairedSuccessActivity, petBean.deviceId, petBean.petId
)
}
}
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
setButtonEnabled(mViewBinding.btnPairSuccessActivate, ConstantInt.Type1)
}
})
}
//绑定默认宠物
mPetRelationViewModel.mBindPetLiveData.observe(this@AddPairedSuccessActivity) {
setButtonEnabled(mViewBinding.btnPairSuccessActivate, ConstantInt.Type1)
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
XEventBus.post(EventName.RefreshPet)
showToast(R.string.txt_bind_success, isFinish = true)
mViewBinding.root.postDelayed({
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.isBind)
mPetBean?.apply {
val intent = Intent(mContext, AddWifiPowerZone1Activity::class.java)
intent.putExtra(ConstantString.Pet, this)
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
startActivity(intent)
}
}, 1500)
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
setButtonEnabled(mViewBinding.btnPairSuccessActivate, ConstantInt.Type1)
}
})
}
}
}

View File

@@ -52,7 +52,13 @@ class ChoosePlanActivity :
if (isUpgrade) {
mRechargeType = ConstantInt.Type2
setTopBarTitle(R.string.txt_upgrade_plan)
} else setTopBarTitle(R.string.txt_choose_your_plan)
} else {
if (packageTypeName == "Basic") {
setTopBarTitle(R.string.txt_basic_plan)
} else {
setTopBarTitle(R.string.txt_premium_plan)
}
}
setLeftBackImage(R.drawable.icon_white_back_svg)
mViewBinding.apply {

View File

@@ -18,18 +18,22 @@ import com.abbidot.tracker.R
import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.bean.BleTrackDeviceBean
import com.abbidot.tracker.bean.PayResultBean
import com.abbidot.tracker.bean.PetBean
import com.abbidot.tracker.bean.ReceiveDeviceData
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString
import com.abbidot.tracker.constant.GetResultCallback
import com.abbidot.tracker.databinding.ActivityPaymentSuccessBinding
import com.abbidot.tracker.deprecated.ui.activity.vm.AddTrackerDeviceViewModel
import com.abbidot.tracker.ui.activity.pet.first.FirstSetPetTypeActivity
import com.abbidot.tracker.ui.activity.device.wifi.AddWifiPowerZone1Activity
import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
import com.abbidot.tracker.util.bluetooth.SRBleUtil
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
import com.abbidot.tracker.vm.PetInfoViewModel
import com.abbidot.tracker.vm.PetRelationViewModel
import com.abbidot.tracker.vm.UserProfileViewModel
import com.clj.fastble.BleManager
class PaymentSuccessActivity :
@@ -37,9 +41,13 @@ class PaymentSuccessActivity :
private val mAddTrackerViewModel: AddTrackerDeviceViewModel by viewModels()
private val mConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
private val mUserProfileViewModel: UserProfileViewModel by viewModels()
private val mPetRelationViewModel: PetRelationViewModel by viewModels()
private val mPetViewModel: PetInfoViewModel by viewModels()
private var mPayResult: PayResultBean? = null
private var mMac = ""
private var mPetBean: PetBean? = null
override fun getTopBar() = null
@@ -158,6 +166,61 @@ class PaymentSuccessActivity :
}
})
}
//默认单位设置
mUserProfileViewModel.mUpdateMeasureUnitLiveData.observe(this@PaymentSuccessActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
it.getOrNull()?.apply {
MMKVUtil.putInt(MMKVKey.MeasureUnit, ConstantInt.Type1)
PetBean().let { pet ->
pet.petName = "My Pet"
pet.deviceId = mPayResult!!.deviceId
pet.petType = ConstantInt.DogPetType
pet.gender = ConstantInt.WoMan
pet.macID=mMac
pet.birthdayDate = "2024-01-01"
pet.height = Utils.formatDecimal(Util.inToCm(20.0), 1).toFloat()
pet.weight = Utils.formatDecimal(Util.lbsToKg(25.0), 1).toFloat()
mPetBean = pet
mPetViewModel.addPet(this@PaymentSuccessActivity, pet)
}
}
}
})
}
//添加默认宠物
mPetViewModel.mAddPetLiveData.observe(this@PaymentSuccessActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
it.getOrNull()?.let { pet ->
mPetBean?.let { petBean ->
petBean.petId = pet.petId
mPetRelationViewModel.bindPet(
this@PaymentSuccessActivity, petBean.deviceId, petBean.petId
)
}
}
}
})
}
//绑定默认宠物
mPetRelationViewModel.mBindPetLiveData.observe(this@PaymentSuccessActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
XEventBus.post(EventName.RefreshPet)
showToast(R.string.txt_bind_success, isFinish = true)
mViewBinding.root.postDelayed({
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.isBind)
mPetBean?.apply {
val intent = Intent(mContext, AddWifiPowerZone1Activity::class.java)
intent.putExtra(ConstantString.Pet, this)
intent.putExtra(ConstantString.isFirstBind, true)
startActivity(intent)
}
}, 1500)
}
})
}
}
/**
@@ -172,12 +235,15 @@ class PaymentSuccessActivity :
XEventBus.post(EventName.PayBack)
mPayResult?.let {
if (it.rechargeType == ConstantInt.Type0) {
val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
intent.putExtra(ConstantString.isFirstBind, true)
startActivity(intent)
}
mUserProfileViewModel.updateMeasureUnit(
this@PaymentSuccessActivity, ConstantInt.Type1
)
// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
// intent.putExtra(ConstantString.isFirstBind, true)
// startActivity(intent)
} else finish()
}
finish()
}
}
}

View File

@@ -61,7 +61,7 @@ class SubscriptionPlanActivity :
mPlanAdapter,
2,
AppUtils.dpToPx(140),
offset = AppUtils.dpToPx(44)
offset = AppUtils.dpToPx(66)
)
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(

View File

@@ -37,7 +37,7 @@ class SureSubscriptionPlanActivity :
private var mOrderBean: SubscriptionsOrderBean? = null
//每年的保险服务费用
private val mInsuranceMoney = 12.90
// private val mInsuranceMoney = 12.90
//保险总费用
private var mSumInsuranceMoney = 0.0
@@ -88,7 +88,7 @@ class SureSubscriptionPlanActivity :
val totalDay = if (it.mealUnit == ConstantString.PackageUnitYear) {
it.mealPeriod * 365
} else {
30
30 * it.planTimeMonthsCount
}
mResidualMoney =
((it.totalAmountWithTax - it.tax - it.reactivatePrice) / totalDay) * it.surplusDays
@@ -110,68 +110,94 @@ class SureSubscriptionPlanActivity :
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)
// 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)
String.format(
getString(R.string.txt_renewal_year),
Utils.formatDecimal(p.autoRenewPrice, 2),
renewalDate
)
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 {
ilSubscribePlanDetail.tvSureSubscribePlanPer.text =
String.format(getString(R.string.txt_month_unit), p.period)
val renewalTimestamp = Utils.getAfterHowTimestamp(nowTimestamp, 30L)
val renewalTimestamp =
Utils.getAfterHowTimestamp(nowTimestamp, 30L * p.planTimeMonthsCount)
val renewalDate =
Utils.formatTime(renewalTimestamp, Utils.DATE_FORMAT_PATTERN_EN7)
String.format(
getString(R.string.txt_renewal_month),
Utils.formatDecimal(p.autoRenewPrice, 2),
renewalDate
)
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
val insuranceMoneyString =
"${p.period} x $${Utils.formatDecimal(mInsuranceMoney, 2)}"
ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
insuranceMoneyString
val packageName = "${p.planName}(${p.planCategory})"
ilSubscribePlanDetail.tvSureSubscribePlanName.text = packageName
val price = if (p.discountedPrice > 0.0) p.discountedPrice else p.planPrice
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, 2)
getString(R.string.txt_money_unit),
Utils.formatDecimal(price / p.planTimeMonthsCount, 1)
)
ilSubscribePlanDetail.tvSureSubscribePlanMoney.text = priceString
ViewUtil.instance.addMenuBean(
mSummaryAdapter.getData(),
p.planName,
Utils.formatDecimal(price, 2),
"$price",
colorRedId = R.color.data_black_color
)
mTotalMoney += price
mSumInsuranceMoney =
Utils.formatDecimal(mInsuranceMoney * p.period, 2).toDouble()
Utils.formatDecimal(p.everyMonthSafeFee * p.period * 12, 1).toDouble()
ViewUtil.instance.addMenuBean(
mSummaryAdapter.getData(),
getString(R.string.txt_annual_care_text),
Utils.formatDecimal(mSumInsuranceMoney, 2),
"$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, 2),
Utils.formatDecimal(mResidualMoney, 1),
colorRedId = R.color.red_color5,
isSwitch = true
)
@@ -209,8 +235,7 @@ class SureSubscriptionPlanActivity :
val list = mSummaryAdapter.getData()
if (isChecked) {
MenuTxtBean(
getString(R.string.txt_annual_care_text),
Utils.formatDecimal(mSumInsuranceMoney, 2)
getString(R.string.txt_annual_care_text), "$mSumInsuranceMoney"
).let {
it.colorRedId = R.color.data_black_color
list.add(1, it)
@@ -245,15 +270,16 @@ class SureSubscriptionPlanActivity :
mSubscriptionViewModel.mReactivationFeeLiveData.observe(this) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
it.getOrNull()?.apply {
mOrderBean?.reactivatePrice = this
mSummaryAdapter.getData().add(2, MenuTxtBean(
getString(R.string.txt_reactivation), Utils.formatDecimal(this, 2)
).apply {
colorRedId = R.color.data_black_color
})
mTotalMoney += this
}
// it.getOrNull()?.apply {
// mOrderBean?.reactivatePrice = this
// mSummaryAdapter.getData().add(
// 2, MenuTxtBean(
// getString(R.string.txt_reactivation), Utils.formatDecimal(this, 1)
// ).apply {
// colorRedId = R.color.data_black_color
// })
// mTotalMoney += this
// }
updateMoney()
}
})
@@ -263,14 +289,14 @@ class SureSubscriptionPlanActivity :
private fun updateMoney() {
mViewBinding.apply {
val list = mSummaryAdapter.getData()
val taxMoney = Utils.formatDecimal(mTaxRate * mTotalMoney, 2).toDouble()
val taxMoney = Utils.formatDecimal(mTaxRate * mTotalMoney, 1).toDouble()
mOrderBean?.tax = taxMoney
list[list.size - 1].menuValue = taxMoney.toString()
mTotalWithTaxMoney = taxMoney + mTotalMoney
mTotalWithTaxMoney = abs(mTotalWithTaxMoney)
ilSubscribePlanSummary.ilSureSubscribePlanTotalLayout.tvSubscribeSummaryItemMoney.text =
String.format(
getString(R.string.txt_money_unit), Utils.formatDecimal(mTotalWithTaxMoney, 2)
getString(R.string.txt_money_unit), Utils.formatDecimal(mTotalWithTaxMoney, 1)
)
mSummaryAdapter.notifyItemRangeChanged(0, list.size)
@@ -303,14 +329,15 @@ class SureSubscriptionPlanActivity :
mealName = cPlan.planName
mealId = cPlan.mealId
mealPeriod = cPlan.period
planTimeMonthsCount = cPlan.planTimeMonthsCount
mealUnit = cPlan.mealUnit
planCategory = cPlan.planCategory
// autoRenewPrice = Utils.formatDecimal(cPlan.autoRenewPrice * mTaxRate, 2).toDouble()
// autoRenewPrice = Utils.formatDecimal(cPlan.autoRenewPrice * mTaxRate, 1).toDouble()
autoRenewPrice = cPlan.autoRenewPrice
mealDesc =
mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanMoney.text.toString() + mViewBinding.ilSubscribePlanDetail.tvSureSubscribePlanPer.text.toString()
}
totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 2).toDouble()
totalAmountWithTax = Utils.formatDecimal(mTotalWithTaxMoney, 1).toDouble()
Intent(mContext, PaymentMethodActivity::class.java).let {
it.putExtra(ConstantString.LkSetMeal, this)
it.putExtra(ConstantString.RechargeType, mRechargeType)

View File

@@ -157,7 +157,7 @@ class Util {
return value * 0.3937
}
private fun inToCm(value: Double): Double {
fun inToCm(value: Double): Double {
return value * 2.54
}
@@ -165,7 +165,7 @@ class Util {
return value * 2.2065
}
private fun lbsToKg(value: Double): Double {
fun lbsToKg(value: Double): Double {
return value * 0.4532
}

View File

@@ -36,13 +36,13 @@
android:layout_height="wrap_content"
android:layout_alignTop="@id/tv_choose_plan_item_name"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_18"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="@dimen/dp_8"
android:paddingVertical="@dimen/dp_2"
app:qmui_backgroundColor="@color/orange_color4"
app:qmui_radius="@dimen/dp_38">
android:paddingHorizontal="@dimen/dp_10"
android:paddingVertical="@dimen/dp_4"
app:qmui_backgroundColor="@color/select_color2"
app:qmui_radius="@dimen/dp_18">
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_choose_plan_item_discount_percent"
@@ -50,11 +50,13 @@
android:layout_marginEnd="@dimen/dp_4"
android:text="25%"
android:textSize="@dimen/textSize16"
android:visibility="gone"
app:typeface="@string/roboto_bold_font" />
<com.abbidot.tracker.widget.TypefaceTextView
style="@style/my_TextView_style_v2"
android:text="OFF"
android:text="@string/txt_popular"
android:textColor="@color/select_color"
android:textSize="@dimen/textSize12"
app:typeface="@string/roboto_bold_font" />
</com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
@@ -72,8 +74,8 @@
<com.abbidot.tracker.widget.TypefaceTextView
style="@style/my_TextView_style_v2"
android:layout_alignBaseline="@id/tv_choose_plan_item_money"
android:layout_alignTop="@id/tv_choose_plan_item_money"
android:layout_alignBottom="@id/tv_choose_plan_item_money"
android:layout_toEndOf="@id/tv_choose_plan_item_money"
android:text="@string/txt_per_month"
android:textSize="@dimen/textSize14"
@@ -81,25 +83,23 @@
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_choose_plan_item_year_money"
android:id="@+id/tv_choose_plan_item_billed_money"
style="@style/my_TextView_style_v2"
android:layout_alignTop="@id/tv_choose_plan_item_money"
android:layout_alignBaseline="@id/tv_choose_plan_item_money"
android:layout_alignEnd="@id/ll_choose_plan_item_discount_percent"
android:layout_alignBottom="@id/tv_choose_plan_item_money"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color3"
android:textSize="@dimen/textSize14" />
android:text="@string/txt_billed_annually"
android:textColor="@color/select_color"
android:textSize="@dimen/textSize10" />
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_choose_plan_item_discount_money"
android:id="@+id/tv_choose_plan_item_plan_money"
style="@style/my_TextView_style_v2"
android:layout_alignTop="@id/tv_choose_plan_item_year_money"
android:layout_alignBottom="@id/tv_choose_plan_item_year_money"
android:layout_marginEnd="@dimen/dp_8"
android:layout_toStartOf="@id/tv_choose_plan_item_year_money"
android:layout_above="@id/tv_choose_plan_item_billed_money"
android:layout_alignEnd="@id/tv_choose_plan_item_billed_money"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color3"
android:textSize="@dimen/textSize14" />
android:textColor="@color/select_color"
android:textSize="@dimen/textSize16"
android:textStyle="bold" />
</RelativeLayout>
@@ -111,6 +111,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:visibility="gone"
app:cardBackgroundColor="@color/select_color2"
app:cardCornerRadius="@dimen/dp_50"
app:cardElevation="@dimen/dp_4">

View File

@@ -5,11 +5,12 @@
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="@dimen/dp_160"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_2"
android:minWidth="@dimen/dp_160"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/dp_20"
app:cardElevation="0dp">
@@ -19,12 +20,12 @@
android:id="@+id/rl_subscribe_plan_shade_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent">
android:background="@color/transparent"
android:paddingHorizontal="@dimen/dp_18">
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_subscribe_plan_item_name"
style="@style/my_TextView_style_v2"
android:layout_marginHorizontal="@dimen/dp_18"
android:layout_marginTop="@dimen/dp_16"
android:text="@string/app_name"
android:textSize="@dimen/textSize16"
@@ -46,6 +47,7 @@
style="@style/my_TextView_style_v2"
android:layout_below="@id/tv_subscribe_plan_as_low_as"
android:layout_alignStart="@id/tv_subscribe_plan_item_name"
android:layout_marginBottom="@dimen/dp_16"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color"
android:textSize="@dimen/textSize26"
@@ -64,9 +66,8 @@
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_subscribe_plan_item_per_year"
style="@style/my_TextView_style_v2"
android:layout_below="@id/tv_subscribe_plan_item_money"
android:layout_alignStart="@id/tv_subscribe_plan_item_money"
android:layout_marginBottom="@dimen/dp_16"
android:layout_alignBaseline="@id/tv_subscribe_plan_item_money"
android:layout_toEndOf="@id/tv_subscribe_plan_item_money"
android:text="@string/txt_per_month"
android:textColor="@color/select_color3"
android:textSize="@dimen/textSize14"

View File

@@ -6,7 +6,10 @@
android:orientation="vertical">
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/iv_sure_subscribe_plan_insurance"
style="@style/my_TextView_style_v2"
android:drawableEnd="@drawable/icon_tip_image_svg"
android:drawablePadding="@dimen/dp_4"
android:text="@string/txt_annual_care"
android:textSize="@dimen/textSize16"
android:textStyle="bold" />
@@ -19,63 +22,57 @@
android:paddingHorizontal="@dimen/dp_20"
android:paddingVertical="@dimen/dp_10">
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_insurance"
style="@style/my_TextView_style_v2"
android:text="@string/txt_replace_guarantee"
android:textSize="@dimen/textSize14"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_sure_subscribe_plan_insurance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/tv_sure_subscribe_plan_insurance"
android:layout_alignBottom="@id/tv_sure_subscribe_plan_insurance"
android:layout_marginStart="@dimen/dp_4"
android:layout_toEndOf="@id/tv_sure_subscribe_plan_insurance"
android:background="@drawable/selector_transparent_pressed"
android:src="@drawable/icon_tip_image_svg" />
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/cb_sure_subscribe_insure_switch"
style="@style/my_checkbox_switch_style"
android:layout_alignTop="@id/tv_sure_subscribe_plan_insurance"
android:layout_alignParentEnd="true"
android:checked="true" />
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_auto_renew_dec"
android:id="@+id/tv_sure_subscribe_plan_insurance"
style="@style/my_TextView_style_v2"
android:layout_alignTop="@id/cb_sure_subscribe_insure_switch"
android:layout_alignBottom="@id/cb_sure_subscribe_insure_switch"
android:text="@string/txt_replacement_year"
android:textSize="@dimen/textSize14" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_below="@id/tv_sure_subscribe_plan_insurance"
android:layout_marginEnd="@dimen/dp_45"
android:gravity="start"
android:text="@string/txt_replace_guarantee_dec"
android:textSize="@dimen/textSize14"
app:lineHeight="@dimen/textSize16"
app:typeface="@string/roboto_regular_font" />
android:layout_marginTop="@dimen/dp_10"
android:background="@color/block_color" />
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_insurance_money"
style="@style/my_TextView_style_v2"
android:layout_below="@id/tv_sure_subscribe_plan_auto_renew_dec"
android:layout_marginTop="@dimen/dp_10"
android:layout_below="@id/tv_sure_subscribe_plan_insurance"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color"
android:textSize="@dimen/textSize26"
android:textStyle="bold"
android:visibility="gone" />
android:textSize="@dimen/textSize16" />
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_insurance_per"
android:id="@+id/tv_sure_subscribe_plan_insurance_per_money"
style="@style/my_TextView_style_v2"
android:layout_below="@id/tv_sure_subscribe_plan_auto_renew_dec"
android:layout_marginTop="@dimen/dp_6"
android:text="1 x $12.9"
android:layout_alignTop="@id/tv_sure_subscribe_plan_insurance_money"
android:layout_alignBottom="@id/tv_sure_subscribe_plan_insurance_money"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color"
android:textSize="@dimen/textSize14"
app:typeface="@string/roboto_regular_font" />
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_insurance_per"
style="@style/my_TextView_style_v2"
android:layout_alignBaseline="@id/tv_sure_subscribe_plan_insurance_per_money"
android:layout_toEndOf="@id/tv_sure_subscribe_plan_insurance_per_money"
android:text="@string/txt_month_unit"
android:textSize="@dimen/textSize14"
app:typeface="@string/roboto_regular_font" />
</RelativeLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

View File

@@ -42,6 +42,7 @@
style="@style/my_TextView_style_v2"
android:layout_below="@id/tv_sure_subscribe_plan_name"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_2"
android:text="@string/txt_money_unit"
android:textColor="@color/select_color"
android:textStyle="bold" />
@@ -49,8 +50,8 @@
<com.abbidot.tracker.widget.TypefaceTextView
android:id="@+id/tv_sure_subscribe_plan_per"
style="@style/my_TextView_style_v2"
android:layout_alignBaseline="@id/tv_sure_subscribe_plan_money"
android:layout_alignTop="@id/tv_sure_subscribe_plan_money"
android:layout_alignBottom="@id/tv_sure_subscribe_plan_money"
android:layout_toEndOf="@id/tv_sure_subscribe_plan_money"
android:text="@string/txt_per_month"
android:textSize="@dimen/textSize14"

View File

@@ -676,11 +676,11 @@
<string name="txt_benefits">Benefits</string>
<string name="txt_monthly_subscription">Monthly Subscription</string>
<string name="txt_money_unit">$%s</string>
<string name="txt_per_month">/per month</string>
<string name="txt_per_year">/per year</string>
<string name="txt_per_month_money">$%s/per month</string>
<string name="txt_per_year_money">$%s/per year</string>
<string name="txt_popular">Popular</string>
<string name="txt_per_month">/month</string>
<string name="txt_per_year">/year</string>
<string name="txt_per_month_money">$%s/month</string>
<string name="txt_per_year_money">$%s/year</string>
<string name="txt_popular">Best value</string>
<string name="txt_confirm_plan">Confirm Your Plan</string>
<string name="txt_device_number">Device Number</string>
<string name="txt_terms_conditions_v2">Terms and Conditions</string>
@@ -941,12 +941,12 @@
<string name="txt_renewal_month">Renewal: $%s/month on %s</string>
<string name="txt_renewal_month1">Renewal:</string>
<string name="txt_renewal_month2">/month on</string>
<string name="txt_annual_care">Annual Care Protection</string>
<string name="txt_annual_care">Replacement Coverage</string>
<string name="txt_replace_guarantee_dec">$12.90/year for peace of mind and easy 1-unit replacement annually.</string>
<string name="txt_replace_guarantee">Replacement Guarantee</string>
<string name="txt_enter_discount_code">Enter discount code</string>
<string name="txt_check">Check</string>
<string name="txt_annual_care_text">Annual Care</string>
<string name="txt_annual_care_text">Replacement Coverage</string>
<string name="txt_annual_care_text1">Annual Care: </string>
<string name="txt_ble_connect_fail">Bluetooth connection failed</string>
<string name="txt_led_light_set">LED Light Settings</string>
@@ -966,7 +966,7 @@
<string name="txt_expired">Expired</string>
<string name="txt_upgrade_plan">Upgrade Your Plan</string>
<string name="txt_residual_value">Residual Value</string>
<string name="txt_month_unit">/%s month</string>
<string name="txt_month_unit">/month x%s</string>
<string name="txt_auto_subscription_year">(Renew at $%s per year thereafter)</string>
<string name="txt_auto_subscription_year1">(Renew at </string>
<string name="txt_auto_subscription_year2">per year thereafter)</string>
@@ -1030,5 +1030,21 @@
<string name="txt_as_low_as">As low as</string>
<string name="txt_payment_manager">Payment Manager</string>
<string name="txt_billed_annually">Billed annually</string>
<string name="txt_basic_plan">Basic Plan</string>
<string name="txt_premium_plan">Premium Plan</string>
<string name="txt_real_time_tracking">Real-time Tracking</string>
<string name="txt_activity_logs">Activity/Resting Logs</string>
<string name="txt_notifications_emergencies">Notifications for Emergencies</string>
<string name="txt_customized_led">Customized LED</string>
<string name="txt_bluetooth_radar">Bluetooth Radar</string>
<string name="txt_geofencing">Geofencing</string>
<string name="txt_route_records">Route History Records</string>
<string name="txt_family_sharing">Family Members Sharing</string>
<string name="txt_customer_support">Premium Customer Support</string>
<string name="txt_renewal_years">Renewal: $%s/%s years on %s</string>
<string name="txt_renewal_months">Renewal: $%s/%s months on %s</string>
<string name="txt_replacement_year">1 replacement/year, any reason</string>
</resources>