优化导航栏

pull/487/head^2
gedoor 4 years ago
parent 9c47a79b4d
commit f3481cbd04
  1. 8
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt
  3. 3
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt
  4. 2
      app/src/main/java/io/legado/app/ui/widget/BatteryView.kt
  5. 12
      app/src/main/res/layout/dialog_read_aloud.xml
  6. 5
      app/src/main/res/layout/view_book_page.xml
  7. 12
      app/src/main/res/layout/view_read_menu.xml

@ -5,7 +5,6 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -166,9 +165,7 @@ abstract class ReadBookBaseActivity :
if (!isInMultiWindow) { if (!isInMultiWindow) {
flag = flag or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 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 (toolBarHide) {
if (ReadBookConfig.hideStatusBar) { if (ReadBookConfig.hideStatusBar) {
flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN flag = flag or View.SYSTEM_UI_FLAG_FULLSCREEN
@ -185,11 +182,8 @@ abstract class ReadBookBaseActivity :
read_menu == null -> return read_menu == null -> return
read_menu.isVisible -> ATH.setNavigationBarColorAuto(this) read_menu.isVisible -> ATH.setNavigationBarColorAuto(this)
bottomDialog > 0 -> ATH.setNavigationBarColorAuto(this, bottomBackground) bottomDialog > 0 -> ATH.setNavigationBarColorAuto(this, bottomBackground)
ReadBookConfig.bg is ColorDrawable -> {
ATH.setNavigationBarColorAuto(this, ReadBookConfig.bgMeanColor)
}
else -> { else -> {
ATH.setNavigationBarColorAuto(this, Color.BLACK) ATH.setNavigationBarColorAuto(this, Color.TRANSPARENT)
} }
} }
} }

@ -14,7 +14,6 @@ import io.legado.app.R
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.help.AppConfig import io.legado.app.help.AppConfig
import io.legado.app.help.LocalConfig import io.legado.app.help.LocalConfig
import io.legado.app.help.ReadBookConfig
import io.legado.app.lib.theme.* import io.legado.app.lib.theme.*
import io.legado.app.service.help.ReadBook import io.legado.app.service.help.ReadBook
import io.legado.app.utils.* import io.legado.app.utils.*
@ -237,10 +236,9 @@ class ReadMenu @JvmOverloads constructor(
override fun onAnimationEnd(animation: Animation) { override fun onAnimationEnd(animation: Animation) {
vw_menu_bg.onClick { runMenuOut() } vw_menu_bg.onClick { runMenuOut() }
val hasNavigationBar = ReadBookConfig.hideNavigationBar
&& SystemUtils.isNavigationBarExist(activity)
vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply {
height = if (hasNavigationBar) context.navigationBarHeight else 0 height =
if (SystemUtils.isNavigationBarExist(activity)) context.navigationBarHeight else 0
} }
if (LocalConfig.isFirstReadMenuShow) { if (LocalConfig.isFirstReadMenuShow) {
callBack.showReadMenuHelp() callBack.showReadMenuHelp()

@ -84,6 +84,9 @@ class ContentView(context: Context) : FrameLayout(context) {
) )
vw_top_divider.visible(showHeaderLine) vw_top_divider.visible(showHeaderLine)
vw_bottom_divider.visible(showFooterLine) 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() content_text_view.upVisibleRect()
} }
upTime() upTime()

@ -26,8 +26,10 @@ class BatteryView @JvmOverloads constructor(
batteryPaint.strokeWidth = 1.dp.toFloat() batteryPaint.strokeWidth = 1.dp.toFloat()
batteryPaint.isAntiAlias = true batteryPaint.isAntiAlias = true
batteryPaint.color = paint.color batteryPaint.color = paint.color
if (!isInEditMode) {
typeface = Typeface.createFromAsset(context.assets, "font${File.separator}number.ttf") typeface = Typeface.createFromAsset(context.assets, "font${File.separator}number.ttf")
} }
}
fun setColor(@ColorInt color: Int) { fun setColor(@ColorInt color: Int) {
setTextColor(color) setTextColor(color)

@ -225,7 +225,8 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/chapter_list" android:text="@string/chapter_list"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@ -263,7 +264,8 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/main_menu" android:text="@string/main_menu"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@ -301,7 +303,8 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/to_backstage" android:text="@string/to_backstage"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
@ -339,7 +342,8 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:text="@string/setting" android:text="@string/setting"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>

@ -148,4 +148,9 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/page_nv_bar"
android:layout_width="match_parent"
android:layout_height="0dp" />
</LinearLayout> </LinearLayout>

@ -281,7 +281,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:text="@string/chapter_list" android:text="@string/chapter_list"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
@ -321,7 +322,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:text="@string/read_aloud" android:text="@string/read_aloud"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
@ -361,7 +363,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:text="@string/interface_setting" android:text="@string/interface_setting"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />
@ -401,7 +404,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:maxLines="1" android:singleLine="true"
android:ellipsize="middle"
android:text="@string/setting" android:text="@string/setting"
android:textColor="@color/primaryText" android:textColor="@color/primaryText"
android:textSize="12sp" /> android:textSize="12sp" />

Loading…
Cancel
Save