pull/1395/head
gedoor 3 years ago
parent b0e9b788af
commit 01b6216978
  1. 12
      app/src/main/java/io/legado/app/base/BaseDialogFragment.kt
  2. 3
      app/src/main/java/io/legado/app/base/BaseFragment.kt
  3. 11
      app/src/main/java/io/legado/app/ui/about/AppLogDialog.kt
  4. 11
      app/src/main/java/io/legado/app/ui/about/UpdateDialog.kt
  5. 12
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceDialog.kt
  6. 12
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleDialog.kt
  7. 12
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  8. 15
      app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverDialog.kt
  9. 17
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  10. 11
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  11. 13
      app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt
  12. 12
      app/src/main/java/io/legado/app/ui/book/group/GroupSelectDialog.kt
  13. 11
      app/src/main/java/io/legado/app/ui/book/read/PhotoDialog.kt
  14. 20
      app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt
  15. 12
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  16. 13
      app/src/main/java/io/legado/app/ui/book/read/config/ClickActionConfigDialog.kt
  17. 11
      app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt
  18. 20
      app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt
  19. 21
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  20. 12
      app/src/main/java/io/legado/app/ui/book/read/config/SpeakEngineDialog.kt
  21. 11
      app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt
  22. 12
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  23. 13
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  24. 11
      app/src/main/java/io/legado/app/ui/book/toc/BookmarkDialog.kt
  25. 11
      app/src/main/java/io/legado/app/ui/config/DirectLinkUploadConfig.kt
  26. 13
      app/src/main/java/io/legado/app/ui/config/ThemeListDialog.kt
  27. 11
      app/src/main/java/io/legado/app/ui/dict/DictDialog.kt
  28. 12
      app/src/main/java/io/legado/app/ui/document/FilePickerDialog.kt
  29. 11
      app/src/main/java/io/legado/app/ui/login/RuleUiLoginDialog.kt
  30. 12
      app/src/main/java/io/legado/app/ui/replace/GroupManageDialog.kt
  31. 13
      app/src/main/java/io/legado/app/ui/rss/source/manage/GroupManageDialog.kt
  32. 12
      app/src/main/java/io/legado/app/ui/widget/dialog/CodeDialog.kt
  33. 12
      app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt
  34. 11
      app/src/main/java/io/legado/app/ui/widget/dialog/TextListDialog.kt
  35. 12
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt
  36. 11
      app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt

@ -1,9 +1,8 @@
package io.legado.app.base
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import io.legado.app.help.coroutine.Coroutine
@ -15,13 +14,8 @@ import kotlinx.coroutines.cancel
import kotlin.coroutines.CoroutineContext
abstract class BaseDialogFragment : DialogFragment(), CoroutineScope by MainScope() {
abstract override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View?
abstract class BaseDialogFragment(@LayoutRes layoutID: Int) : DialogFragment(layoutID),
CoroutineScope by MainScope() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

@ -7,6 +7,7 @@ import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.annotation.LayoutRes
import androidx.appcompat.view.SupportMenuInflater
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment
@ -18,7 +19,7 @@ import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
@Suppress("MemberVisibilityCanBePrivate")
abstract class BaseFragment(layoutID: Int) : Fragment(layoutID),
abstract class BaseFragment(@LayoutRes layoutID: Int) : Fragment(layoutID),
CoroutineScope by MainScope() {
var supportToolbar: Toolbar? = null

@ -2,7 +2,6 @@ package io.legado.app.ui.about
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
@ -22,7 +21,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onClick
import java.util.*
class AppLogDialog : BaseDialogFragment() {
class AppLogDialog : BaseDialogFragment(R.layout.dialog_recycler_view) {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val adapter by lazy {
@ -34,14 +33,6 @@ class AppLogDialog : BaseDialogFragment() {
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.run {
toolBar.setBackgroundColor(primaryColor)

@ -1,7 +1,6 @@
package io.legado.app.ui.about
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
@ -18,7 +17,7 @@ import io.noties.markwon.ext.tables.TablePlugin
import io.noties.markwon.html.HtmlPlugin
import io.noties.markwon.image.glide.GlideImagesPlugin
class UpdateDialog() : BaseDialogFragment() {
class UpdateDialog() : BaseDialogFragment(R.layout.dialog_update) {
constructor(newVersion: String, updateBody: String, url: String, name: String) : this() {
arguments = Bundle().apply {
@ -36,14 +35,6 @@ class UpdateDialog() : BaseDialogFragment() {
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_update, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.title = arguments?.getString("newVersion")

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -34,7 +33,8 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
* 导入书源弹出窗口
*/
class ImportBookSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
constructor(source: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
@ -55,14 +55,6 @@ class ImportBookSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickLi
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
if (arguments?.getBoolean("finishOnDismiss") == true) {

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -29,7 +28,8 @@ import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ImportReplaceRuleDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class ImportReplaceRuleDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
constructor(source: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
@ -57,14 +57,6 @@ class ImportReplaceRuleDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickL
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
@SuppressLint("NotifyDataSetChanged")
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)

@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -33,7 +32,8 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
* 导入rss源弹出窗口
*/
class ImportRssSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class ImportRssSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
constructor(source: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
@ -61,14 +61,6 @@ class ImportRssSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickLis
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
@SuppressLint("NotifyDataSetChanged")
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)

@ -1,10 +1,8 @@
package io.legado.app.ui.book.changecover
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.GridLayoutManager
@ -17,7 +15,7 @@ import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ChangeCoverDialog() : BaseDialogFragment(),
class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
Toolbar.OnMenuItemClickListener,
CoverAdapter.CallBack {
@ -29,7 +27,7 @@ class ChangeCoverDialog() : BaseDialogFragment(),
}
private val binding by viewBinding(DialogChangeCoverBinding::bind)
private var callBack: CallBack? = null
private val callBack: CallBack? get() = activity as? CallBack
private val viewModel: ChangeCoverViewModel by viewModels()
private val adapter by lazy { CoverAdapter(requireContext(), this) }
@ -41,15 +39,6 @@ class ChangeCoverDialog() : BaseDialogFragment(),
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
callBack = activity as? CallBack
return inflater.inflate(R.layout.dialog_change_cover, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.setTitle(R.string.change_cover_source)

@ -1,7 +1,9 @@
package io.legado.app.ui.book.changesource
import android.os.Bundle
import android.view.*
import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar
import androidx.core.os.bundleOf
@ -29,7 +31,7 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class ChangeSourceDialog() : BaseDialogFragment(),
class ChangeSourceDialog() : BaseDialogFragment(R.layout.dialog_change_source),
Toolbar.OnMenuItemClickListener,
ChangeSourceAdapter.CallBack {
@ -42,7 +44,7 @@ class ChangeSourceDialog() : BaseDialogFragment(),
private val binding by viewBinding(DialogChangeSourceBinding::bind)
private val groups = linkedSetOf<String>()
private var callBack: CallBack? = null
private val callBack: CallBack? get() = activity as? CallBack
private val viewModel: ChangeSourceViewModel by viewModels()
private val adapter by lazy { ChangeSourceAdapter(requireContext(), viewModel, this) }
private val editSourceResult =
@ -56,15 +58,6 @@ class ChangeSourceDialog() : BaseDialogFragment(),
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
callBack = activity as? CallBack
return inflater.inflate(R.layout.dialog_change_source, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
viewModel.initData(arguments)

@ -1,7 +1,6 @@
package io.legado.app.ui.book.group
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
@ -15,7 +14,7 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onClick
class GroupEditDialog() : BaseDialogFragment() {
class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) {
constructor(bookGroup: BookGroup? = null) : this() {
arguments = Bundle().apply {
@ -43,14 +42,6 @@ class GroupEditDialog() : BaseDialogFragment() {
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_book_group_edit, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
bookGroup = arguments?.getParcelable("group")

@ -2,7 +2,6 @@ package io.legado.app.ui.book.group
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -33,7 +32,9 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class GroupManageDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val viewModel: GroupViewModel by viewModels()
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val adapter by lazy { GroupAdapter(requireContext()) }
@ -43,14 +44,6 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.title = getString(R.string.group_manage)

@ -2,7 +2,6 @@ package io.legado.app.ui.book.group
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -32,7 +31,8 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class GroupSelectDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class GroupSelectDialog() : BaseDialogFragment(R.layout.dialog_book_group_picker),
Toolbar.OnMenuItemClickListener {
constructor(groupId: Long, requestCode: Int = -1) : this() {
arguments = Bundle().apply {
@ -53,14 +53,6 @@ class GroupSelectDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListene
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_book_group_picker, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
callBack = activity as? CallBack

@ -1,7 +1,6 @@
package io.legado.app.ui.book.read
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
@ -13,7 +12,7 @@ import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
class PhotoDialog() : BaseDialogFragment() {
class PhotoDialog() : BaseDialogFragment(R.layout.dialog_photo_view) {
constructor(chapterIndex: Int, src: String) : this() {
arguments = Bundle().apply {
@ -32,14 +31,6 @@ class PhotoDialog() : BaseDialogFragment() {
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View? {
return inflater.inflate(R.layout.dialog_photo_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
arguments?.let {
val chapterIndex = it.getInt("chapterIndex")

@ -2,7 +2,10 @@ package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.view.*
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.SeekBar
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -20,10 +23,10 @@ import io.legado.app.utils.ColorUtils
import io.legado.app.utils.viewbindingdelegate.viewBinding
class AutoReadDialog : BaseDialogFragment() {
var callBack: CallBack? = null
class AutoReadDialog : BaseDialogFragment(R.layout.dialog_auto_read) {
private val binding by viewBinding(DialogAutoReadBinding::bind)
private val callBack: CallBack? get() = activity as? CallBack
override fun onStart() {
super.onStart()
@ -44,17 +47,8 @@ class AutoReadDialog : BaseDialogFragment() {
(activity as ReadBookActivity).bottomDialog--
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
(activity as ReadBookActivity).bottomDialog++
callBack = activity as? CallBack
return inflater.inflate(R.layout.dialog_auto_read, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) = binding.run {
(activity as ReadBookActivity).bottomDialog++
val bg = requireContext().bottomBackground
val isLight = ColorUtils.isColorLight(bg)
val textColor = requireContext().getPrimaryTextColor(isLight)

@ -30,7 +30,7 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.io.File
class BgTextConfigDialog : BaseDialogFragment() {
class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
companion object {
const val TEXT_COLOR = 121
@ -75,16 +75,8 @@ class BgTextConfigDialog : BaseDialogFragment() {
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
(activity as ReadBookActivity).bottomDialog++
return inflater.inflate(R.layout.dialog_read_bg_text, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
(activity as ReadBookActivity).bottomDialog++
initView()
initData()
initEvent()

@ -2,7 +2,6 @@ package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
@ -18,7 +17,7 @@ import io.legado.app.utils.putPrefInt
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ClickActionConfigDialog : BaseDialogFragment() {
class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_config) {
private val binding by viewBinding(DialogClickActionConfigBinding::bind)
private val actions by lazy {
linkedMapOf<Int, String>().apply {
@ -41,21 +40,13 @@ class ClickActionConfigDialog : BaseDialogFragment() {
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
(activity as ReadBookActivity).bottomDialog++
return inflater.inflate(R.layout.dialog_click_action_config, container)
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
(activity as ReadBookActivity).bottomDialog--
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
(activity as ReadBookActivity).bottomDialog++
view.setBackgroundColor(getCompatColor(R.color.translucent))
initData()
initViewEvent()

@ -2,7 +2,6 @@ package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
@ -15,7 +14,7 @@ import io.legado.app.utils.postEvent
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
class PaddingConfigDialog : BaseDialogFragment() {
class PaddingConfigDialog : BaseDialogFragment(R.layout.dialog_read_padding) {
private val binding by viewBinding(DialogReadPaddingBinding::bind)
@ -30,14 +29,6 @@ class PaddingConfigDialog : BaseDialogFragment() {
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_read_padding, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
initData()
initView()

@ -2,7 +2,10 @@ package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.view.*
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.SeekBar
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -23,8 +26,8 @@ import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ReadAloudDialog : BaseDialogFragment() {
private var callBack: CallBack? = null
class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
private val callBack: CallBack? get() = activity as? CallBack
private val binding by viewBinding(DialogReadAloudBinding::bind)
override fun onStart() {
@ -46,17 +49,8 @@ class ReadAloudDialog : BaseDialogFragment() {
(activity as ReadBookActivity).bottomDialog--
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
(activity as ReadBookActivity).bottomDialog++
callBack = activity as? CallBack
return inflater.inflate(R.layout.dialog_read_aloud, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
(activity as ReadBookActivity).bottomDialog++
val bg = requireContext().bottomBackground
val isLight = ColorUtils.isColorLight(bg)
val textColor = requireContext().getPrimaryTextColor(isLight)

@ -2,7 +2,10 @@ package io.legado.app.ui.book.read.config
import android.content.DialogInterface
import android.os.Bundle
import android.view.*
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.core.view.get
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
@ -23,9 +26,11 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onLongClick
class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
class ReadStyleDialog : BaseDialogFragment(R.layout.dialog_read_book_style),
FontSelectDialog.CallBack {
private val binding by viewBinding(DialogReadBookStyleBinding::bind)
val callBack get() = activity as? ReadBookActivity
private val callBack get() = activity as? ReadBookActivity
private lateinit var styleAdapter: StyleAdapter
override fun onStart() {
@ -42,16 +47,8 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
(activity as ReadBookActivity).bottomDialog++
return inflater.inflate(R.layout.dialog_read_book_style, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
(activity as ReadBookActivity).bottomDialog++
initView()
initData()
initViewEvent()

@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -35,7 +34,8 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class SpeakEngineDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val viewModel: SpeakEngineViewModel by viewModels()
@ -71,14 +71,6 @@ class SpeakEngineDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
initView()
initMenu()

@ -1,7 +1,6 @@
package io.legado.app.ui.book.read.config
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.jaredrummler.android.colorpicker.ColorPickerDialog
@ -16,7 +15,7 @@ import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
class TipConfigDialog : BaseDialogFragment() {
class TipConfigDialog : BaseDialogFragment(R.layout.dialog_tip_config) {
companion object {
const val TIP_COLOR = 7897
@ -29,14 +28,6 @@ class TipConfigDialog : BaseDialogFragment() {
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View? {
return inflater.inflate(R.layout.dialog_tip_config, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
initView()
initEvent()

@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -34,7 +33,8 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import java.util.*
class TocRegexDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
Toolbar.OnMenuItemClickListener {
constructor(tocRegex: String?) : this() {
arguments = Bundle().apply {
@ -54,14 +54,6 @@ class TocRegexDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
setLayout(0.9f, 0.8f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_toc_regex, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
durRegex = arguments?.getString("tocRegex")

@ -3,7 +3,6 @@ package io.legado.app.ui.book.source.manage
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -32,7 +31,9 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class GroupManageDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val viewModel: BookSourceViewModel by activityViewModels()
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val adapter by lazy { GroupAdapter(requireContext()) }
@ -42,14 +43,6 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
view.setBackgroundColor(backgroundColor)
binding.toolBar.setBackgroundColor(primaryColor)

@ -1,7 +1,6 @@
package io.legado.app.ui.book.toc
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
@ -16,7 +15,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class BookmarkDialog() : BaseDialogFragment() {
class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
constructor(bookmark: Bookmark) : this() {
arguments = Bundle().apply {
@ -34,14 +33,6 @@ class BookmarkDialog() : BaseDialogFragment() {
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_bookmark, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
val bookmark = arguments?.getParcelable<Bookmark>("bookmark")

@ -1,7 +1,6 @@
package io.legado.app.ui.config
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
@ -14,7 +13,7 @@ import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding
import splitties.views.onClick
class DirectLinkUploadConfig : BaseDialogFragment() {
class DirectLinkUploadConfig : BaseDialogFragment(R.layout.dialog_direct_link_upload_config) {
private val binding by viewBinding(DialogDirectLinkUploadConfigBinding::bind)
@ -26,14 +25,6 @@ class DirectLinkUploadConfig : BaseDialogFragment() {
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_direct_link_upload_config, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.editUploadUrl.setText(DirectLinkUpload.getUploadUrl())

@ -2,7 +2,6 @@ package io.legado.app.ui.config
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -21,7 +20,9 @@ import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.viewbindingdelegate.viewBinding
class ThemeListDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class ThemeListDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val adapter by lazy { Adapter(requireContext()) }
@ -30,14 +31,6 @@ class ThemeListDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.setTitle(R.string.theme_list)

@ -2,7 +2,6 @@ package io.legado.app.ui.dict
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
@ -18,7 +17,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
* 词典
*/
class DictDialog() : BaseDialogFragment() {
class DictDialog() : BaseDialogFragment(R.layout.dialog_dict) {
constructor(word: String) : this() {
arguments = Bundle().apply {
@ -34,14 +33,6 @@ class DictDialog() : BaseDialogFragment() {
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View? {
return inflater.inflate(R.layout.dialog_dict, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.tvDict.movementMethod = LinkMovementMethod()
val word = arguments?.getString("word")

@ -4,10 +4,8 @@ import android.content.DialogInterface
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.LinearLayoutManager
@ -26,7 +24,7 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.io.File
class FilePickerDialog : BaseDialogFragment(),
class FilePickerDialog : BaseDialogFragment(R.layout.dialog_file_chooser),
Toolbar.OnMenuItemClickListener,
FileAdapter.CallBack,
PathAdapter.CallBack {
@ -79,14 +77,6 @@ class FilePickerDialog : BaseDialogFragment(),
setLayout(0.9f, 0.8f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_file_chooser, container, true)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
view.setBackgroundResource(R.color.background_card)

@ -3,7 +3,6 @@ package io.legado.app.ui.login
import android.content.DialogInterface
import android.os.Bundle
import android.text.InputType
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
@ -25,7 +24,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import splitties.views.onClick
class RuleUiLoginDialog : BaseDialogFragment() {
class RuleUiLoginDialog : BaseDialogFragment(R.layout.dialog_login) {
private val binding by viewBinding(DialogLoginBinding::bind)
private val viewModel by activityViewModels<SourceLoginViewModel>()
@ -38,14 +37,6 @@ class RuleUiLoginDialog : BaseDialogFragment() {
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_login, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
val source = viewModel.source ?: return
binding.toolBar.setBackgroundColor(primaryColor)

@ -3,7 +3,6 @@ package io.legado.app.ui.replace
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -29,7 +28,8 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class GroupManageDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val viewModel: ReplaceRuleViewModel by activityViewModels()
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
@ -40,14 +40,6 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
view.setBackgroundColor(backgroundColor)
binding.toolBar.setBackgroundColor(primaryColor)

@ -3,7 +3,6 @@ package io.legado.app.ui.rss.source.manage
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
@ -30,7 +29,9 @@ import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class GroupManageDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
Toolbar.OnMenuItemClickListener {
private val viewModel: RssSourceViewModel by activityViewModels()
private val binding by viewBinding(DialogRecyclerViewBinding::bind)
private val adapter by lazy { GroupAdapter(requireContext()) }
@ -40,14 +41,6 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) = binding.run {
toolBar.setBackgroundColor(primaryColor)
toolBar.title = getString(R.string.group_manage)

@ -1,9 +1,7 @@
package io.legado.app.ui.widget.dialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogCodeViewBinding
@ -13,7 +11,7 @@ import io.legado.app.utils.addLegadoPattern
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
class CodeDialog() : BaseDialogFragment() {
class CodeDialog() : BaseDialogFragment(R.layout.dialog_code_view) {
constructor(code: String) : this() {
arguments = Bundle().apply {
@ -28,14 +26,6 @@ class CodeDialog() : BaseDialogFragment() {
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_code_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.codeView.addLegadoPattern()
binding.codeView.addJsonPattern()

@ -1,9 +1,7 @@
package io.legado.app.ui.widget.dialog
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogTextViewBinding
@ -18,7 +16,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class TextDialog() : BaseDialogFragment() {
class TextDialog() : BaseDialogFragment(R.layout.dialog_text_view) {
enum class Mode {
MD, HTML, TEXT
@ -48,14 +46,6 @@ class TextDialog() : BaseDialogFragment() {
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_text_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
arguments?.let {
val content = it.getString("content") ?: ""

@ -2,7 +2,6 @@ package io.legado.app.ui.widget.dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
@ -15,7 +14,7 @@ import io.legado.app.databinding.ItemLogBinding
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
class TextListDialog() : BaseDialogFragment() {
class TextListDialog() : BaseDialogFragment(R.layout.dialog_recycler_view) {
constructor(title: String, values: ArrayList<String>) : this() {
arguments = Bundle().apply {
@ -33,14 +32,6 @@ class TextListDialog() : BaseDialogFragment() {
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) = binding.run {
arguments?.let {
toolBar.title = it.getString("title")

@ -3,10 +3,8 @@ package io.legado.app.ui.widget.font
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.documentfile.provider.DocumentFile
import androidx.recyclerview.widget.LinearLayoutManager
@ -30,7 +28,7 @@ import java.io.File
import java.util.*
import kotlin.collections.ArrayList
class FontSelectDialog : BaseDialogFragment(),
class FontSelectDialog : BaseDialogFragment(R.layout.dialog_font_select),
Toolbar.OnMenuItemClickListener,
FontAdapter.CallBack {
private val fontRegex = Regex(".*\\.[ot]tf")
@ -68,14 +66,6 @@ class FontSelectDialog : BaseDialogFragment(),
setLayout(0.9f, 0.9f)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_font_select, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.setTitle(R.string.select_font)

@ -5,7 +5,6 @@ import android.content.ContextWrapper
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
@ -120,7 +119,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
return "icon_$key"
}
class IconDialog : BaseDialogFragment() {
class IconDialog : BaseDialogFragment(R.layout.dialog_recycler_view) {
var onChanged: ((value: String) -> Unit)? = null
var dialogValue: String? = null
@ -137,14 +136,6 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.dialog_recycler_view, container)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.setTitle(R.string.change_icon)

Loading…
Cancel
Save