增加保险订单详情,优化图表x轴动态变化超过1440min问题
This commit is contained in:
@@ -28,9 +28,9 @@ android {
|
||||
applicationId "com.abbidot.tracker"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 35
|
||||
versionCode 2020
|
||||
versionName "2.0.20"
|
||||
// versionName "2.0.20-Beta5"
|
||||
versionCode 2021
|
||||
// versionName "2.0.21"
|
||||
versionName "2.0.21-Beta1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package com.abbidot.tracker.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
|
||||
import com.abbidot.baselibrary.list.RecyclerViewHolder
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.abbidot.baselibrary.util.Utils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.abbidot.tracker.ui.activity.subscribe.RequestRefundActivity
|
||||
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
|
||||
|
||||
/**
|
||||
*Created by .yzq on 2024/8/19/019.
|
||||
@@ -21,21 +23,66 @@ import com.abbidot.tracker.widget.TypefaceRoundButton
|
||||
* @description:
|
||||
*/
|
||||
class SubscriptionHistoryAdapter(
|
||||
ctx: Context, list: MutableList<SubscriptionsOrderBean>?
|
||||
) : BaseRecyclerAdapter<SubscriptionsOrderBean>(ctx, list) {
|
||||
list: MutableList<SubscriptionsOrderBean>?
|
||||
) : BaseMultiItemQuickAdapter<SubscriptionsOrderBean, BaseViewHolder>(list) {
|
||||
|
||||
private val mHistoryActivity = ctx as SubscriptionHistoryActivity
|
||||
private lateinit var mHistoryActivity: SubscriptionHistoryActivity
|
||||
|
||||
override fun getEmptyLayoutId(viewType: Int) = 0
|
||||
init {
|
||||
addItemType(MultipleEntity.TEXT, R.layout.item_subscription_history_layout)
|
||||
addItemType(MultipleEntity.IMG, R.layout.item_annual_care_history_layout)
|
||||
}
|
||||
|
||||
override fun getItemLayoutId(viewType: Int) = R.layout.item_subscription_history_layout
|
||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView)
|
||||
mHistoryActivity = context as SubscriptionHistoryActivity
|
||||
}
|
||||
|
||||
override fun bindData(
|
||||
holder: RecyclerViewHolder?, position: Int, item: SubscriptionsOrderBean
|
||||
) {
|
||||
holder!!.setText(
|
||||
override fun convert(holder: BaseViewHolder, item: SubscriptionsOrderBean) {
|
||||
// val position = getItemPosition(item)
|
||||
when (item.itemType) {
|
||||
MultipleEntity.TEXT -> bindOrderData(holder, item)
|
||||
MultipleEntity.IMG -> bindAnnualCareData(holder, item)
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindAnnualCareData(holder: BaseViewHolder, item: SubscriptionsOrderBean) {
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_order_id,
|
||||
context.getString(R.string.txt_order_id) + item.orderNum
|
||||
)
|
||||
val state =
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
context.getString(R.string.txt_expired)
|
||||
} else {
|
||||
context.getString(R.string.txt_active)
|
||||
}
|
||||
holder.setText(R.id.tv_subscription_annual_care_state, state)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_active_time,
|
||||
Utils.stringToDate(item.createTime, resultFormat = Utils.DATE_FORMAT_PATTERN_EN7)
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_expiry_time, Utils.formatTime(
|
||||
Utils.getAfterHowTimestamp(
|
||||
Utils.stringToTimestamp(item.createTime), item.mealPeriod * 365L
|
||||
), Utils.DATE_FORMAT_PATTERN_EN7
|
||||
)
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_package,
|
||||
String.format(context.getString(R.string.txt_year_care), "${item.mealPeriod}")
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_annual_care_price,
|
||||
String.format(context.getString(R.string.txt_money_unit), "${item.annualCarePrice}")
|
||||
)
|
||||
}
|
||||
|
||||
private fun bindOrderData(holder: BaseViewHolder, item: SubscriptionsOrderBean) {
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_order_id,
|
||||
mContext.getString(R.string.txt_order_id) + item.orderNum
|
||||
context.getString(R.string.txt_order_id) + item.orderNum
|
||||
)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_order_time,
|
||||
@@ -44,13 +91,13 @@ class SubscriptionHistoryAdapter(
|
||||
holder.setText(R.id.tv_subscription_history_package_name, item.mealName)
|
||||
holder.setText(
|
||||
R.id.tv_subscription_history_package_price,
|
||||
String.format(mContext.getString(R.string.txt_money_unit), "${item.totalAmountWithTax}")
|
||||
String.format(context.getString(R.string.txt_money_unit), "${item.totalAmountWithTax}")
|
||||
)
|
||||
|
||||
|
||||
(holder.getView(R.id.btn_subscription_history_operate) as TypefaceRoundButton).apply {
|
||||
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.line_color1))
|
||||
setTextColor(ContextCompat.getColor(context, R.color.line_color1))
|
||||
|
||||
if (item.enabled == ConstantInt.Type0) visibility = View.GONE
|
||||
else {
|
||||
@@ -79,14 +126,14 @@ class SubscriptionHistoryAdapter(
|
||||
visibility = View.GONE
|
||||
}
|
||||
}
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.select_color))
|
||||
setTextColor(ContextCompat.getColor(context, R.color.select_color))
|
||||
}
|
||||
|
||||
4 -> setText(R.string.txt_waiting)
|
||||
5 -> setText(R.string.txt_refunding)
|
||||
6 -> setText(R.string.txt_refunded)
|
||||
7, 8 -> {
|
||||
setTextColor(ContextCompat.getColor(mContext, R.color.orange_red_color))
|
||||
setTextColor(ContextCompat.getColor(context, R.color.orange_red_color))
|
||||
setText(R.string.txt_rejected)
|
||||
}
|
||||
|
||||
@@ -97,7 +144,7 @@ class SubscriptionHistoryAdapter(
|
||||
setChangeAlphaWhenPress(true)
|
||||
setOnClickListener {
|
||||
if (item.orderStatus == ConstantInt.Type1) {
|
||||
Intent(mContext, RequestRefundActivity::class.java).apply {
|
||||
Intent(context, RequestRefundActivity::class.java).apply {
|
||||
putExtra(ConstantString.SetMeal, item)
|
||||
mHistoryActivity.startActivity(this)
|
||||
}
|
||||
@@ -107,16 +154,17 @@ class SubscriptionHistoryAdapter(
|
||||
|
||||
val state =
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
mContext.getString(R.string.txt_expired)
|
||||
context.getString(R.string.txt_expired)
|
||||
} else {
|
||||
mContext.getString(R.string.txt_active)
|
||||
context.getString(R.string.txt_active)
|
||||
}
|
||||
holder.setText(R.id.tv_subscription_history_subscription_state, state)
|
||||
|
||||
holder.getTextView(R.id.tv_subscription_history_annual_care).apply {
|
||||
holder.getView<TextView>(R.id.tv_subscription_history_annual_care).apply {
|
||||
text =
|
||||
if (item.annualCareType == ConstantInt.Type1) mContext.getString(R.string.start_txt_yes)
|
||||
else mContext.getString(R.string.txt_no)
|
||||
if (item.annualCareType == ConstantInt.Type1) context.getString(R.string.start_txt_yes)
|
||||
else context.getString(R.string.txt_no)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,7 +73,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
|
||||
//网络请求失败,需要重试次数
|
||||
var mNetworkRequestsFailRetryCount = 0
|
||||
val mNetworkRequestsFailMaxCount = 3
|
||||
val mNetworkRequestsFailMaxCount = 3
|
||||
val mNetworkRequestsFailLimit = "networkRequestsFailLimit"
|
||||
|
||||
//是否拦截网络请求错误code提示
|
||||
@@ -121,9 +121,6 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
listenBackPressed()
|
||||
//Removing this callback
|
||||
// remove()
|
||||
// onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -344,14 +341,6 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
finish()
|
||||
}
|
||||
|
||||
/**
|
||||
* 拦截返回按键
|
||||
*/
|
||||
// override fun onBackPressed() {
|
||||
// leftBackOnClick()
|
||||
// super.onBackPressed()
|
||||
// }
|
||||
|
||||
open fun listenBackPressed() {
|
||||
leftBackOnClick()
|
||||
}
|
||||
@@ -698,7 +687,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
/**
|
||||
* 隐藏软键盘
|
||||
*/
|
||||
fun hideInputMethod(view: View): Boolean {
|
||||
fun hideInputMethod(view: View): Boolean {
|
||||
getInputMethodManager()?.apply {
|
||||
return hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
|
||||
@@ -6,5 +6,8 @@ package com.abbidot.tracker.bean
|
||||
* @description:
|
||||
*/
|
||||
data class CommonDataBean(
|
||||
var taxRate: Double, var surplusSafeValidMonths: Int, var reactivationFee: Double
|
||||
var taxRate: Double,
|
||||
var surplusSafeValidMonths: Int,
|
||||
var reactivationFee: Double,
|
||||
var surplusSafeValidFee: Double
|
||||
)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.abbidot.tracker.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.abbidot.tracker.constant.MultipleEntity
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
@@ -51,8 +54,55 @@ data class SubscriptionsOrderBean(
|
||||
var iccid: String,
|
||||
var endTime: Long,
|
||||
var planTimeMonthsCount: Int,
|
||||
@MultipleEntity var menuType: Int,
|
||||
var isUpdateOrder: Int = 0//是否是升级订单 1:是 0:否
|
||||
) : Parcelable {
|
||||
) : Parcelable, MultiItemEntity {
|
||||
constructor(@MultipleEntity menuType: Int) : this(
|
||||
0.0,
|
||||
0,
|
||||
"",
|
||||
0.0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0.0,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0L,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0L,
|
||||
0,
|
||||
menuType,
|
||||
0
|
||||
)
|
||||
|
||||
constructor() : this(
|
||||
0.0,
|
||||
0,
|
||||
@@ -95,6 +145,11 @@ data class SubscriptionsOrderBean(
|
||||
"",
|
||||
0L,
|
||||
0,
|
||||
MultipleEntity.TEXT,
|
||||
0
|
||||
)
|
||||
|
||||
@IgnoredOnParcel
|
||||
@MultipleEntity
|
||||
override val itemType = menuType
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ class FencesAddActivity : BaseActivity<ActivityFencesAddBinding>(ActivityFencesA
|
||||
mFencesManageViewModel.mUpdateFenceLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
successTips(R.string.txt_save_successful)
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class FencesAddActivity : BaseActivity<ActivityFencesAddBinding>(ActivityFencesA
|
||||
mFencesManageViewModel.mFencesAddLiveData.observe(this) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
successTips(R.string.txt_save_successful)
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
sendNotifyData()
|
||||
successTips(R.string.txt_save_successful)
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
@@ -328,7 +328,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
sendNotifyData()
|
||||
successTips(R.string.txt_save_successful)
|
||||
successTips(R.string.txt_fence_saved)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,8 +5,11 @@ import com.abbidot.baselibrary.util.AppUtils
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.adapter.SubscriptionHistoryAdapter
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
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.constant.MultipleEntity
|
||||
import com.abbidot.tracker.databinding.ActivitySubscriptionHistoryBinding
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.vm.SubscriptionManageViewModel
|
||||
@@ -17,6 +20,7 @@ class SubscriptionHistoryActivity :
|
||||
private val mSubscriptionViewModel: SubscriptionManageViewModel by viewModels()
|
||||
|
||||
private lateinit var mHistoryAdapter: SubscriptionHistoryAdapter
|
||||
private var mSubscriptionsOrderList = mutableListOf<SubscriptionsOrderBean>()
|
||||
private var mDeviceId = ""
|
||||
|
||||
override fun getTopBar() = mViewBinding.ilSubscriptionHistoryTopBar.titleTopBar
|
||||
@@ -26,7 +30,7 @@ class SubscriptionHistoryActivity :
|
||||
setTopBarTitle(R.string.txt_subscription_history)
|
||||
setLeftBackImage(R.drawable.icon_white_back_svg)
|
||||
|
||||
mHistoryAdapter = SubscriptionHistoryAdapter(this@SubscriptionHistoryActivity, null)
|
||||
mHistoryAdapter = SubscriptionHistoryAdapter(mSubscriptionsOrderList)
|
||||
mViewBinding.apply {
|
||||
ViewUtil.instance.setRecyclerViewVerticalLinearLayout(
|
||||
mContext, rvSubscriptionHistoryList, mHistoryAdapter, bottom = AppUtils.dpToPx(12)
|
||||
@@ -51,7 +55,22 @@ class SubscriptionHistoryActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
it.getOrNull()?.let { list ->
|
||||
mHistoryAdapter.setData(list, true)
|
||||
for (l in list) {
|
||||
mSubscriptionsOrderList.add(l)
|
||||
if (l.annualCareType == ConstantInt.Type1) {
|
||||
val subscriptionsOrder = SubscriptionsOrderBean(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)
|
||||
}
|
||||
}
|
||||
mHistoryAdapter.notifyItemRangeChanged(0, mSubscriptionsOrderList.size)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -265,6 +265,7 @@ class SureSubscriptionPlanActivity :
|
||||
if (AppUtils.isChina(AppUtils.SWITCH_MAP_TYPE)) {
|
||||
sureSubscriptionDetail()
|
||||
} else {
|
||||
showNoCancelableLoading(true)
|
||||
setButtonEnabled(btnSureSubscribePlan1Continue, ConstantInt.Type0)
|
||||
mGoogleLocationViewModel.getLastLocation(mContext)
|
||||
}
|
||||
@@ -273,6 +274,7 @@ class SureSubscriptionPlanActivity :
|
||||
|
||||
private fun sureSubscriptionDetail() {
|
||||
mViewBinding.apply {
|
||||
showNoCancelableLoading(false)
|
||||
setButtonEnabled(btnSureSubscribePlan1Continue, ConstantInt.Type1)
|
||||
mOrderBean?.let {
|
||||
if (isUpgrade) {
|
||||
@@ -397,21 +399,25 @@ class SureSubscriptionPlanActivity :
|
||||
}
|
||||
|
||||
//判断套餐是否过期
|
||||
// if (!TextUtils.isEmpty(it.orderNum) && it.surplusDays == 0L && it.subscriptionStatus == ConstantInt.Close) {
|
||||
if (!TextUtils.isEmpty(it.orderNum) && it.surplusDays == 0L && it.subscriptionStatus == ConstantInt.Close) {
|
||||
// mOrderBean?.reactivation = 1
|
||||
// mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
// } else {
|
||||
mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
} else {
|
||||
if (isUpgrade) mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
else {
|
||||
mOrderBean?.reactivation = 0
|
||||
mOrderBean?.reactivatePrice = 0.0
|
||||
updateMoney()
|
||||
}
|
||||
}
|
||||
|
||||
// if (TextUtils.isEmpty(it.orderNum)) {
|
||||
// mOrderBean?.reactivation = 0
|
||||
// mOrderBean?.reactivatePrice = 0.0
|
||||
// updateMoney()
|
||||
// } else {
|
||||
// mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
// }
|
||||
if (TextUtils.isEmpty(it.orderNum)) {
|
||||
mOrderBean?.reactivation = 0
|
||||
mOrderBean?.reactivatePrice = 0.0
|
||||
updateMoney()
|
||||
} else {
|
||||
mSubscriptionViewModel.getReactivationFee(it.orderNum)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,16 +449,19 @@ class SureSubscriptionPlanActivity :
|
||||
it.getOrNull()?.apply {
|
||||
mPackageBean?.let { p ->
|
||||
mTotalMoney -= mSumInsuranceMoney
|
||||
val howSafeValidMonths =
|
||||
p.planTimeMonthsCount - surplusSafeValidMonths
|
||||
if (howSafeValidMonths > 0) {
|
||||
if (isUpgrade) {
|
||||
//升级套餐,把之前剩余保险费退还,再重新买1年的保险
|
||||
mTotalMoney -= surplusSafeValidFee
|
||||
mResidualMoney = Utils.formatDecimal(
|
||||
mResidualMoney + surplusSafeValidFee, 1
|
||||
).toDouble()
|
||||
val insuranceMoneyString = String.format(
|
||||
getString(R.string.txt_month_unit), "$howSafeValidMonths"
|
||||
getString(R.string.txt_month_unit), "${12 * p.period}"
|
||||
)
|
||||
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
|
||||
insuranceMoneyString
|
||||
mSumInsuranceMoney = Utils.formatDecimal(
|
||||
howSafeValidMonths * p.everyMonthSafeFee, 1
|
||||
12 * p.everyMonthSafeFee * p.period, 1
|
||||
).toDouble()
|
||||
mTotalMoney += mSumInsuranceMoney
|
||||
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text =
|
||||
@@ -460,10 +469,31 @@ class SureSubscriptionPlanActivity :
|
||||
getString(R.string.txt_money_unit),
|
||||
"$mSumInsuranceMoney"
|
||||
)
|
||||
mSummaryAdapter.getData()[2].menuValue = "$mResidualMoney"
|
||||
} else {
|
||||
mSumInsuranceMoney = 0.0
|
||||
mViewBinding.ilSubscribePlanInsurance.root.visibility =
|
||||
View.GONE
|
||||
val howSafeValidMonths =
|
||||
p.planTimeMonthsCount - surplusSafeValidMonths
|
||||
if (howSafeValidMonths > 0) {
|
||||
val insuranceMoneyString = String.format(
|
||||
getString(R.string.txt_month_unit),
|
||||
"$howSafeValidMonths"
|
||||
)
|
||||
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsurancePer.text =
|
||||
insuranceMoneyString
|
||||
mSumInsuranceMoney = Utils.formatDecimal(
|
||||
howSafeValidMonths * p.everyMonthSafeFee, 1
|
||||
).toDouble()
|
||||
mTotalMoney += mSumInsuranceMoney
|
||||
mViewBinding.ilSubscribePlanInsurance.tvSureSubscribePlanInsuranceMoney.text =
|
||||
String.format(
|
||||
getString(R.string.txt_money_unit),
|
||||
"$mSumInsuranceMoney"
|
||||
)
|
||||
} else {
|
||||
mSumInsuranceMoney = 0.0
|
||||
mViewBinding.ilSubscribePlanInsurance.root.visibility =
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
mSummaryAdapter.getData()[1].menuValue = "$mSumInsuranceMoney"
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ class SRBleUtil private constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开蓝牙上报通道
|
||||
* 打开蓝牙日志上报通道
|
||||
*/
|
||||
private fun openBleReportNotify(
|
||||
bleDevice: BleDevice, uuid_service: String, uuid_notify: String
|
||||
@@ -237,21 +237,19 @@ class SRBleUtil private constructor() {
|
||||
BleManager.getInstance()
|
||||
.notify(bleDevice, uuid_service, uuid_notify, object : BleNotifyCallback() {
|
||||
override fun onNotifySuccess() {
|
||||
// Toaster.show("打开蓝牙上报通道成功")
|
||||
LogUtil.e("打开蓝牙上报通道成功:${bleDevice.name}--${bleDevice.mac}")
|
||||
LogUtil.e("打开蓝牙日志上报通道成功:${bleDevice.name}--${bleDevice.mac}")
|
||||
openLogReportNotify(bleDevice, notifyServiceUUID, logNotifyCharacteristicUUID)
|
||||
}
|
||||
|
||||
override fun onNotifyFailure(exception: BleException?) {
|
||||
// Toaster.show("打开蓝牙上报通道失败")
|
||||
LogUtil.e("打开蓝牙上报通道失败:${bleDevice.mac},$exception")
|
||||
LogUtil.e("打开蓝牙日志上报通道失败:${bleDevice.mac},$exception")
|
||||
openLogReportNotify(bleDevice, notifyServiceUUID, logNotifyCharacteristicUUID)
|
||||
}
|
||||
|
||||
override fun onCharacteristicChanged(data: ByteArray?) {
|
||||
data?.apply {
|
||||
val formatData = HexUtil.formatHexString(data, true)
|
||||
LogUtil.e("接收蓝牙上报通道数据:${bleDevice.mac},$formatData")
|
||||
LogUtil.e("接收蓝牙日志上报通道数据:${bleDevice.mac},$formatData")
|
||||
val deviceData = ReceiveDeviceData(bleDevice, data, bleDevice.mac)
|
||||
XEventBus.post(EventName.BleReport, deviceData)
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class HorizontalBarChartView : View {
|
||||
val value = this[i]
|
||||
val top =
|
||||
mHeight - (ySpace * (i + 1)) - mBarHeight / 2 - textHeight * (i + 1) - textHeight / 4
|
||||
val right = value * mValueHeight + textHeight / 4
|
||||
val right = value * mValueHeight
|
||||
val bottom = top + mBarHeight
|
||||
|
||||
mPaint.color = mBarValueBgColor
|
||||
@@ -192,10 +192,7 @@ class HorizontalBarChartView : View {
|
||||
if (value < 0) continue
|
||||
|
||||
//防止动画从x轴原点以下开始出现
|
||||
val newRight = with(right * mAnimatedPercent) {
|
||||
if (this < left) left + value * mValueHeight * mAnimatedPercent
|
||||
else this
|
||||
}
|
||||
val newRight = left + right * mAnimatedPercent
|
||||
|
||||
if (value == mMaxValue) {
|
||||
canvas.drawRoundRect(
|
||||
@@ -214,7 +211,11 @@ class HorizontalBarChartView : View {
|
||||
val string = if (mConvertHour) {
|
||||
val h = value / 60
|
||||
val m = value % 60
|
||||
"${h}hr ${m}min"
|
||||
when (h) {
|
||||
24 -> "${h}hr"
|
||||
0 -> "${m}min"
|
||||
else -> "${h}hr ${m}min"
|
||||
}
|
||||
} else {
|
||||
"$value min"
|
||||
}
|
||||
@@ -246,6 +247,7 @@ class HorizontalBarChartView : View {
|
||||
}
|
||||
//根据y轴最大值决定x轴的值
|
||||
mMaxYAxisValue = (mMaxValue / 60 + 1) * 60
|
||||
if (mMaxYAxisValue > 24 * 60) mMaxYAxisValue = 24 * 60
|
||||
val step = mMaxYAxisValue / 6
|
||||
for (i in 1..6) {
|
||||
mXAxis[i] = (i * step).toString()
|
||||
|
||||
@@ -257,6 +257,7 @@ class LineChartView : View {
|
||||
}
|
||||
//根据x轴最大值决定y轴的值
|
||||
mMaxYAxisValue = (mMaxValue / 60 + 1) * 60
|
||||
if (mMaxYAxisValue > 24 * 60) mMaxYAxisValue = 24 * 60
|
||||
val step = mMaxYAxisValue / 6
|
||||
for (i in 0..5) {
|
||||
mYAxis[i] = (i + 1) * step
|
||||
|
||||
7
app/src/main/res/drawable/shape20_light_yellow_bg.xml
Normal file
7
app/src/main/res/drawable/shape20_light_yellow_bg.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--白色的圆角背景-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/grey_color_90" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
84
app/src/main/res/layout/item_annual_care_history_layout.xml
Normal file
84
app/src/main/res/layout/item_annual_care_history_layout.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape20_light_yellow_bg"
|
||||
android:paddingHorizontal="@dimen/dp_20"
|
||||
android:paddingTop="@dimen/dp_20"
|
||||
android:paddingBottom="@dimen/dp_24">
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_order_id"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:text="@string/txt_order_id"
|
||||
android:textSize="@dimen/textSize12"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_state"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/dp_6"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="@dimen/textSize14"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_active_time_title"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/tv_subscription_annual_care_state"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="@string/txt_active_time1"
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_active_time"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_alignTop="@id/tv_subscription_annual_care_active_time_title"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_toEndOf="@id/tv_subscription_annual_care_active_time_title"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="@dimen/textSize14"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_expiry_time_title"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/tv_subscription_annual_care_active_time_title"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:text="@string/txt_expiry_time"
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_expiry_time"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_alignTop="@id/tv_subscription_annual_care_expiry_time_title"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_toEndOf="@id/tv_subscription_annual_care_expiry_time_title"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="@dimen/textSize14"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_price"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_below="@id/tv_subscription_annual_care_expiry_time_title"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:text="@string/txt_money_unit"
|
||||
android:textSize="@dimen/textSize16"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_subscription_annual_care_package"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_alignTop="@id/tv_subscription_annual_care_price"
|
||||
android:layout_alignBottom="@id/tv_subscription_annual_care_price"
|
||||
android:text="@string/txt_year_care"
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
@@ -865,7 +865,7 @@
|
||||
<string name="txt_expired">Abgelaufen</string>
|
||||
<string name="txt_upgrade_plan">Tarif upgraden</string>
|
||||
<string name="txt_residual_value">Restwert</string>
|
||||
<string name="txt_month_unit">/%s Monat</string>
|
||||
<string name="txt_month_unit">/Monat x%s</string>
|
||||
<string name="txt_auto_subscription_year">(Verlängerung zu $%s jährlich danach)</string>
|
||||
<string name="txt_auto_subscription_year1">(Verlängerung zu</string>
|
||||
<string name="txt_auto_subscription_year2">jährlich danach)</string>
|
||||
|
||||
@@ -908,7 +908,7 @@
|
||||
<string name="txt_expired">已过期</string>
|
||||
<string name="txt_upgrade_plan">升级您的套餐</string>
|
||||
<string name="txt_residual_value">剩余价值</string>
|
||||
<string name="txt_month_unit">/%s月</string>
|
||||
<string name="txt_month_unit">/月 x%s</string>
|
||||
<string name="txt_auto_subscription_year">(此后按每年 $%s 续订)</string>
|
||||
<string name="txt_auto_subscription_year1">(此后按</string>
|
||||
<string name="txt_auto_subscription_year2">/年续费)</string>
|
||||
|
||||
@@ -370,4 +370,5 @@
|
||||
<color name="device_msg_color1">#FFE0E0</color>
|
||||
<color name="permission_no_check_color">#EEEFEF</color>
|
||||
<color name="grey_color_64">#64000000</color>
|
||||
<color name="grey_color_90">#F9FFE3</color>
|
||||
</resources>
|
||||
@@ -1046,5 +1046,8 @@
|
||||
<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>
|
||||
<string name="txt_expiry_time">Expiry Time:</string>
|
||||
<string name="txt_year_care">%s Year Care</string>
|
||||
<string name="txt_fence_saved">Saved. Active when online.</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user