统一导入入口

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

@ -7,6 +7,7 @@ import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme import io.legado.app.constant.Theme
import io.legado.app.databinding.ActivityTranslucenceBinding import io.legado.app.databinding.ActivityTranslucenceBinding
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
/** /**
@ -27,14 +28,21 @@ class OnLineImportActivity :
return return
} }
when (it.path) { when (it.path) {
"bookSource" -> importBookSource(url) "/bookSource" -> importBookSource(url)
"rssSource" -> importRssSource(url) "/rssSource" -> importRssSource(url)
"replaceRule" -> importReplaceRule(url) "/replaceRule" -> importReplaceRule(url)
"textTocRule" -> viewModel.importTextTocRule(url, this::finallyDialog) "/textTocRule" -> viewModel.importTextTocRule(url, this::finallyDialog)
"httpTTS" -> viewModel.importHttpTTS(url, this::finallyDialog) "/httpTTS" -> viewModel.importHttpTTS(url, this::finallyDialog)
"theme" -> viewModel.importTheme(url, this::finallyDialog) "/theme" -> viewModel.importTheme(url, this::finallyDialog)
"readConfig" -> viewModel.importReadConfig(url, this::finallyDialog) "/readConfig" -> viewModel.importReadConfig(url, this::finallyDialog)
else -> { "/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.DrawableUtils
import io.legado.app.lib.theme.primaryTextColor import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.service.help.Download 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.association.OnLineImportActivity
import io.legado.app.ui.document.FilePicker import io.legado.app.ui.document.FilePicker
import io.legado.app.ui.document.FilePickerParam import io.legado.app.ui.document.FilePickerParam
@ -336,25 +333,9 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
"http", "https" -> { "http", "https" -> {
return false return false
} }
"legado" -> { "legado", "yuedu" -> {
when (url.host) { startActivity<OnLineImportActivity> {
"import" -> startActivity<OnLineImportActivity> { data = url
data = url
}
}
return true
}
"yuedu" -> {
when (url.host) {
"booksource" -> startActivity<ImportBookSourceActivity> {
data = url
}
"rsssource" -> startActivity<ImportRssSourceActivity> {
data = url
}
"replace" -> startActivity<ImportReplaceRuleActivity> {
data = url
}
} }
return true return true
} }

Loading…
Cancel
Save