big fix: 启动问题

This commit is contained in:
level 2025-07-15 16:02:11 +08:00
parent 66971ecab1
commit 3bc5e26744
1 changed files with 29 additions and 30 deletions

View File

@ -173,12 +173,28 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
}
return@setOnClickListener
}else{
showLoading(resources.getString(R.string.Starting), requireContext())
launch {
delay(2000)
startClash()
if (checkExpire()) {
if (isAdded) {
MaterialDialog(requireContext()).show {
this.cancelable(false)
cornerRadius(res = R.dimen.dp_10)
customView(
R.layout.expired_recharge__layout,
scrollable = false,
noVerticalPadding = true,
horizontalPadding = false
)
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
goNewRecharge()
dismiss()
}
}
}
return@setOnClickListener
}
showLoading(resources.getString(R.string.Starting), requireContext())
startClash(true)
}
}
}
@ -201,28 +217,11 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
}
private fun startClash() {
if (checkExpire()) {
if (isAdded) {
hideLoading()
MaterialDialog(requireContext()).show {
this.cancelable(false)
cornerRadius(res = R.dimen.dp_10)
customView(
R.layout.expired_recharge__layout,
scrollable = false,
noVerticalPadding = true,
horizontalPadding = false
)
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
goNewRecharge()
dismiss()
}
}
}
return
}
private fun startClash(isStart:Boolean) {
launch {
if(isStart){
delay(2000)
}
profileBinder?.let { pm ->
val active = pm.queryActive()
if (active == null) {
@ -399,7 +398,7 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
if (clashRunning) {
Log.d("clashRunning $clashRunning")
} else {
startClash()
startClash(false)
}
} else {
if (::rxDialogShapeLoading.isInitialized || rxDialogShapeLoading.isShowing) {
@ -414,12 +413,12 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
if (clashRunning) {
Log.d("clashRunning $clashRunning")
} else {
startClash()
startClash(false)
}
checkGlo()
}?.run {
if (is_runing == true && !clashRunning) {
startClash()
startClash(false)
}
}
} else if (requestCode == Proxy_Mode_REQUEST_CODE) {
@ -431,12 +430,12 @@ class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatch
if (clashRunning) {
Log.d("clashRunning $clashRunning")
} else {
startClash()
startClash(false)
}
checkGlo()
}.run {
if (!clashRunning) {
startClash()
startClash(false)
}
}
}