From 7004b47898e5533b4f9c887bd06241f24b4af281 Mon Sep 17 00:00:00 2001 From: wqfantexi Date: Sat, 21 Mar 2020 20:31:03 +0800 Subject: [PATCH 01/31] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 12 +++- .../book/source/manage/BookSourceActivity.kt | 10 +++- .../legado/app/ui/config/FileAssociation.kt | 37 ++++++++++++ .../app/ui/config/FileAssociationViewModel.kt | 60 +++++++++++++++++++ .../app/ui/replacerule/ReplaceRuleActivity.kt | 11 +++- .../ui/replacerule/ReplaceRuleViewModel.kt | 17 +++++- .../ui/rss/source/manage/RssSourceActivity.kt | 11 +++- .../res/layout/activity_file_association.xml | 9 +++ 8 files changed, 159 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/io/legado/app/ui/config/FileAssociation.kt create mode 100644 app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt create mode 100644 app/src/main/res/layout/activity_file_association.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9d778fbb3..71fa00c62 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -244,7 +244,17 @@ - + + + + + + + + + + + diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 385088640..d3cb63af3 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -104,8 +104,14 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity when (it.path) { "/importonline" -> it.getQueryParameter("src")?.let { url -> Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() - viewModel.importSource(url) { msg -> - title_bar.snackbar(msg) + if (url.startsWith("http", false)){ + viewModel.importSource(url) { msg -> + title_bar.snackbar(msg) + } + } + else{ + viewModel.importSourceFromFilePath(url){msg -> + title_bar.snackbar(msg)} } } else -> { diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt new file mode 100644 index 000000000..0b2a3c749 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt @@ -0,0 +1,37 @@ +package io.legado.app.ui.config + +import android.content.Intent +import android.os.Bundle +import io.legado.app.R +import io.legado.app.base.VMBaseActivity +import io.legado.app.ui.main.MainActivity +import io.legado.app.utils.getViewModel + + +class FileAssociation : VMBaseActivity(R.layout.activity_file_association) { + override val viewModel: FileAssociationViewModel + get() = getViewModel(FileAssociationViewModel::class.java) + + override fun onActivityCreated(savedInstanceState: Bundle?) { + if (null != intent.data){ + val newIntent = viewModel.dispatchIndent(intent.data!!) + if (newIntent != null){ + this.startActivityForResult(newIntent, 100) + }else{ + gotoMainActivity() + } + } + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + + //返回后直接跳转到主页面 + gotoMainActivity() + } + + private fun gotoMainActivity(){ + val mIntent = Intent() + mIntent.setClass(this, MainActivity::class.java) + startActivity(mIntent) + } +} diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt new file mode 100644 index 000000000..4a09b4325 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt @@ -0,0 +1,60 @@ +package io.legado.app.ui.config + +import android.app.Application +import android.content.Intent +import android.net.Uri +import android.text.TextUtils +import io.legado.app.base.BaseViewModel +import io.legado.app.model.localBook.LocalBook +import io.legado.app.utils.isJsonArray +import io.legado.app.utils.isJsonObject +import org.jetbrains.anko.toast +import java.io.File + +class FileAssociationViewModel(application: Application) : BaseViewModel(application) { + fun dispatchIndent(uri:Uri):Intent?{ + var url = ""; + //如果是普通的url,需要根据返回的内容判断是什么 + if(uri.scheme == "file" || uri.scheme == "content"){ + val file = File(uri.path.toString()) + var scheme = "" + if (file.exists()) { + val content = file.readText() + if (content.isJsonObject() || content.isJsonArray()){ + //暂时根据文件内容判断属于什么 + if (content.contains("bookSourceUrl")){ + scheme = "booksource" + }else if (content.contains("sourceUrl")){ + scheme = "rsssource" + }else if (content.contains("pattern")){ + scheme = "replace" + } + } + if (TextUtils.isEmpty(scheme)){ + execute{ + LocalBook.importFile(uri.path.toString()) + toast("添加本地文件成功${uri.path}") + } + + return null + } + } + else{ + toast("文件不存在") + return null + } + + url = "yuedu://${scheme}/importonline?src=${uri.path}" + } + else if (uri.scheme == "yuedu"){ + url = uri.toString() + } + else{ + url = "yuedu://booksource/importonline?src=${uri.path}" + } + val data = Uri.parse(url) + val newIndent = Intent(Intent.ACTION_VIEW) + newIndent.data = data; + return newIndent + } +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index fd0a591b6..1f9057e35 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -81,8 +81,15 @@ class ReplaceRuleActivity : VMBaseActivity(R.layout.activi when (it.path) { "/importonline" -> it.getQueryParameter("src")?.let { url -> Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() - viewModel.importSource(url) { msg -> - title_bar.snackbar(msg) + if (url.startsWith("http", false)){ + viewModel.importSource(url) { msg -> + title_bar.snackbar(msg) + } + } + else{ + viewModel.importSourceFromFilePath(url) { msg -> + title_bar.snackbar(msg) + } } } else -> { diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleViewModel.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleViewModel.kt index a63d7ea38..8f0e848f0 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleViewModel.kt @@ -11,11 +11,26 @@ import io.legado.app.help.http.HttpHelper import io.legado.app.help.storage.Backup import io.legado.app.help.storage.ImportOldData import io.legado.app.utils.* +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import org.jetbrains.anko.toast import java.io.File class ReplaceRuleViewModel(application: Application) : BaseViewModel(application) { - + fun importSourceFromFilePath(path: String, finally: (msg: String) -> Unit) { + execute { + val file = File(path) + if (file.exists()) { + importSource(file.readText(), finally) + } else { + withContext(Dispatchers.Main) { + finally("打开文件出错") + } + } + }.onError { + finally(it.localizedMessage ?: "打开文件出错") + } + } fun importSource(text: String, showMsg: (msg: String) -> Unit) { execute { if (text.isAbsUrl()) { diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index fb54d0cae..1f7503e47 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -117,8 +117,15 @@ class RssSourceActivity : VMBaseActivity(R.layout.activity_r when (it.path) { "/importonline" -> it.getQueryParameter("src")?.let { url -> Snackbar.make(title_bar, R.string.importing, Snackbar.LENGTH_INDEFINITE).show() - viewModel.importSource(url) { msg -> - title_bar.snackbar(msg) + if (url.startsWith("http", false)){ + viewModel.importSource(url) { msg -> + title_bar.snackbar(msg) + } + } + else{ + viewModel.importSourceFromFilePath(url) { msg -> + title_bar.snackbar(msg) + } } } else -> { diff --git a/app/src/main/res/layout/activity_file_association.xml b/app/src/main/res/layout/activity_file_association.xml new file mode 100644 index 000000000..5c147517b --- /dev/null +++ b/app/src/main/res/layout/activity_file_association.xml @@ -0,0 +1,9 @@ + + + + From a98ed055f63e9d683acbea1370f62e1f073b3049 Mon Sep 17 00:00:00 2001 From: wqfantexi Date: Sat, 21 Mar 2020 21:16:28 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/config/FileAssociationViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt index 4a09b4325..810c885f6 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt @@ -13,7 +13,7 @@ import java.io.File class FileAssociationViewModel(application: Application) : BaseViewModel(application) { fun dispatchIndent(uri:Uri):Intent?{ - var url = ""; + val url:String //如果是普通的url,需要根据返回的内容判断是什么 if(uri.scheme == "file" || uri.scheme == "content"){ val file = File(uri.path.toString()) From 9a0d5f3975a4618b954ed6ce1658ef9f39a8e2d1 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 10:15:04 +0800 Subject: [PATCH 03/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index d767bdc71..37586e6fa 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,9 @@ * 请关注[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。 * 弄了个企业公众号[开源阅读](),后面弄好后会把原来的[开源阅读软件]()迁移过来 +**2020/03/21** +* 添加文件关联 by wqfantexi + **2020/03/21** * 详情页点击书名搜索 From 7f5d9435ca372931d7a2c348e8d4dc62c3eddb80 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 10:16:06 +0800 Subject: [PATCH 04/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/ui/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/README.md b/app/src/main/java/io/legado/app/ui/README.md index b408eb6b9..ef44bed69 100644 --- a/app/src/main/java/io/legado/app/ui/README.md +++ b/app/src/main/java/io/legado/app/ui/README.md @@ -6,7 +6,7 @@ * book\info 书籍信息查看 * book\read 书籍阅读界面 * book\search 搜索书籍界面 -* book\source 搜索书源界面 +* book\source 书源界面 * book\changeCover 封面换源界面 * book\changeSource 换源界面 * book\chapterList 目录界面 From 77c3263ddbec38a2d2a7bd2e5a4585bd390e8056 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 10:19:58 +0800 Subject: [PATCH 05/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/config/FileAssociation.kt | 14 ++++++++------ .../app/ui/config/FileAssociationViewModel.kt | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt index 0b2a3c749..9e459a226 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt @@ -8,20 +8,22 @@ import io.legado.app.ui.main.MainActivity import io.legado.app.utils.getViewModel -class FileAssociation : VMBaseActivity(R.layout.activity_file_association) { +class FileAssociation : + VMBaseActivity(R.layout.activity_file_association) { override val viewModel: FileAssociationViewModel get() = getViewModel(FileAssociationViewModel::class.java) override fun onActivityCreated(savedInstanceState: Bundle?) { - if (null != intent.data){ - val newIntent = viewModel.dispatchIndent(intent.data!!) - if (newIntent != null){ + intent.data?.let { data -> + val newIntent = viewModel.dispatchIndent(data) + if (newIntent != null) { this.startActivityForResult(newIntent, 100) - }else{ + } else { gotoMainActivity() } } } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) @@ -29,7 +31,7 @@ class FileAssociation : VMBaseActivity(R.layout.activi gotoMainActivity() } - private fun gotoMainActivity(){ + private fun gotoMainActivity() { val mIntent = Intent() mIntent.setClass(this, MainActivity::class.java) startActivity(mIntent) diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt index 810c885f6..11705c537 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt @@ -8,7 +8,6 @@ import io.legado.app.base.BaseViewModel import io.legado.app.model.localBook.LocalBook import io.legado.app.utils.isJsonArray import io.legado.app.utils.isJsonObject -import org.jetbrains.anko.toast import java.io.File class FileAssociationViewModel(application: Application) : BaseViewModel(application) { @@ -22,12 +21,16 @@ class FileAssociationViewModel(application: Application) : BaseViewModel(applica val content = file.readText() if (content.isJsonObject() || content.isJsonArray()){ //暂时根据文件内容判断属于什么 - if (content.contains("bookSourceUrl")){ - scheme = "booksource" - }else if (content.contains("sourceUrl")){ - scheme = "rsssource" - }else if (content.contains("pattern")){ - scheme = "replace" + when { + content.contains("bookSourceUrl") -> { + scheme = "booksource" + } + content.contains("sourceUrl") -> { + scheme = "rsssource" + } + content.contains("pattern") -> { + scheme = "replace" + } } } if (TextUtils.isEmpty(scheme)){ @@ -54,7 +57,7 @@ class FileAssociationViewModel(application: Application) : BaseViewModel(applica } val data = Uri.parse(url) val newIndent = Intent(Intent.ACTION_VIEW) - newIndent.data = data; + newIndent.data = data return newIndent } } \ No newline at end of file From 00c757582f7051683e9d825243f722df5cd5e3c3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 10:40:44 +0800 Subject: [PATCH 06/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/config/FileAssociationViewModel.kt | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt index 11705c537..bed99c025 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt @@ -11,53 +11,49 @@ import io.legado.app.utils.isJsonObject import java.io.File class FileAssociationViewModel(application: Application) : BaseViewModel(application) { - fun dispatchIndent(uri:Uri):Intent?{ - val url:String - //如果是普通的url,需要根据返回的内容判断是什么 - if(uri.scheme == "file" || uri.scheme == "content"){ - val file = File(uri.path.toString()) - var scheme = "" - if (file.exists()) { - val content = file.readText() - if (content.isJsonObject() || content.isJsonArray()){ - //暂时根据文件内容判断属于什么 - when { - content.contains("bookSourceUrl") -> { - scheme = "booksource" - } - content.contains("sourceUrl") -> { - scheme = "rsssource" - } - content.contains("pattern") -> { - scheme = "replace" - } + fun dispatchIndent(uri: Uri): Intent? { + val url: String + //如果是普通的url,需要根据返回的内容判断是什么 + if (uri.scheme == "file" || uri.scheme == "content") { + val file = File(uri.path.toString()) + var scheme = "" + if (file.exists()) { + val content = file.readText() + if (content.isJsonObject() || content.isJsonArray()) { + //暂时根据文件内容判断属于什么 + when { + content.contains("bookSourceUrl") -> { + scheme = "booksource" } - } - if (TextUtils.isEmpty(scheme)){ - execute{ - LocalBook.importFile(uri.path.toString()) - toast("添加本地文件成功${uri.path}") + content.contains("sourceUrl") -> { + scheme = "rsssource" + } + content.contains("pattern") -> { + scheme = "replace" } - - return null } } - else{ - toast("文件不存在") + if (TextUtils.isEmpty(scheme)) { + execute { + LocalBook.importFile(uri.path.toString()) + toast("添加本地文件成功${uri.path}") + } return null } - - url = "yuedu://${scheme}/importonline?src=${uri.path}" - } - else if (uri.scheme == "yuedu"){ - url = uri.toString() + } else { + toast("文件不存在") + return null } - else{ - url = "yuedu://booksource/importonline?src=${uri.path}" - } - val data = Uri.parse(url) - val newIndent = Intent(Intent.ACTION_VIEW) + + url = "yuedu://${scheme}/importonline?src=${uri.path}" + } else if (uri.scheme == "yuedu") { + url = uri.toString() + } else { + url = "yuedu://booksource/importonline?src=${uri.path}" + } + val data = Uri.parse(url) + val newIndent = Intent(Intent.ACTION_VIEW) newIndent.data = data - return newIndent + return newIndent } } \ No newline at end of file From 08f59704636d2bb0ecb1f07dcd1b8225b367912d Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 10:56:45 +0800 Subject: [PATCH 07/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/config/FileAssociationViewModel.kt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt index bed99c025..80db1af37 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationViewModel.kt @@ -4,10 +4,12 @@ import android.app.Application import android.content.Intent import android.net.Uri import android.text.TextUtils +import androidx.documentfile.provider.DocumentFile import io.legado.app.base.BaseViewModel import io.legado.app.model.localBook.LocalBook import io.legado.app.utils.isJsonArray import io.legado.app.utils.isJsonObject +import io.legado.app.utils.readText import java.io.File class FileAssociationViewModel(application: Application) : BaseViewModel(application) { @@ -15,10 +17,18 @@ class FileAssociationViewModel(application: Application) : BaseViewModel(applica val url: String //如果是普通的url,需要根据返回的内容判断是什么 if (uri.scheme == "file" || uri.scheme == "content") { - val file = File(uri.path.toString()) + val content = if (uri.scheme == "file") { + val file = File(uri.path.toString()) + if (file.exists()) { + file.readText() + } else { + null + } + } else { + DocumentFile.fromSingleUri(context, uri)?.readText(context) + } var scheme = "" - if (file.exists()) { - val content = file.readText() + if (content != null) { if (content.isJsonObject() || content.isJsonArray()) { //暂时根据文件内容判断属于什么 when { From df408c67115d79d666c4ddd38fbf2d0820dca332 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 11:49:34 +0800 Subject: [PATCH 08/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 4 +++- .../config/{FileAssociation.kt => FileAssociationActivity.kt} | 2 +- app/src/main/res/layout/activity_file_association.xml | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) rename app/src/main/java/io/legado/app/ui/config/{FileAssociation.kt => FileAssociationActivity.kt} (97%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a8ae915ff..cfb6793b8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -287,7 +287,9 @@ - + diff --git a/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt b/app/src/main/java/io/legado/app/ui/config/FileAssociationActivity.kt similarity index 97% rename from app/src/main/java/io/legado/app/ui/config/FileAssociation.kt rename to app/src/main/java/io/legado/app/ui/config/FileAssociationActivity.kt index 9e459a226..80390c639 100644 --- a/app/src/main/java/io/legado/app/ui/config/FileAssociation.kt +++ b/app/src/main/java/io/legado/app/ui/config/FileAssociationActivity.kt @@ -8,7 +8,7 @@ import io.legado.app.ui.main.MainActivity import io.legado.app.utils.getViewModel -class FileAssociation : +class FileAssociationActivity : VMBaseActivity(R.layout.activity_file_association) { override val viewModel: FileAssociationViewModel get() = getViewModel(FileAssociationViewModel::class.java) diff --git a/app/src/main/res/layout/activity_file_association.xml b/app/src/main/res/layout/activity_file_association.xml index 5c147517b..2a7adee89 100644 --- a/app/src/main/res/layout/activity_file_association.xml +++ b/app/src/main/res/layout/activity_file_association.xml @@ -1,9 +1,8 @@ + tools:context="io.legado.app.ui.config.FileAssociationActivity"> From a43b730ed4b2a1684c2053c34f347ce7fb62c72f Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 12:46:29 +0800 Subject: [PATCH 09/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/utils/EncodingDetect.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/utils/EncodingDetect.java b/app/src/main/java/io/legado/app/utils/EncodingDetect.java index 29174b88e..b5bd4cf66 100644 --- a/app/src/main/java/io/legado/app/utils/EncodingDetect.java +++ b/app/src/main/java/io/legado/app/utils/EncodingDetect.java @@ -66,7 +66,7 @@ public class EncodingDetect { } public static String getEncode(@NonNull byte[] bytes) { - int len = bytes.length > 2000 ? 2000 : bytes.length; + int len = Math.min(bytes.length, 2000); byte[] cBytes = new byte[len]; System.arraycopy(bytes, 0, cBytes, 0, len); BytesEncodingDetect bytesEncodingDetect = new BytesEncodingDetect(); @@ -1010,14 +1010,8 @@ class BytesEncodingDetect extends Encoding { column = rawtext[i + 1] + 256; if (column < 0x9f) { adjust = 1; - if (column > 0x7f) { - column -= 0x20; - } else { - column -= 0x19; - } } else { adjust = 0; - column -= 0x7e; } if (row < 0xa0) { row = ((row - 0x70) << 1) - adjust; From 44183959c5f6132f4b287c339fae528f37ab57ba Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 12:56:23 +0800 Subject: [PATCH 10/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values-night/colors.xml | 2 +- app/src/main/res/values/colors.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 8ac7aa66a..eb9189f7a 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -7,7 +7,7 @@ @color/md_grey_900 @color/md_grey_850 @color/md_grey_800 - #10303030 + #10ffffff #69000000 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 0fe64b7ca..91906845e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -16,7 +16,7 @@ @color/md_grey_50 @color/md_grey_100 @color/md_grey_200 - @color/md_grey_50 + #10000000 #00000000 #10000000 From fd00bf2509d42d5d1f1667dc60bdb4e928e8a392 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 22 Mar 2020 13:11:41 +0800 Subject: [PATCH 11/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 37586e6fa..5e5d52454 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -269,14 +269,7 @@ - 调试正文页>>输入正文页URL,如:`--https://www.zhaishuyuan.com/chapter/30394/20940996` * 修改订阅中自动添加style的情景 - 订阅源的内容规则中存在` - ``` + 订阅源的内容规则中存在`