Merge pull request #35 from ca1e/urischeme

[feature] add import booksources urischeme
pull/37/head
kunfei 5 years ago committed by GitHub
commit fe47309503
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      app/src/main/AndroidManifest.xml
  2. 16
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt

@ -63,8 +63,16 @@
<activity android:name=".ui.about.DonateActivity" />
<activity android:name=".ui.book.info.BookInfoActivity" />
<activity android:name="io.legado.app.ui.book.info.edit.BookInfoEditActivity" />
<activity android:name=".ui.book.source.debug.BookSourceDebugActivity" />
<activity android:name=".ui.book.source.manage.BookSourceActivity" />
<activity android:name=".ui.book.source.debug.SourceDebugActivity" />
<activity android:name=".ui.book.source.manage.BookSourceActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="yuedu" android:host="booksource"/>
</intent-filter>
</activity>
<activity android:name=".ui.chapterlist.ChapterListActivity" />
<activity android:name=".ui.rss.read.ReadRssActivity" />
<activity android:name=".ui.audio.AudioPlayActivity" />

@ -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<BookSourceViewModel>(R.layout.activity_book_source),
BookSourceAdapter.CallBack,
@ -56,6 +57,7 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
initUriScheme()
initRecyclerView()
initSearchView()
initLiveDataBookSource()
@ -101,6 +103,20 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(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)

Loading…
Cancel
Save