From 450ad7520d3e89ea0aa834bebef9939ca31b64b1 Mon Sep 17 00:00:00 2001 From: Ash Date: Sat, 15 Oct 2022 20:31:08 +0800 Subject: [PATCH] Fix update check --- app/src/main/java/me/ash/reader/CrashHandler.kt | 2 ++ app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/me/ash/reader/CrashHandler.kt b/app/src/main/java/me/ash/reader/CrashHandler.kt index ae38e53..59cd201 100644 --- a/app/src/main/java/me/ash/reader/CrashHandler.kt +++ b/app/src/main/java/me/ash/reader/CrashHandler.kt @@ -21,7 +21,9 @@ class CrashHandler(private val context: Context) : UncaughtExceptionHandler { */ override fun uncaughtException(p0: Thread, p1: Throwable) { Log.e("RLog", "uncaughtException: ${p1.message}") + Looper.myLooper() ?: Looper.prepare() context.showToastLong(p1.message) + Looper.loop() p1.printStackTrace() android.os.Process.killProcess(android.os.Process.myPid()); exitProcess(1) diff --git a/app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt b/app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt index 1f66ac4..8e58e04 100644 --- a/app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt +++ b/app/src/main/java/me/ash/reader/ui/ext/ContextExt.kt @@ -49,11 +49,9 @@ fun Context.installLatestApk() { private var toast: Toast? = null fun Context.showToast(message: String?, duration: Int = Toast.LENGTH_SHORT) { - Looper.myLooper() ?: Looper.prepare() toast?.cancel() toast = Toast.makeText(this, message, duration) toast?.show() - Looper.loop() } fun Context.showToastLong(message: String?) {