pull/2514/head
kunfei 2 years ago
parent 9585af0702
commit e19311daae
  1. 4
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  2. 4
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  3. 1
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt

@ -413,9 +413,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
var sourceEditMaxLine: Int var sourceEditMaxLine: Int
get() { get() {
val maxLine = appCtx.getPrefInt(PreferKey.sourceEditMaxLine, 99) val maxLine = appCtx.getPrefInt(PreferKey.sourceEditMaxLine, Int.MAX_VALUE)
if (maxLine < 10) { if (maxLine < 10) {
return 99 return Int.MAX_VALUE
} }
return maxLine return maxLine
} }

@ -85,7 +85,7 @@ class OtherConfigFragment : PreferenceFragment(),
PreferKey.preDownloadNum -> NumberPickerDialog(requireContext()) PreferKey.preDownloadNum -> NumberPickerDialog(requireContext())
.setTitle(getString(R.string.pre_download)) .setTitle(getString(R.string.pre_download))
.setMaxValue(9999) .setMaxValue(9999)
.setMinValue(1) .setMinValue(0)
.setValue(AppConfig.preDownloadNum) .setValue(AppConfig.preDownloadNum)
.show { .show {
AppConfig.preDownloadNum = it AppConfig.preDownloadNum = it
@ -123,7 +123,7 @@ class OtherConfigFragment : PreferenceFragment(),
PreferKey.sourceEditMaxLine -> { PreferKey.sourceEditMaxLine -> {
NumberPickerDialog(requireContext()) NumberPickerDialog(requireContext())
.setTitle(getString(R.string.source_edit_text_max_line)) .setTitle(getString(R.string.source_edit_text_max_line))
.setMaxValue(99) .setMaxValue(Int.MAX_VALUE)
.setMinValue(10) .setMinValue(10)
.setValue(AppConfig.sourceEditMaxLine) .setValue(AppConfig.sourceEditMaxLine)
.show { .show {

@ -178,6 +178,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
@Synchronized @Synchronized
private fun addDownload(source: BookSource, book: Book) { private fun addDownload(source: BookSource, book: Book) {
if (AppConfig.preDownloadNum == 0) return
val endIndex = min( val endIndex = min(
book.totalChapterNum - 1, book.totalChapterNum - 1,
book.durChapterIndex.plus(AppConfig.preDownloadNum) book.durChapterIndex.plus(AppConfig.preDownloadNum)

Loading…
Cancel
Save