pull/517/head
gedoor 4 years ago
parent 57fe65e354
commit 08b0520bd2
  1. 24
      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,22 +179,18 @@ 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()

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

@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.view.KeyEvent import android.view.KeyEvent
import android.view.LayoutInflater
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.databinding.DialogPageKeyBinding 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) { 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 { init {
setContentView(binding.root) setContentView(binding.root)

@ -87,7 +87,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
styleAdapter = StyleAdapter() styleAdapter = StyleAdapter()
rvStyle.adapter = styleAdapter rvStyle.adapter = styleAdapter
val footerBinding = 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.setPadding(6.dp, 6.dp, 6.dp, 6.dp)
footerBinding.ivStyle.setText(null) footerBinding.ivStyle.setText(null)
footerBinding.ivStyle.setColorFilter(textColor) footerBinding.ivStyle.setColorFilter(textColor)

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

Loading…
Cancel
Save