From 08e777b6df3d5bf5fca4517e5e398f33cb93f214 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 10 Mar 2022 11:19:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/defaultData/keyboardAssists.json | 162 ++++++++++++++++++ .../java/io/legado/app/help/DefaultData.kt | 9 + 2 files changed, 171 insertions(+) create mode 100644 app/src/main/assets/defaultData/keyboardAssists.json diff --git a/app/src/main/assets/defaultData/keyboardAssists.json b/app/src/main/assets/defaultData/keyboardAssists.json new file mode 100644 index 000000000..cd2bc419f --- /dev/null +++ b/app/src/main/assets/defaultData/keyboardAssists.json @@ -0,0 +1,162 @@ +[ + { + "key": "@css:", + "value": "@css:", + "serialNo": 0 + }, + { + "key": "", + "value": "", + "serialNo": 1 + }, + { + "key": "{{}}", + "value": "{{}}", + "serialNo": 2 + }, + { + "key": "##", + "value": "##", + "serialNo": 3 + }, + { + "key": "&&", + "value": "&&", + "serialNo": 4 + }, + { + "key": "%%", + "value": "%%", + "serialNo": 5 + }, + { + "key": "||", + "value": "||", + "serialNo": 6 + }, + { + "key": "//", + "value": "//", + "serialNo": 7 + }, + { + "key": "\\", + "value": "\\", + "serialNo": 8 + }, + { + "key": "$.", + "value": "$.", + "serialNo": 9 + }, + { + "key": "@", + "value": "@", + "serialNo": 10 + }, + { + "key": ":", + "value": ":", + "serialNo": 11 + }, + { + "key": "class", + "value": "class", + "serialNo": 12 + }, + { + "key": "text", + "value": "text", + "serialNo": 13 + }, + { + "key": "href", + "value": "href", + "serialNo": 14 + }, + { + "key": "textNodes", + "value": "textNodes", + "serialNo": 15 + }, + { + "key": "ownText", + "value": "ownText", + "serialNo": 16 + }, + { + "key": "all", + "value": "all", + "serialNo": 17 + }, + { + "key": "html", + "value": "html", + "serialNo": 18 + }, + { + "key": "[", + "value": "[", + "serialNo": 19 + }, + { + "key": "]", + "value": "]", + "serialNo": 20 + }, + { + "key": "<", + "value": "<", + "serialNo": 21 + }, + { + "key": ">", + "value": ">", + "serialNo": 22 + }, + { + "key": "#", + "value": "#", + "serialNo": 23 + }, + { + "key": "!", + "value": "!", + "serialNo": 24 + }, + { + "key": ".", + "value": ".", + "serialNo": 25 + }, + { + "key": "+", + "value": "+", + "serialNo": 26 + }, + { + "key": "-", + "value": "-", + "serialNo": 27 + }, + { + "key": "*", + "value": "*", + "serialNo": 28 + }, + { + "key": "/", + "value": "/", + "serialNo": 29 + }, + { + "key": "=", + "value": "=", + "serialNo": 30 + }, + { + "key": "webView", + "value": "{'webView': true}", + "serialNo": 31 + } +] \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/help/DefaultData.kt b/app/src/main/java/io/legado/app/help/DefaultData.kt index 5205d2583..774b0ea4c 100644 --- a/app/src/main/java/io/legado/app/help/DefaultData.kt +++ b/app/src/main/java/io/legado/app/help/DefaultData.kt @@ -2,6 +2,7 @@ package io.legado.app.help import io.legado.app.data.appDb import io.legado.app.data.entities.HttpTTS +import io.legado.app.data.entities.KeyboardAssist import io.legado.app.data.entities.RssSource import io.legado.app.data.entities.TxtTocRule import io.legado.app.help.config.ReadBookConfig @@ -70,6 +71,14 @@ object DefaultData { GSON.fromJsonObject(json).getOrThrow()!! } + val keyboardAssists: List by lazy { + val json = String( + appCtx.assets.open("defaultData${File.separator}keyboardAssists.json") + .readBytes() + ) + GSON.fromJsonArray(json).getOrNull()!! + } + fun importDefaultHttpTTS() { appDb.httpTTSDao.deleteDefault() appDb.httpTTSDao.insert(*httpTTS.toTypedArray())