This commit is contained in:
parent
dbb09bbf78
commit
dd01f15497
|
|
@ -486,7 +486,7 @@ public class CallBackResolution {
|
|||
};
|
||||
executor.scheduleAtFixedRate(task, 0, 40, TimeUnit.SECONDS);
|
||||
} else if (tempTxt.contains("账号已更新")) {
|
||||
com.stand.standapp.MainActivity.showPttUpdateDialog();
|
||||
// com.stand.standapp.MainActivity.showPttUpdateDialog();
|
||||
} else if (tempTxt.contains("账号或密码错误")) {
|
||||
CallBackUtil.callBackLogin(false, "");
|
||||
}else if (tempTxt.contains("请配置账号")) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ class MainActivity : AppCompatActivity() {
|
|||
companion object {
|
||||
private var instance: MainActivity? = null
|
||||
|
||||
// 防止对话框堆叠
|
||||
@Volatile
|
||||
private var isConflictDialogShowing = false
|
||||
|
||||
// 待执行的 JS 代码(由 bridge.js 轮询获取)
|
||||
@Volatile
|
||||
private var pendingJsCode: String? = null
|
||||
|
|
@ -54,6 +58,8 @@ class MainActivity : AppCompatActivity() {
|
|||
|
||||
@JvmStatic
|
||||
fun showPttConflictDialog() {
|
||||
if (isConflictDialogShowing) return
|
||||
isConflictDialogShowing = true
|
||||
instance?.runOnUiThread {
|
||||
val ctx = instance ?: return@runOnUiThread
|
||||
androidx.appcompat.app.AlertDialog.Builder(ctx)
|
||||
|
|
@ -63,12 +69,15 @@ class MainActivity : AppCompatActivity() {
|
|||
.setPositiveButton("确认") { _, _ ->
|
||||
com.stand.standapp.utils.AppKiller.killApp(ctx, restart = true)
|
||||
}
|
||||
.setOnDismissListener { isConflictDialogShowing = false }
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showPttUpdateDialog() {
|
||||
if (isConflictDialogShowing) return
|
||||
isConflictDialogShowing = true
|
||||
instance?.runOnUiThread {
|
||||
val ctx = instance ?: return@runOnUiThread
|
||||
androidx.appcompat.app.AlertDialog.Builder(ctx)
|
||||
|
|
@ -78,6 +87,7 @@ class MainActivity : AppCompatActivity() {
|
|||
.setPositiveButton("确认") { _, _ ->
|
||||
com.stand.standapp.utils.AppKiller.killApp(ctx, restart = true)
|
||||
}
|
||||
.setOnDismissListener { isConflictDialogShowing = false }
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ object AppKiller {
|
|||
|
||||
if (!isCrash) {
|
||||
try {
|
||||
Thread.sleep(200)
|
||||
Thread.sleep(50)
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ object AppKiller {
|
|||
val flags = android.app.PendingIntent.FLAG_ONE_SHOT or android.app.PendingIntent.FLAG_IMMUTABLE
|
||||
val pendingIntent = android.app.PendingIntent.getActivity(context, 223344, intent, flags)
|
||||
val mgr = context.getSystemService(Context.ALARM_SERVICE) as android.app.AlarmManager
|
||||
mgr.set(android.app.AlarmManager.RTC, System.currentTimeMillis() + 500, pendingIntent)
|
||||
mgr.set(android.app.AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent)
|
||||
}
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue