pull/1395/head
gedoor 3 years ago
parent 6d23031054
commit 7424e63557
  1. 7
      app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/BatteryView.kt

@ -8,13 +8,13 @@ import android.widget.FrameLayout
import androidx.core.view.isGone
import androidx.core.view.isInvisible
import io.legado.app.R
import io.legado.app.base.BaseActivity
import io.legado.app.constant.AppConst.timeFormat
import io.legado.app.data.entities.Bookmark
import io.legado.app.databinding.ViewBookPageBinding
import io.legado.app.help.ReadBookConfig
import io.legado.app.help.ReadTipConfig
import io.legado.app.model.ReadBook
import io.legado.app.ui.book.read.ReadBookActivity
import io.legado.app.ui.book.read.page.entities.TextPage
import io.legado.app.ui.book.read.page.provider.ChapterProvider
import io.legado.app.ui.widget.BatteryView
@ -25,7 +25,9 @@ import java.util.*
* 阅读界面
*/
class PageView(context: Context) : FrameLayout(context) {
private val binding = ViewBookPageBinding.inflate(LayoutInflater.from(context), this, true)
private val readBookActivity get() = activity as? ReadBookActivity
private var battery = 100
private var tvTitle: BatteryView? = null
private var tvTime: BatteryView? = null
@ -94,8 +96,7 @@ class PageView(context: Context) : FrameLayout(context) {
*/
fun upStatusBar() = with(binding.vwStatusBar) {
setPadding(paddingLeft, context.statusBarHeight, paddingRight, paddingBottom)
isGone =
ReadBookConfig.hideStatusBar || (activity as? BaseActivity<*>)?.isInMultiWindow == true
isGone = ReadBookConfig.hideStatusBar || readBookActivity?.isInMultiWindow == true
}
private fun upTipStyle() = binding.run {

@ -24,7 +24,7 @@ class BatteryView @JvmOverloads constructor(
var isBattery = false
set(value) {
field = value
if (value) {
if (value && !isInEditMode) {
super.setTypeface(batteryTypeface)
postInvalidate()
}

Loading…
Cancel
Save