From b32547ca92a201c59914d98ebb69a8639bf42a4b Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 25 Apr 2020 15:58:16 +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 --- .../java/io/legado/app/constant/AppConst.kt | 19 +++++++++++++++++- .../source/edit/BookSourceEditActivity.kt | 19 +++++++++++++++++- .../rss/source/edit/RssSourceEditActivity.kt | 20 ++++++++++++++++++- 3 files changed, 55 insertions(+), 3 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 57724c62f..35ab74e81 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -41,7 +41,24 @@ object AppConst { val keyboardToolChars: List by lazy { arrayListOf( - "@", "&", "|", "%", "/", ":", "[", "]", "{", "}", "<", ">", "\\", "$", "#", "!", ".", + "※", + "@", + "&", + "|", + "%", + "/", + ":", + "[", + "]", + "{", + "}", + "<", + ">", + "\\", + "$", + "#", + "!", + ".", "href", "src", "textNodes", "xpath", "json", "css", "id", "class", "tag" ) } 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 46f3eb49f..5ff63c681 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 @@ -350,7 +350,7 @@ class BookSourceEditActivity : return true } - override fun sendText(text: String) { + private fun insertText(text: String) { if (text.isBlank()) return val view = window.decorView.findFocus() if (view is EditText) { @@ -365,6 +365,23 @@ class BookSourceEditActivity : } } + override fun sendText(text: String) { + if (text == AppConst.keyboardToolChars[0]) { + insertText( + """ + ,{ + "charset": "", + "method": "POST", + "body": "", + "headers": "{"User-Agent": ""}" + } + """.trimIndent() + ) + } else { + insertText(text) + } + } + private fun showKeyboardTopPopupWindow() { mSoftKeyboardTool?.let { if (it.isShowing) return 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 88059b955..8f90dfeed 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 @@ -183,7 +183,7 @@ class RssSourceEditActivity : return true } - override fun sendText(text: String) { + private fun insertText(text: String) { if (text.isBlank()) return val view = window.decorView.findFocus() if (view is EditText) { @@ -198,6 +198,24 @@ class RssSourceEditActivity : } } + override fun sendText(text: String) { + if (text == AppConst.keyboardToolChars[0]) { + insertText( + """ + ,{ + "charset": "", + "method": "POST", + "body": "", + "headers": "{"User-Agent": ""}" + } + + """.trimIndent() + ) + } else { + insertText(text) + } + } + private fun showKeyboardTopPopupWindow() { mSoftKeyboardTool?.let { if (it.isShowing) return