From 3962ebc5dbbb27737c338052e2da0f30d6076b81 Mon Sep 17 00:00:00 2001 From: yans Date: Fri, 27 Sep 2019 14:37:13 +0800 Subject: [PATCH] add import booksources urischeme --- app/src/main/AndroidManifest.xml | 10 +++++++++- .../ui/book/source/manage/BookSourceActivity.kt | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 96e2b7ea2..c1e691938 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -64,7 +64,15 @@ - + + + + + + + + + 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 6dfc8f3a2..bf357319f 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 @@ -41,6 +41,7 @@ import kotlinx.android.synthetic.main.view_title_bar.* import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.startService +import org.jetbrains.anko.toast class BookSourceActivity : VMBaseActivity(R.layout.activity_book_source), BookSourceAdapter.CallBack, @@ -56,6 +57,7 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity override fun onActivityCreated(savedInstanceState: Bundle?) { setSupportActionBar(toolbar) + initUriScheme() initRecyclerView() initSearchView() initLiveDataBookSource() @@ -101,6 +103,20 @@ class BookSourceActivity : VMBaseActivity(R.layout.activity return super.onCompatOptionsItemSelected(item) } + private fun initUriScheme() { + intent.data?.let{ + when(it.path) + { + "/importonline" -> { + it.getQueryParameter("src")?.let{ + viewModel.importSource(it) + } + } + else -> {toast("格式不对")} + } + } + } + private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) recycler_view.layoutManager = LinearLayoutManager(this)