统一导入入口

pull/1155/head
gedoor 3 years ago
parent 5453c15049
commit ee2dff2593
  1. 33
      app/src/main/AndroidManifest.xml
  2. 24
      app/src/main/java/io/legado/app/ui/association/OnLineImportActivity.kt
  3. 25
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssActivity.kt

@ -341,9 +341,9 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="import"
android:scheme="legado" />
<data android:scheme="legado" />
<data android:scheme="yuedu" />
</intent-filter>
</activity>
<!-- 导入书源 -->
@ -351,48 +351,21 @@
android:name=".ui.association.ImportBookSourceActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:theme="@style/AppTheme.Transparent">
<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:host="booksource"
android:scheme="yuedu" />
</intent-filter>
</activity>
<!-- 导入订阅源 -->
<activity
android:name=".ui.association.ImportRssSourceActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:theme="@style/AppTheme.Transparent">
<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:host="rsssource"
android:scheme="yuedu" />
</intent-filter>
</activity>
<!-- 导入替换规则 -->
<activity
android:name=".ui.association.ImportReplaceRuleActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:theme="@style/AppTheme.Transparent">
<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:host="replace"
android:scheme="yuedu" />
</intent-filter>
</activity>
<!-- 打开文件 -->
<activity

@ -7,6 +7,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme
import io.legado.app.databinding.ActivityTranslucenceBinding
import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
@ -27,14 +28,21 @@ class OnLineImportActivity :
return
}
when (it.path) {
"bookSource" -> importBookSource(url)
"rssSource" -> importRssSource(url)
"replaceRule" -> importReplaceRule(url)
"textTocRule" -> viewModel.importTextTocRule(url, this::finallyDialog)
"httpTTS" -> viewModel.importHttpTTS(url, this::finallyDialog)
"theme" -> viewModel.importTheme(url, this::finallyDialog)
"readConfig" -> viewModel.importReadConfig(url, this::finallyDialog)
else -> {
"/bookSource" -> importBookSource(url)
"/rssSource" -> importRssSource(url)
"/replaceRule" -> importReplaceRule(url)
"/textTocRule" -> viewModel.importTextTocRule(url, this::finallyDialog)
"/httpTTS" -> viewModel.importHttpTTS(url, this::finallyDialog)
"/theme" -> viewModel.importTheme(url, this::finallyDialog)
"/readConfig" -> viewModel.importReadConfig(url, this::finallyDialog)
"/importonline" -> when (it.host) {
"booksource" -> importBookSource(url)
"rsssource" -> importRssSource(url)
"replace" -> importReplaceRule(url)
else -> {
toastOnUi("url error")
finish()
}
}
}
}

@ -22,9 +22,6 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.DrawableUtils
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.service.help.Download
import io.legado.app.ui.association.ImportBookSourceActivity
import io.legado.app.ui.association.ImportReplaceRuleActivity
import io.legado.app.ui.association.ImportRssSourceActivity
import io.legado.app.ui.association.OnLineImportActivity
import io.legado.app.ui.document.FilePicker
import io.legado.app.ui.document.FilePickerParam
@ -336,25 +333,9 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
"http", "https" -> {
return false
}
"legado" -> {
when (url.host) {
"import" -> startActivity<OnLineImportActivity> {
data = url
}
}
return true
}
"yuedu" -> {
when (url.host) {
"booksource" -> startActivity<ImportBookSourceActivity> {
data = url
}
"rsssource" -> startActivity<ImportRssSourceActivity> {
data = url
}
"replace" -> startActivity<ImportReplaceRuleActivity> {
data = url
}
"legado", "yuedu" -> {
startActivity<OnLineImportActivity> {
data = url
}
return true
}

Loading…
Cancel
Save