Horis 2 lat temu
rodzic
commit
a649bd9ccd

+ 6 - 6
app/src/main/java/io/legado/app/ui/about/AboutFragment.kt

@@ -121,7 +121,7 @@ class AboutFragment : PreferenceFragmentCompat() {
     private fun saveLog() {
     private fun saveLog() {
         Coroutine.async {
         Coroutine.async {
             val backupPath = AppConfig.backupPath ?: let {
             val backupPath = AppConfig.backupPath ?: let {
-                toastOnUi("未设置备份目录")
+                appCtx.toastOnUi("未设置备份目录")
                 return@async
                 return@async
             }
             }
             val doc = FileDoc.fromUri(Uri.parse(backupPath), true)
             val doc = FileDoc.fromUri(Uri.parse(backupPath), true)
@@ -150,7 +150,7 @@ class AboutFragment : PreferenceFragmentCompat() {
                         }
                         }
                 }
                 }
             }
             }
-            toastOnUi("已保存至备份目录")
+            appCtx.toastOnUi("已保存至备份目录")
         }.onError {
         }.onError {
             AppLog.put("保存日志出错\n${it.localizedMessage}", it, true)
             AppLog.put("保存日志出错\n${it.localizedMessage}", it, true)
         }
         }
@@ -159,15 +159,15 @@ class AboutFragment : PreferenceFragmentCompat() {
     private fun createHeapDump() {
     private fun createHeapDump() {
         Coroutine.async {
         Coroutine.async {
             val backupPath = AppConfig.backupPath ?: let {
             val backupPath = AppConfig.backupPath ?: let {
-                toastOnUi("未设置备份目录")
+                appCtx.toastOnUi("未设置备份目录")
                 return@async
                 return@async
             }
             }
-            toastOnUi("开始创建堆转储")
+            appCtx.toastOnUi("开始创建堆转储")
             System.gc()
             System.gc()
             CrashHandler.doHeapDump()
             CrashHandler.doHeapDump()
             val heapFile = FileDoc.fromFile(File(appCtx.externalCacheDir, "heapDump")).list()
             val heapFile = FileDoc.fromFile(File(appCtx.externalCacheDir, "heapDump")).list()
                 ?.firstOrNull() ?: let {
                 ?.firstOrNull() ?: let {
-                toastOnUi("未找到堆转储文件")
+                appCtx.toastOnUi("未找到堆转储文件")
                 return@async
                 return@async
             }
             }
             val doc = FileDoc.fromUri(Uri.parse(backupPath), true)
             val doc = FileDoc.fromUri(Uri.parse(backupPath), true)
@@ -179,7 +179,7 @@ class AboutFragment : PreferenceFragmentCompat() {
                         input.copyTo(it)
                         input.copyTo(it)
                     }
                     }
             }
             }
-            toastOnUi("已保存至备份目录")
+            appCtx.toastOnUi("已保存至备份目录")
         }.onError {
         }.onError {
             AppLog.put("保存堆转储失败\n${it.localizedMessage}", it)
             AppLog.put("保存堆转储失败\n${it.localizedMessage}", it)
         }
         }