This commit is contained in:
kunfei 2022-02-28 22:40:28 +08:00
parent 651d501ff4
commit 161f928463
17 changed files with 54 additions and 76 deletions

View File

@ -42,7 +42,7 @@ class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
override fun onStart() {
super.onStart()
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 0.96f)
setLayout(0.98f, ViewGroup.LayoutParams.MATCH_PARENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -57,7 +57,7 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
override fun onStart() {
super.onStart()
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 0.96f)
setLayout(0.98f, ViewGroup.LayoutParams.MATCH_PARENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -81,7 +81,7 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
override fun onStart() {
super.onStart()
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 0.96f)
setLayout(0.98f, ViewGroup.LayoutParams.MATCH_PARENT)
dialog?.setOnKeyListener(this)
}

View File

@ -36,10 +36,7 @@ class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) {
override fun onStart() {
super.onStart()
setLayout(
0.9f,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -2,7 +2,6 @@ package io.legado.app.ui.book.read
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.databinding.DialogPhotoViewBinding
@ -11,7 +10,9 @@ import io.legado.app.ui.book.read.page.provider.ImageProvider
import io.legado.app.utils.setLayout
import io.legado.app.utils.viewbindingdelegate.viewBinding
/**
* 显示图片
*/
class PhotoDialog() : BaseDialogFragment(R.layout.dialog_photo_view) {
constructor(chapterIndex: Int, src: String) : this() {
@ -25,10 +26,7 @@ class PhotoDialog() : BaseDialogFragment(R.layout.dialog_photo_view) {
override fun onStart() {
super.onStart()
setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
setLayout(0.98f, 0.98f)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -30,15 +30,15 @@ class AutoReadDialog : BaseDialogFragment(R.layout.dialog_auto_read) {
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
it.setBackgroundDrawableResource(R.color.background)
it.decorView.setPadding(0, 0, 0, 0)
val attr = it.attributes
dialog?.window?.run {
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
setBackgroundDrawableResource(R.color.background)
decorView.setPadding(0, 0, 0, 0)
val attr = attributes
attr.dimAmount = 0.0f
attr.gravity = Gravity.BOTTOM
it.attributes = attr
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
attributes = attr
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
}

View File

@ -71,15 +71,15 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
it.setBackgroundDrawableResource(R.color.background)
it.decorView.setPadding(0, 0, 0, 0)
val attr = it.attributes
dialog?.window?.run {
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
setBackgroundDrawableResource(R.color.background)
decorView.setPadding(0, 0, 0, 0)
val attr = attributes
attr.dimAmount = 0.0f
attr.gravity = Gravity.BOTTOM
it.attributes = attr
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
attributes = attr
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
}

View File

@ -34,9 +34,9 @@ class ClickActionConfigDialog : BaseDialogFragment(R.layout.dialog_click_action_
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.setBackgroundDrawableResource(R.color.transparent)
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
dialog?.window?.run {
setBackgroundDrawableResource(R.color.transparent)
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}
}

View File

@ -28,15 +28,15 @@ class MoreConfigDialog : DialogFragment() {
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
it.setBackgroundDrawableResource(R.color.background)
it.decorView.setPadding(0, 0, 0, 0)
val attr = it.attributes
dialog?.window?.run {
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
setBackgroundDrawableResource(R.color.background)
decorView.setPadding(0, 0, 0, 0)
val attr = attributes
attr.dimAmount = 0.0f
attr.gravity = Gravity.BOTTOM
it.attributes = attr
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 360.dp)
attributes = attr
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 360.dp)
}
}

View File

@ -14,7 +14,6 @@ import io.legado.app.base.BasePreferenceFragment
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.SelectItem
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor
@ -27,10 +26,9 @@ class ReadAloudConfigDialog : DialogFragment() {
override fun onStart() {
super.onStart()
val dm = requireActivity().windowSize
dialog?.window?.let {
it.setBackgroundDrawableResource(R.color.transparent)
it.setLayout((dm.widthPixels * 0.9).toInt(), ViewGroup.LayoutParams.WRAP_CONTENT)
dialog?.window?.run {
setBackgroundDrawableResource(R.color.transparent)
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
}

View File

@ -32,15 +32,15 @@ class ReadAloudDialog : BaseDialogFragment(R.layout.dialog_read_aloud) {
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
it.setBackgroundDrawableResource(R.color.background)
it.decorView.setPadding(0, 0, 0, 0)
val attr = it.attributes
dialog?.window?.run {
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
setBackgroundDrawableResource(R.color.background)
decorView.setPadding(0, 0, 0, 0)
val attr = attributes
attr.dimAmount = 0.0f
attr.gravity = Gravity.BOTTOM
it.attributes = attr
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
attributes = attr
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
}

View File

@ -35,15 +35,15 @@ class ReadStyleDialog : BaseDialogFragment(R.layout.dialog_read_book_style),
override fun onStart() {
super.onStart()
dialog?.window?.let {
it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
it.setBackgroundDrawableResource(R.color.background)
it.decorView.setPadding(0, 0, 0, 0)
val attr = it.attributes
dialog?.window?.run {
clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
setBackgroundDrawableResource(R.color.background)
decorView.setPadding(0, 0, 0, 0)
val attr = attributes
attr.dimAmount = 0.0f
attr.gravity = Gravity.BOTTOM
it.attributes = attr
it.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
attributes = attr
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
}

View File

@ -27,10 +27,7 @@ class BookmarkDialog() : BaseDialogFragment(R.layout.dialog_bookmark) {
override fun onStart() {
super.onStart()
setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -23,10 +23,7 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
override fun onStart() {
super.onStart()
setLayout(
0.9f,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -19,10 +19,7 @@ class DirectLinkUploadConfig : BaseDialogFragment(R.layout.dialog_direct_link_up
override fun onStart() {
super.onStart()
setLayout(
0.9f,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(0.9f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -33,10 +33,7 @@ class SourceLoginDialog : BaseDialogFragment(R.layout.dialog_login) {
override fun onStart() {
super.onStart()
setLayout(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

View File

@ -130,10 +130,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
override fun onStart() {
super.onStart()
setLayout(
0.8f,
ViewGroup.LayoutParams.WRAP_CONTENT
)
setLayout(0.8f, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {