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