优化到期时间刷新功能

This commit is contained in:
cyh 2025-04-25 17:43:22 +08:00
parent c6f35f6223
commit 65f17fba52
1 changed files with 70 additions and 59 deletions

View File

@ -198,7 +198,8 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
noVerticalPadding = true,
horizontalPadding = false
)
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
getCustomView().findViewById<TextView>(R.id.tv_pay_finish)
.setOnClickListener {
goNewRecharge()
dismiss()
}
@ -820,6 +821,7 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
@SuppressLint("SimpleDateFormat")
fun setExpireDate() {
lifecycleScope.launch {
val isExpire = checkExpire()
var endTimeInfo = "--"
if (isExpire) {
@ -834,7 +836,8 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
}
}
} else {
val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
val validPeriod =
MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
val decodeString = MMKV.defaultMMKV().decodeString(BZYConstants.languageInfo, "")
if (decodeString.isNullOrEmpty()) {
@ -881,10 +884,18 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
}
}
this@HomeFragment.context?.let { mc ->
tvExpirationTime.setTextColor(
ContextCompat.getColor(
mc, R.color.blue_0136CB
)
)
}
}
tvExpirationTime.text = endTimeInfo
}
}
private fun goNewRecharge() {
if (activity != null) {