From 291777b8560f7b693522065a2f32fe033e892d99 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 20:10:28 +0800 Subject: [PATCH 1/4] up --- app/src/main/assets/updateLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 847d2c5cd..171c3d744 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -6,6 +6,7 @@ **2020/01/11 * RSS阅读界面添加朗读功能 * 其它一些优化 +* 合并KKL369提交的代码,重写LinearLayoutManager,修复书籍目录模糊搜索后scrollToPosition在可见范围不置顶 **2020/01/10 * 合并KKL369提交的代码 From 890488aa0c5910b0631b81a4c2d26956bd481761 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 20:53:56 +0800 Subject: [PATCH 2/4] up --- .../main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt index 2caf40524..a8ca32fdd 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt @@ -14,12 +14,12 @@ import io.legado.app.lib.theme.DrawableUtils import io.legado.app.lib.theme.primaryTextColor import io.legado.app.utils.NetworkUtils import io.legado.app.utils.getViewModel -import io.legado.app.utils.htmlFormat import io.legado.app.utils.shareText import kotlinx.android.synthetic.main.activity_rss_read.* import kotlinx.coroutines.launch import org.apache.commons.text.StringEscapeUtils import org.jsoup.Jsoup +import org.jsoup.safety.Whitelist class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_read), ReadRssViewModel.CallBack { @@ -149,7 +149,7 @@ class ReadRssActivity : VMBaseActivity(R.layout.activity_rss_r webView.settings.javaScriptEnabled = true webView.evaluateJavascript("document.documentElement.outerHTML") { val html = StringEscapeUtils.unescapeJson(it) - viewModel.readAloud(Jsoup.parse(html).body().html().htmlFormat()) + viewModel.readAloud(Jsoup.clean(html, Whitelist())) } } } From 92dd37ac4edef2e04f75771c6c54c4cb36daecf2 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 21:16:05 +0800 Subject: [PATCH 3/4] up --- .../main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt index 83a88091e..ba9903de4 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt @@ -110,7 +110,10 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), } fun readAloud(text: String) { - textToSpeech.speak(text, TextToSpeech.QUEUE_FLUSH, null, "rss") + textToSpeech.stop() + text.split(" ").forEach { + textToSpeech.speak(it, TextToSpeech.QUEUE_ADD, null, "rss") + } } override fun onCleared() { From 628f3b0a7ca04a8b9f5cae05a968d8127cf8d358 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 11 Jan 2020 21:28:38 +0800 Subject: [PATCH 4/4] up --- app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt index ba9903de4..5af6841e9 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt @@ -111,7 +111,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), fun readAloud(text: String) { textToSpeech.stop() - text.split(" ").forEach { + text.split("\n", " ", "  ").forEach { textToSpeech.speak(it, TextToSpeech.QUEUE_ADD, null, "rss") } }