|
|
@ -179,23 +179,19 @@ abstract class ReadBookBaseActivity : |
|
|
|
fun showDownloadDialog() { |
|
|
|
fun showDownloadDialog() { |
|
|
|
ReadBook.book?.let { book -> |
|
|
|
ReadBook.book?.let { book -> |
|
|
|
alert(titleResource = R.string.offline_cache) { |
|
|
|
alert(titleResource = R.string.offline_cache) { |
|
|
|
var dialogBinding: DialogDownloadChoiceBinding? = null |
|
|
|
val alertBinding = DialogDownloadChoiceBinding.inflate(layoutInflater).apply { |
|
|
|
customView { |
|
|
|
root.setBackgroundColor(root.context.backgroundColor) |
|
|
|
LayoutInflater.from(this@ReadBookBaseActivity) |
|
|
|
editStart.setText((book.durChapterIndex + 1).toString()) |
|
|
|
.inflate(R.layout.dialog_download_choice, null) |
|
|
|
editEnd.setText(book.totalChapterNum.toString()) |
|
|
|
.apply { |
|
|
|
|
|
|
|
dialogBinding = DialogDownloadChoiceBinding.bind(this) |
|
|
|
|
|
|
|
setBackgroundColor(context.backgroundColor) |
|
|
|
|
|
|
|
dialogBinding!!.editStart.setText((book.durChapterIndex + 1).toString()) |
|
|
|
|
|
|
|
dialogBinding!!.editEnd.setText(book.totalChapterNum.toString()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
customView = alertBinding.root |
|
|
|
yesButton { |
|
|
|
yesButton { |
|
|
|
val start = dialogBinding!!.editStart.text?.toString()?.toInt() ?: 0 |
|
|
|
alertBinding.run { |
|
|
|
val end = |
|
|
|
val start = editStart.text?.toString()?.toInt() ?: 0 |
|
|
|
dialogBinding!!.editEnd.text?.toString()?.toInt() ?: book.totalChapterNum |
|
|
|
val end = editEnd.text?.toString()?.toInt() ?: book.totalChapterNum |
|
|
|
CacheBook.start(this@ReadBookBaseActivity, book.bookUrl, start - 1, end - 1) |
|
|
|
CacheBook.start(this@ReadBookBaseActivity, book.bookUrl, start - 1, end - 1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
noButton() |
|
|
|
noButton() |
|
|
|
}.show() |
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
|