From dbe03c79f7b87bc74e2dd41f0f962517f4a5ced6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 3 May 2020 00:07:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/config/TipConfigDialog.kt | 12 ++++++++++-- .../io/legado/app/ui/book/read/page/ContentView.kt | 9 ++++----- 2 files changed, 14 insertions(+), 7 deletions(-) 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 2635b70b2..c48edc0be 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 @@ -86,7 +86,11 @@ class TipConfigDialog : BaseDialogFragment() { tipHeaderLeft = i tv_header_left.text = tipArray[i] } - postEvent(EventBus.UP_CONFIG, true) + if (i == ReadTipConfig.battery) { + activity?.recreate() + } else { + postEvent(EventBus.UP_CONFIG, true) + } } } tv_header_middle.onClick { @@ -179,7 +183,11 @@ class TipConfigDialog : BaseDialogFragment() { tipFooterLeft = i tv_footer_left.text = tipArray[i] } - postEvent(EventBus.UP_CONFIG, true) + if (i == ReadTipConfig.battery) { + activity?.recreate() + } else { + postEvent(EventBus.UP_CONFIG, true) + } } } tv_footer_middle.onClick { diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt index 1c602e444..7015404cb 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt @@ -4,7 +4,6 @@ import android.annotation.SuppressLint import android.content.Context import android.graphics.drawable.Drawable import android.view.MotionEvent -import android.view.ViewGroup import android.widget.FrameLayout import androidx.core.view.isGone import androidx.core.view.isInvisible @@ -143,8 +142,8 @@ class ContentView(context: Context) : FrameLayout(context) { ReadTipConfig.tipHeaderLeft -> { ConstraintUtil(ll_header).begin() .clear(R.id.tv_header_left, 2) - .setWidth(R.id.tv_header_left, ViewGroup.LayoutParams.WRAP_CONTENT) - .setHorizontalWeight(R.id.tv_footer_left, 0f) + .setHorizontalWeight(R.id.tv_footer_left, 0.0F) + .setWidth(R.id.tv_header_left, LayoutParams.WRAP_CONTENT) .commit() tv_header_left } @@ -153,8 +152,8 @@ class ContentView(context: Context) : FrameLayout(context) { ReadTipConfig.tipFooterLeft -> { ConstraintUtil(ll_header).begin() .clear(R.id.tv_footer_left, 2) - .setWidth(R.id.tv_footer_left, ViewGroup.LayoutParams.WRAP_CONTENT) - .setHorizontalWeight(R.id.tv_footer_left, 0f) + .setHorizontalWeight(R.id.tv_footer_left, 0.0F) + .setWidth(R.id.tv_footer_left, LayoutParams.WRAP_CONTENT) .commit() tv_footer_left }