From 507fbdee701cea8a61ca3d0c4e4982b1a5700a0b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 26 Apr 2020 19:17:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/constant/AppConst.kt | 11 +++++++++++ .../ui/book/source/edit/BookSourceEditActivity.kt | 11 +---------- .../app/ui/rss/source/edit/RssSourceEditActivity.kt | 12 +----------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index c9e5a6c39..cf37e2b10 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -56,4 +56,15 @@ object AppConst { const val notificationIdAudio = 1144772 const val notificationIdWeb = 1144773 const val notificationIdDownload = 1144774 + + val urlOption: String by lazy { + """ + ,{ + "charset": "", + "method": "POST", + "body": "", + "headers": {"User-Agent": ""} + } + """.trimIndent() + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index c1d64776f..71ee36149 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -367,16 +367,7 @@ class BookSourceEditActivity : override fun sendText(text: String) { if (text == AppConst.keyboardToolChars[0]) { - insertText( - """ - ,{ - "charset": "", - "method": "POST", - "body": "", - "headers": {"User-Agent": ""} - } - """.trimIndent() - ) + insertText(AppConst.urlOption) } else { insertText(text) } diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt index ed18f8b69..d1e1b52e7 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt @@ -200,17 +200,7 @@ class RssSourceEditActivity : override fun sendText(text: String) { if (text == AppConst.keyboardToolChars[0]) { - insertText( - """ - ,{ - "charset": "", - "method": "POST", - "body": "", - "headers": {"User-Agent": ""} - } - - """.trimIndent() - ) + insertText(AppConst.urlOption) } else { insertText(text) }