修改不足一天,取消自动订阅出现过期的bug
This commit is contained in:
@@ -75,10 +75,10 @@ class MySubscriptionAdapter(
|
||||
}
|
||||
|
||||
holder.getTextView(R.id.tv_my_subscription_expires_on).apply {
|
||||
if (item.orderStatus == 6 && item.refundTime > 0L) {
|
||||
text = Utils.formatTime(item.refundTime, Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
text = if (item.orderStatus == 6 && item.refundTime > 0L) {
|
||||
Utils.formatTime(item.refundTime, Utils.DATE_FORMAT_PATTERN_EN6)
|
||||
} else {
|
||||
text = Utils.formatTime(
|
||||
Utils.formatTime(
|
||||
Utils.timestampAddHowTimestamp(
|
||||
item.payTime, item.mealPeriod, item.mealUnit
|
||||
), Utils.DATE_FORMAT_PATTERN_EN7
|
||||
@@ -97,38 +97,40 @@ class MySubscriptionAdapter(
|
||||
mContext.getString(R.string.tracker_manage_set_led_on)
|
||||
)
|
||||
}
|
||||
|
||||
val cTimeMillis = System.currentTimeMillis()
|
||||
val expiredTime = item.endTime * 1000 - cTimeMillis
|
||||
//是否过期套餐
|
||||
val isExpired =
|
||||
item.orderStatus == 6 || (item.subscriptionStatus == ConstantInt.Close && expiredTime <= 0)
|
||||
val userId = MMKVUtil.getString(MMKVKey.UserId)
|
||||
val expiresTitle = holder.getTextView(R.id.tv_my_subscription_expires_title)
|
||||
holder.getButton(R.id.btn_my_subscription_recharge).apply {
|
||||
visibility =
|
||||
if (item.orderStatus == 6 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
setText(R.string.txt_card_recharge)
|
||||
expiresTitle.setText(R.string.txt_expires_on2)
|
||||
View.VISIBLE
|
||||
} else if (item.subscriptionStatus == ConstantInt.Close) {
|
||||
setText(R.string.txt_enable_auto_renew)
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.VISIBLE
|
||||
} else {
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.GONE
|
||||
}
|
||||
visibility = if (isExpired) {
|
||||
setText(R.string.txt_card_recharge)
|
||||
expiresTitle.setText(R.string.txt_expires_on2)
|
||||
View.VISIBLE
|
||||
} else if (item.subscriptionStatus == ConstantInt.Close) {
|
||||
setText(R.string.txt_enable_auto_renew)
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.VISIBLE
|
||||
} else {
|
||||
expiresTitle.setText(R.string.txt_expires_on1)
|
||||
View.GONE
|
||||
}
|
||||
|
||||
//UserId不一样就是共享设备的订单
|
||||
visibility = if (item.userId == userId) visibility else View.GONE
|
||||
}
|
||||
|
||||
holder.getView(R.id.il_my_subscription_count_down).apply {
|
||||
visibility =
|
||||
if (item.orderStatus == 6 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
visibility = if (isExpired) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
val times = Utils.differYear(System.currentTimeMillis(), item.endTime)
|
||||
val times = Utils.differYear(cTimeMillis, item.endTime)
|
||||
holder.setText(R.id.tv_add_success_device_expires_days, times[0])
|
||||
holder.setText(R.id.tv_add_success_device_expires_hours, times[1])
|
||||
holder.setText(R.id.tv_add_success_device_expires_min, times[2])
|
||||
@@ -144,7 +146,7 @@ class MySubscriptionAdapter(
|
||||
}
|
||||
//充值
|
||||
holder.setClickListener(R.id.btn_my_subscription_recharge) {
|
||||
if (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close) {
|
||||
if (item.subscriptionStatus == ConstantInt.Close && expiredTime <= 0) {
|
||||
Intent(mContext, SubscriptionPlanActivity::class.java).let {
|
||||
it.putExtra(ConstantString.LkSetMeal, item)
|
||||
it.putExtra(ConstantString.RechargeType, ConstantInt.Type2)
|
||||
@@ -176,8 +178,10 @@ class MySubscriptionAdapter(
|
||||
}
|
||||
//升级套餐
|
||||
view.findViewById<TypefaceTextView>(R.id.tv_pop_my_subscription_auto_renew).apply {
|
||||
val cTimeMillis = System.currentTimeMillis()
|
||||
val expiredTime = item.endTime * 1000 - cTimeMillis
|
||||
visibility =
|
||||
if (item.planCategory == "Premium" || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
if (item.planCategory == "Premium" || (item.subscriptionStatus == ConstantInt.Close && expiredTime <= 0)) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
|
||||
@@ -51,8 +51,10 @@ class SubscriptionHistoryAdapter(
|
||||
R.id.tv_subscription_annual_care_order_id,
|
||||
context.getString(R.string.txt_order_id) + item.orderNum
|
||||
)
|
||||
val cTimeMillis = System.currentTimeMillis()
|
||||
val expiredTime = item.endTime * 1000 - cTimeMillis
|
||||
val state =
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
if (item.enabled == ConstantInt.Type0 || (item.subscriptionStatus == ConstantInt.Close && expiredTime <= 0)) {
|
||||
context.getString(R.string.txt_expired)
|
||||
} else {
|
||||
context.getString(R.string.txt_active)
|
||||
@@ -160,8 +162,10 @@ class SubscriptionHistoryAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
val cTimeMillis = System.currentTimeMillis()
|
||||
val expiredTime = item.endTime * 1000 - cTimeMillis
|
||||
val state =
|
||||
if (item.enabled == ConstantInt.Type0 || (item.surplusDays == 0L && item.subscriptionStatus == ConstantInt.Close)) {
|
||||
if (item.enabled == ConstantInt.Type0 || (item.subscriptionStatus == ConstantInt.Close && expiredTime <= 0)) {
|
||||
context.getString(R.string.txt_expired)
|
||||
} else {
|
||||
context.getString(R.string.txt_active)
|
||||
|
||||
@@ -194,6 +194,11 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
override fun onResult(any: Any) {
|
||||
showToast(R.string.txt_change_successful, isFinish = true)
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
isFinishSave = false
|
||||
mViewBinding.btnLedLightSetSave.isEnabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -439,6 +444,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
||||
.isConnected(mBleTrackDeviceBean!!.bleDevice)
|
||||
) ConstantInt.Type1
|
||||
else ConstantInt.Type2
|
||||
btnLedLightSetSave.isEnabled = false
|
||||
finishAndSave(modeType)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user