big fix: 线程切换问题
This commit is contained in:
parent
82b2cb5662
commit
dce52cd52c
|
|
@ -257,12 +257,28 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
|
||||||
}
|
}
|
||||||
rxDialogSureCancel.show()
|
rxDialogSureCancel.show()
|
||||||
} else {
|
} else {
|
||||||
showLoading(resources.getString(R.string.Starting), requireContext())
|
if (checkExpire()) {
|
||||||
launch {
|
if (isAdded) {
|
||||||
delay(2000)
|
hideLoading()
|
||||||
startClash()
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clActivity.setOnClickListener {
|
clActivity.setOnClickListener {
|
||||||
|
|
@ -481,7 +497,7 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
|
||||||
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) {
|
||||||
|
|
@ -497,12 +513,12 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
|
||||||
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (requestCode == Proxy_Mode_REQUEST_CODE) {
|
} else if (requestCode == Proxy_Mode_REQUEST_CODE) {
|
||||||
|
|
@ -510,28 +526,11 @@ class HomeFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dispatcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startClash() {
|
private fun startClash(isStart:Boolean) {
|
||||||
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
|
|
||||||
}
|
|
||||||
launch {
|
launch {
|
||||||
|
if(isStart){
|
||||||
|
delay(2000)
|
||||||
|
}
|
||||||
profileBinder?.let { pm ->
|
profileBinder?.let { pm ->
|
||||||
val active = pm.queryActive()
|
val active = pm.queryActive()
|
||||||
if (active == null) {
|
if (active == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue