feat: 优化代码

pull/141/head
kunfei 5 years ago
parent 40e4c7acb3
commit 25d16ffa0d
  1. 7
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt

@ -18,6 +18,8 @@ import java.util.*
class ContentView(context: Context) : FrameLayout(context) { class ContentView(context: Context) : FrameLayout(context) {
private var battery = 100
init { init {
//设置背景防止切换背景时文字重叠 //设置背景防止切换背景时文字重叠
setBackgroundColor(context.getCompatColor(R.color.background)) setBackgroundColor(context.getCompatColor(R.color.background))
@ -67,6 +69,10 @@ class ContentView(context: Context) : FrameLayout(context) {
tv_bottom_left.setTextColor(it) tv_bottom_left.setTextColor(it)
tv_bottom_right.setTextColor(it) tv_bottom_right.setTextColor(it)
} }
if (hideStatusBar) {
tv_bottom_left.text = timeFormat.format(Date(System.currentTimeMillis()))
tv_bottom_right.text = context.getString(R.string.battery_show, battery)
}
} }
} }
@ -90,6 +96,7 @@ class ContentView(context: Context) : FrameLayout(context) {
} }
fun upBattery(battery: Int) { fun upBattery(battery: Int) {
this.battery = battery
if (ReadBookConfig.hideStatusBar) { if (ReadBookConfig.hideStatusBar) {
tv_bottom_right.text = context.getString(R.string.battery_show, battery) tv_bottom_right.text = context.getString(R.string.battery_show, battery)
} }

Loading…
Cancel
Save