添加一个默认订阅源,阅读下载源

pull/811/head
gedoor 4 years ago
parent f21682229f
commit ed2e80c13d
  1. 6
      app/src/main/java/io/legado/app/help/LocalConfig.kt
  2. 1
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  3. 7
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt
  4. 6
      app/src/main/res/menu/rss_source.xml

@ -65,11 +65,11 @@ object LocalConfig {
get() = isLastVersion(1, "ruleHelpVersion") get() = isLastVersion(1, "ruleHelpVersion")
val hasUpHttpTTS: Boolean val hasUpHttpTTS: Boolean
get() = isLastVersion(1, "httpTtsVersion") get() = !isLastVersion(1, "httpTtsVersion")
val hasUpTxtTocRule: Boolean val hasUpTxtTocRule: Boolean
get() = isLastVersion(1, "txtTocRuleVersion") get() = !isLastVersion(1, "txtTocRuleVersion")
val hasUpRssSources: Boolean val hasUpRssSources: Boolean
get() = isLastVersion(1, "rssSourceVersion") get() = !isLastVersion(1, "rssSourceVersion")
} }

@ -92,6 +92,7 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
R.id.menu_share_source -> viewModel.shareSelection(adapter.getSelection()) { R.id.menu_share_source -> viewModel.shareSelection(adapter.getSelection()) {
startActivity(Intent.createChooser(it, getString(R.string.share_selected_source))) startActivity(Intent.createChooser(it, getString(R.string.share_selected_source)))
} }
R.id.menu_import_default -> viewModel.importDefault()
R.id.menu_help -> showHelp() R.id.menu_help -> showHelp()
else -> if (item.groupId == R.id.source_group) { else -> if (item.groupId == R.id.source_group) {
binding.titleBar.findViewById<SearchView>(R.id.search_view) binding.titleBar.findViewById<SearchView>(R.id.search_view)

@ -9,6 +9,7 @@ import io.legado.app.App
import io.legado.app.BuildConfig import io.legado.app.BuildConfig
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
import io.legado.app.data.entities.RssSource import io.legado.app.data.entities.RssSource
import io.legado.app.help.DefaultData
import io.legado.app.utils.* import io.legado.app.utils.*
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
import java.io.File import java.io.File
@ -166,4 +167,10 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application)
} }
} }
fun importDefault() {
execute {
DefaultData.importDefaultRssSources()
}
}
} }

@ -48,6 +48,12 @@
android:title="@string/import_by_qr_code" android:title="@string/import_by_qr_code"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_import_default"
android:icon="@drawable/ic_import"
android:title="@string/import_default_rule"
app:showAsAction="never" />
<item <item
android:id="@+id/menu_share_source" android:id="@+id/menu_share_source"
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"

Loading…
Cancel
Save