From f3481cbd04ea14d69803bd2592a59ce72623fe41 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 17 Nov 2020 20:11:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/book/read/ReadBookBaseActivity.kt | 10 ++-------- .../main/java/io/legado/app/ui/book/read/ReadMenu.kt | 6 ++---- .../io/legado/app/ui/book/read/page/ContentView.kt | 3 +++ .../main/java/io/legado/app/ui/widget/BatteryView.kt | 4 +++- app/src/main/res/layout/dialog_read_aloud.xml | 12 ++++++++---- app/src/main/res/layout/view_book_page.xml | 5 +++++ app/src/main/res/layout/view_read_menu.xml | 12 ++++++++---- 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 1e68e29ff..681435e22 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -5,7 +5,6 @@ import android.app.Activity import android.content.Intent import android.content.pm.ActivityInfo import android.graphics.Color -import android.graphics.drawable.ColorDrawable import android.net.Uri import android.os.Build import android.os.Bundle @@ -166,9 +165,7 @@ abstract class ReadBookBaseActivity : if (!isInMultiWindow) { flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN } - if (ReadBookConfig.hideNavigationBar) { - flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - } + flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION if (toolBarHide) { if (ReadBookConfig.hideStatusBar) { flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN @@ -185,11 +182,8 @@ abstract class ReadBookBaseActivity : read_menu == null -> return read_menu.isVisible -> ATH.setNavigationBarColorAuto(this) bottomDialog > 0 -> ATH.setNavigationBarColorAuto(this, bottomBackground) - ReadBookConfig.bg is ColorDrawable -> { - ATH.setNavigationBarColorAuto(this, ReadBookConfig.bgMeanColor) - } else -> { - ATH.setNavigationBarColorAuto(this, Color.BLACK) + ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT) } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index b349fe629..e21e3ffe1 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -14,7 +14,6 @@ import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig import io.legado.app.help.LocalConfig -import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.* import io.legado.app.service.help.ReadBook import io.legado.app.utils.* @@ -237,10 +236,9 @@ class ReadMenu @JvmOverloads constructor( override fun onAnimationEnd(animation: Animation) { vw_menu_bg.onClick { runMenuOut() } - val hasNavigationBar = ReadBookConfig.hideNavigationBar - && SystemUtils.isNavigationBarExist(activity) vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { - height = if (hasNavigationBar) context.navigationBarHeight else 0 + height = + if (SystemUtils.isNavigationBarExist(activity)) context.navigationBarHeight else 0 } if (LocalConfig.isFirstReadMenuShow) { callBack.showReadMenuHelp() 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 85e2d9d80..7c470c34c 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 @@ -84,6 +84,9 @@ class ContentView(context: Context) : FrameLayout(context) { ) vw_top_divider.visible(showHeaderLine) vw_bottom_divider.visible(showFooterLine) + page_nv_bar.layoutParams = page_nv_bar.layoutParams.apply { + height = if (hideStatusBar) 0 else context.navigationBarHeight + } content_text_view.upVisibleRect() } upTime() diff --git a/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt b/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt index 3c3c1d7c3..9e1d9cded 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BatteryView.kt @@ -26,7 +26,9 @@ class BatteryView @JvmOverloads constructor( batteryPaint.strokeWidth = 1.dp.toFloat() batteryPaint.isAntiAlias = true batteryPaint.color = paint.color - typeface = Typeface.createFromAsset(context.assets, "font${File.separator}number.ttf") + if (!isInEditMode) { + typeface = Typeface.createFromAsset(context.assets, "font${File.separator}number.ttf") + } } fun setColor(@ColorInt color: Int) { diff --git a/app/src/main/res/layout/dialog_read_aloud.xml b/app/src/main/res/layout/dialog_read_aloud.xml index 8d5b33f43..878cdbf8e 100644 --- a/app/src/main/res/layout/dialog_read_aloud.xml +++ b/app/src/main/res/layout/dialog_read_aloud.xml @@ -225,7 +225,8 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" android:text="@string/chapter_list" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -263,7 +264,8 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" android:text="@string/main_menu" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -301,7 +303,8 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" android:text="@string/to_backstage" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -339,7 +342,8 @@ android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" android:text="@string/setting" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:textColor="@color/primaryText" android:textSize="12sp" /> diff --git a/app/src/main/res/layout/view_book_page.xml b/app/src/main/res/layout/view_book_page.xml index 95fd4f1f3..69d35e794 100644 --- a/app/src/main/res/layout/view_book_page.xml +++ b/app/src/main/res/layout/view_book_page.xml @@ -148,4 +148,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/view_read_menu.xml b/app/src/main/res/layout/view_read_menu.xml index 27f387599..e7882c8bc 100644 --- a/app/src/main/res/layout/view_read_menu.xml +++ b/app/src/main/res/layout/view_read_menu.xml @@ -281,7 +281,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:text="@string/chapter_list" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -321,7 +322,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:text="@string/read_aloud" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -361,7 +363,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:text="@string/interface_setting" android:textColor="@color/primaryText" android:textSize="12sp" /> @@ -401,7 +404,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="3dp" - android:maxLines="1" + android:singleLine="true" + android:ellipsize="middle" android:text="@string/setting" android:textColor="@color/primaryText" android:textSize="12sp" />