From ed2e80c13db1b3b743f85d64e653040c77f77781 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 16 Jan 2021 12:56:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=AE=A2=E9=98=85=E6=BA=90,=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/LocalConfig.kt | 6 +++--- .../legado/app/ui/rss/source/manage/RssSourceActivity.kt | 1 + .../legado/app/ui/rss/source/manage/RssSourceViewModel.kt | 7 +++++++ app/src/main/res/menu/rss_source.xml | 6 ++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/LocalConfig.kt b/app/src/main/java/io/legado/app/help/LocalConfig.kt index 71c529a04..e6a22553d 100644 --- a/app/src/main/java/io/legado/app/help/LocalConfig.kt +++ b/app/src/main/java/io/legado/app/help/LocalConfig.kt @@ -65,11 +65,11 @@ object LocalConfig { get() = isLastVersion(1, "ruleHelpVersion") val hasUpHttpTTS: Boolean - get() = isLastVersion(1, "httpTtsVersion") + get() = !isLastVersion(1, "httpTtsVersion") val hasUpTxtTocRule: Boolean - get() = isLastVersion(1, "txtTocRuleVersion") + get() = !isLastVersion(1, "txtTocRuleVersion") val hasUpRssSources: Boolean - get() = isLastVersion(1, "rssSourceVersion") + get() = !isLastVersion(1, "rssSourceVersion") } \ No newline at end of file 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 4a5ac68cd..1e6156391 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 @@ -92,6 +92,7 @@ class RssSourceActivity : VMBaseActivity viewModel.shareSelection(adapter.getSelection()) { startActivity(Intent.createChooser(it, getString(R.string.share_selected_source))) } + R.id.menu_import_default -> viewModel.importDefault() R.id.menu_help -> showHelp() else -> if (item.groupId == R.id.source_group) { binding.titleBar.findViewById(R.id.search_view) diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt index 9a90932df..7ff23307c 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt @@ -9,6 +9,7 @@ import io.legado.app.App import io.legado.app.BuildConfig import io.legado.app.base.BaseViewModel import io.legado.app.data.entities.RssSource +import io.legado.app.help.DefaultData import io.legado.app.utils.* import org.jetbrains.anko.toast import java.io.File @@ -166,4 +167,10 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application) } } + fun importDefault() { + execute { + DefaultData.importDefaultRssSources() + } + } + } \ No newline at end of file diff --git a/app/src/main/res/menu/rss_source.xml b/app/src/main/res/menu/rss_source.xml index b8915e094..739b68d58 100644 --- a/app/src/main/res/menu/rss_source.xml +++ b/app/src/main/res/menu/rss_source.xml @@ -48,6 +48,12 @@ android:title="@string/import_by_qr_code" app:showAsAction="never" /> + +