From 99246d48ee0e1244312708b131711baa8e6105cb Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 28 Aug 2020 17:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=98=85=E8=AF=BB=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2=E7=8A=B6=E6=80=81=E6=A0=8F=E9=A2=9C?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/read/config/AutoReadDialog.kt | 8 ++------ .../legado/app/ui/book/read/config/BgTextConfigDialog.kt | 9 +++------ .../legado/app/ui/book/read/config/MoreConfigDialog.kt | 7 ++----- .../app/ui/book/read/config/PaddingConfigDialog.kt | 4 ++-- .../app/ui/book/read/config/ReadAloudConfigDialog.kt | 5 ++--- .../io/legado/app/ui/book/read/config/ReadAloudDialog.kt | 8 ++------ .../io/legado/app/ui/book/read/config/ReadStyleDialog.kt | 8 ++------ 7 files changed, 15 insertions(+), 34 deletions(-) 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 cb697be77..11c2fed44 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 @@ -2,10 +2,7 @@ package io.legado.app.ui.book.read.config import android.os.Bundle import android.util.DisplayMetrics -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.view.* import android.widget.SeekBar import io.legado.app.R import io.legado.app.base.BaseDialogFragment @@ -14,7 +11,6 @@ import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud -import io.legado.app.ui.book.read.Help import io.legado.app.utils.ColorUtils import kotlinx.android.synthetic.main.dialog_auto_read.* import org.jetbrains.anko.sdk27.listeners.onClick @@ -29,7 +25,7 @@ class AutoReadDialog : BaseDialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 0, 0, 0) val attr = it.attributes 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 d859d7685..eaaf2f4d4 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 @@ -9,10 +9,7 @@ import android.graphics.Color import android.net.Uri import android.os.Bundle import android.util.DisplayMetrics -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.view.* import androidx.documentfile.provider.DocumentFile import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -50,7 +47,7 @@ class BgTextConfigDialog : BaseDialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 5, 0, 0) val attr = it.attributes @@ -102,7 +99,7 @@ class BgTextConfigDialog : BaseDialogFragment() { sw_dark_status_icon.onCheckedChange { buttonView, isChecked -> if (buttonView?.isPressed == true) { setStatusIconDark(isChecked) - dialog?.window?.let { + activity?.window?.let { Help.upSystemUiVisibility(it) } } 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 e17cb808a..1e7aa8d1c 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 @@ -4,10 +4,7 @@ import android.annotation.SuppressLint import android.content.SharedPreferences import android.os.Bundle import android.util.DisplayMetrics -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.view.* import android.widget.LinearLayout import androidx.fragment.app.DialogFragment import androidx.preference.Preference @@ -33,7 +30,7 @@ class MoreConfigDialog : DialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 0, 0, 0) val attr = it.attributes diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt index 808306ed6..dda13716a 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/PaddingConfigDialog.kt @@ -6,11 +6,11 @@ import android.util.DisplayMetrics import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.WindowManager import io.legado.app.R import io.legado.app.base.BaseDialogFragment import io.legado.app.constant.EventBus import io.legado.app.help.ReadBookConfig -import io.legado.app.ui.book.read.Help import io.legado.app.utils.postEvent import kotlinx.android.synthetic.main.dialog_read_padding.* @@ -23,7 +23,7 @@ class PaddingConfigDialog : BaseDialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) val attr = it.attributes attr.dimAmount = 0.0f it.attributes = attr 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 be79b46f7..3ae466454 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 @@ -19,7 +19,6 @@ import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.backgroundColor import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud -import io.legado.app.ui.book.read.Help import io.legado.app.utils.getPrefLong import io.legado.app.utils.postEvent @@ -33,8 +32,8 @@ class ReadAloudConfigDialog : DialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) - 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 1886837d1..7fcd0f26d 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 @@ -2,10 +2,7 @@ package io.legado.app.ui.book.read.config import android.os.Bundle import android.util.DisplayMetrics -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.view.* import android.widget.SeekBar import io.legado.app.R import io.legado.app.base.BaseDialogFragment @@ -16,7 +13,6 @@ import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.service.BaseReadAloudService import io.legado.app.service.help.ReadAloud import io.legado.app.service.help.ReadBook -import io.legado.app.ui.book.read.Help import io.legado.app.utils.ColorUtils import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.observeEvent @@ -34,7 +30,7 @@ class ReadAloudDialog : BaseDialogFragment() { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 0, 0, 0) val attr = it.attributes 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 4c3897d06..77b789b24 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 @@ -4,10 +4,7 @@ import android.annotation.SuppressLint import android.content.DialogInterface import android.os.Bundle import android.util.DisplayMetrics -import android.view.Gravity -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup +import android.view.* import androidx.core.view.get import io.legado.app.R import io.legado.app.base.BaseDialogFragment @@ -20,7 +17,6 @@ import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.bottomBackground import io.legado.app.lib.theme.getPrimaryTextColor import io.legado.app.lib.theme.primaryColor -import io.legado.app.ui.book.read.Help import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.widget.font.FontSelectDialog import io.legado.app.utils.* @@ -42,7 +38,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { it.windowManager?.defaultDisplay?.getMetrics(dm) } dialog?.window?.let { - Help.upSystemUiVisibility(it) + it.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) it.setBackgroundDrawableResource(R.color.background) it.decorView.setPadding(0, 0, 0, 0) val attr = it.attributes