优化到期时间刷新功能

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, noVerticalPadding = true,
horizontalPadding = false horizontalPadding = false
) )
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener { getCustomView().findViewById<TextView>(R.id.tv_pay_finish)
.setOnClickListener {
goNewRecharge() goNewRecharge()
dismiss() dismiss()
} }
@ -820,6 +821,7 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
fun setExpireDate() { fun setExpireDate() {
lifecycleScope.launch {
val isExpire = checkExpire() val isExpire = checkExpire()
var endTimeInfo = "--" var endTimeInfo = "--"
if (isExpire) { if (isExpire) {
@ -834,7 +836,8 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
} }
} }
} else { } 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, "") val decodeString = MMKV.defaultMMKV().decodeString(BZYConstants.languageInfo, "")
if (decodeString.isNullOrEmpty()) { 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 tvExpirationTime.text = endTimeInfo
} }
}
private fun goNewRecharge() { private fun goNewRecharge() {
if (activity != null) { if (activity != null) {