big fix: 线程切换问题

This commit is contained in:
level 2025-07-15 15:49:54 +08:00
parent 654f28c2cd
commit 0932839b27
1 changed files with 8 additions and 6 deletions

View File

@ -220,7 +220,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
return return
} }
showLoading(resources.getString(R.string.Starting), requireContext()) showLoading(resources.getString(R.string.Starting), requireContext())
startClash() startClash(true)
getDelayData() getDelayData()
} }
} }
@ -230,9 +230,11 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
fun stopClash() { fun stopClash() {
context?.stopClashService() context?.stopClashService()
} }
private fun startClash() { private fun startClash(isStart:Boolean) {
launch { launch {
delay(2000) if(isStart){
delay(2000)
}
NewMainActivity.profileBinder?.let { pm -> NewMainActivity.profileBinder?.let { pm ->
val active = pm.queryActive() val active = pm.queryActive()
if (active == null) { if (active == null) {
@ -400,12 +402,12 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
if (clashRunning) { if (clashRunning) {
Log.d("clashRunning $clashRunning") Log.d("clashRunning $clashRunning")
} else { } else {
startClash() startClash(false)
} }
checkGlo() checkGlo()
}?.run { }?.run {
if (isRunning == true && !clashRunning) { if (isRunning == true && !clashRunning) {
startClash() startClash(false)
} }
} }
} }
@ -419,7 +421,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
if (clashRunning) { if (clashRunning) {
Log.d("clashRunning $clashRunning") Log.d("clashRunning $clashRunning")
} else { } else {
startClash() startClash(false)
} }
} else { } else {
if (::rxDialogShapeLoading.isInitialized || rxDialogShapeLoading.isShowing) { if (::rxDialogShapeLoading.isInitialized || rxDialogShapeLoading.isShowing) {