diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt index 11c2fed44..fd2ef2151 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/AutoReadDialog.kt @@ -1,7 +1,6 @@ package io.legado.app.ui.book.read.config import android.os.Bundle -import android.util.DisplayMetrics import android.view.* import android.widget.SeekBar import io.legado.app.R @@ -20,10 +19,6 @@ class AutoReadDialog : BaseDialogFragment() { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window?.let { it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index 4b6fa86da..02f7a87c7 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -7,7 +7,6 @@ import android.content.Intent import android.graphics.Color import android.net.Uri import android.os.Bundle -import android.util.DisplayMetrics import android.view.* import androidx.documentfile.provider.DocumentFile import com.jaredrummler.android.colorpicker.ColorPickerDialog @@ -54,10 +53,6 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window?.let { it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 4a3b4bd23..46fbbb215 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config import android.annotation.SuppressLint import android.content.SharedPreferences import android.os.Bundle -import android.util.DisplayMetrics import android.view.* import android.widget.LinearLayout import androidx.fragment.app.DialogFragment @@ -25,10 +24,6 @@ class MoreConfigDialog : DialogFragment() { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window?.let { it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt index 3ae466454..cf37d30d2 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudConfigDialog.kt @@ -32,8 +32,7 @@ class ReadAloudConfigDialog : DialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - - it.setBackgroundDrawableResource(R.color.transparent) + it.setBackgroundDrawableResource(R.color.transparent) it.setLayout((dm.widthPixels * 0.9).toInt(), ViewGroup.LayoutParams.WRAP_CONTENT) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt index 7fcd0f26d..ebd5bae64 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadAloudDialog.kt @@ -1,7 +1,6 @@ package io.legado.app.ui.book.read.config import android.os.Bundle -import android.util.DisplayMetrics import android.view.* import android.widget.SeekBar import io.legado.app.R @@ -25,10 +24,6 @@ class ReadAloudDialog : BaseDialogFragment() { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window?.let { it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 0b9923115..ef5d6d000 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -3,7 +3,6 @@ package io.legado.app.ui.book.read.config import android.annotation.SuppressLint import android.content.DialogInterface import android.os.Bundle -import android.util.DisplayMetrics import android.view.* import androidx.core.view.get import io.legado.app.R @@ -36,10 +35,6 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window?.let { it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt index 583afb4d4..86d7ca7f9 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TipConfigDialog.kt @@ -1,7 +1,6 @@ package io.legado.app.ui.book.read.config import android.os.Bundle -import android.util.DisplayMetrics import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -19,10 +18,6 @@ class TipConfigDialog : BaseDialogFragment() { override fun onStart() { super.onStart() - val dm = DisplayMetrics() - activity?.let { - it.windowManager?.defaultDisplay?.getMetrics(dm) - } dialog?.window ?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) }