Horis 1 год назад
Родитель
Сommit
e09fbf9043

+ 13 - 9
app/src/main/java/io/legado/app/data/entities/BaseSource.kt

@@ -103,16 +103,20 @@ interface BaseSource : JsExtensions {
      */
     fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
         header?.let {
-            val json = when {
-                it.startsWith("@js:", true) -> evalJS(it.substring(4)).toString()
-                it.startsWith("<js>", true) -> evalJS(
-                    it.substring(4, it.lastIndexOf("<"))
-                ).toString()
+            try {
+                val json = when {
+                    it.startsWith("@js:", true) -> evalJS(it.substring(4)).toString()
+                    it.startsWith("<js>", true) -> evalJS(
+                        it.substring(4, it.lastIndexOf("<"))
+                    ).toString()
 
-                else -> it
-            }
-            GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
-                putAll(map)
+                    else -> it
+                }
+                GSON.fromJsonObject<Map<String, String>>(json).getOrNull()?.let { map ->
+                    putAll(map)
+                }
+            } catch (e: Exception) {
+                AppLog.put("getHeaderMap 出错\n$e", e)
             }
         }
         if (!has(AppConst.UA_NAME, true)) {

+ 1 - 1
app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@@ -1293,7 +1293,7 @@ class ReadBookActivity : BaseReadBookActivity(),
                     analyzeRule.setBaseUrl(chapter.url)
                     analyzeRule.chapter = chapter
                     analyzeRule.evalJS(payAction).toString()
-                }.onSuccess {
+                }.onSuccess(IO) {
                     if (it.isAbsUrl()) {
                         startActivity<WebViewActivity> {
                             putExtra("title", getString(R.string.chapter_pay))

+ 8 - 5
app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt

@@ -23,6 +23,7 @@ import io.legado.app.help.config.AppConfig
 import io.legado.app.help.config.LocalConfig
 import io.legado.app.help.config.ReadBookConfig
 import io.legado.app.help.config.ThemeConfig
+import io.legado.app.help.coroutine.Coroutine
 import io.legado.app.lib.dialogs.alert
 import io.legado.app.lib.theme.Selector
 import io.legado.app.lib.theme.accentColor
@@ -346,11 +347,13 @@ class ReadMenu @JvmOverloads constructor(
             if (AppConfig.readUrlInBrowser) {
                 context.openUrl(tvChapterUrl.text.toString().substringBefore(",{"))
             } else {
-                context.startActivity<WebViewActivity> {
-                    val url = tvChapterUrl.text.toString()
-                    putExtra("title", tvChapterName.text)
-                    putExtra("url", url)
-                    IntentData.put(url, ReadBook.bookSource?.getHeaderMap(true))
+                Coroutine.async {
+                    context.startActivity<WebViewActivity> {
+                        val url = tvChapterUrl.text.toString()
+                        putExtra("title", tvChapterName.text)
+                        putExtra("url", url)
+                        IntentData.put(url, ReadBook.bookSource?.getHeaderMap(true))
+                    }
                 }
             }
         }

+ 2 - 2
app/src/main/res/layout-land/activity_book_info.xml

@@ -159,7 +159,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <ScrollView
+            <androidx.core.widget.NestedScrollView
                 android:id="@+id/scroll_view"
                 android:layout_width="match_parent"
                 android:layout_height="0dp"
@@ -379,7 +379,7 @@
 
                 </LinearLayout>
 
-            </ScrollView>
+            </androidx.core.widget.NestedScrollView>
 
             <LinearLayout
                 android:id="@+id/fl_action"