pull/517/head
gedoor 4 years ago
parent 57fe65e354
commit 08b0520bd2
  1. 22
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  3. 3
      app/src/main/java/io/legado/app/ui/book/read/config/PageKeyDialog.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  5. 3
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt

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

@ -104,7 +104,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FilePickerDialog.CallBack {
adapter = BgAdapter(requireContext(), secondaryTextColor)
binding.recyclerView.adapter = adapter
val headerView = ItemBgImageBinding.inflate(
LayoutInflater.from(requireContext()),
layoutInflater,
binding.recyclerView,
false
)

@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config
import android.app.Dialog
import android.content.Context
import android.view.KeyEvent
import android.view.LayoutInflater
import io.legado.app.R
import io.legado.app.constant.PreferKey
import io.legado.app.databinding.DialogPageKeyBinding
@ -16,7 +15,7 @@ import org.jetbrains.anko.sdk27.listeners.onClick
class PageKeyDialog(context: Context) : Dialog(context, R.style.AppTheme_AlertDialog) {
private val binding = DialogPageKeyBinding.inflate(LayoutInflater.from(context))
private val binding = DialogPageKeyBinding.inflate(layoutInflater)
init {
setContentView(binding.root)

@ -87,7 +87,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
styleAdapter = StyleAdapter()
rvStyle.adapter = styleAdapter
val footerBinding =
ItemReadStyleBinding.inflate(LayoutInflater.from(requireContext()), rvStyle, false)
ItemReadStyleBinding.inflate(layoutInflater, rvStyle, false)
footerBinding.ivStyle.setPadding(6.dp, 6.dp, 6.dp, 6.dp)
footerBinding.ivStyle.setText(null)
footerBinding.ivStyle.setColorFilter(textColor)

@ -105,8 +105,7 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
private fun editHttpTTS(v: HttpTTS? = null) {
val httpTTS = v?.copy() ?: HttpTTS()
requireContext().alert(titleResource = R.string.speak_engine) {
val alertBinding =
DialogHttpTtsEditBinding.inflate(LayoutInflater.from(requireContext()))
val alertBinding = DialogHttpTtsEditBinding.inflate(layoutInflater)
alertBinding.tvName.setText(httpTTS.name)
alertBinding.tvUrl.setText(httpTTS.url)
customView = alertBinding.root

Loading…
Cancel
Save