|
|
@ -2,8 +2,6 @@ package io.legado.app.ui.book.read.page |
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
|
import android.annotation.SuppressLint |
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.graphics.Bitmap |
|
|
|
|
|
|
|
import android.graphics.drawable.Drawable |
|
|
|
|
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.widget.FrameLayout |
|
|
|
import android.widget.FrameLayout |
|
|
|
import androidx.core.view.isGone |
|
|
|
import androidx.core.view.isGone |
|
|
@ -41,7 +39,6 @@ class PageView(context: Context) : FrameLayout(context) { |
|
|
|
private var tvBookName: BatteryView? = null |
|
|
|
private var tvBookName: BatteryView? = null |
|
|
|
private var tvTimeBattery: BatteryView? = null |
|
|
|
private var tvTimeBattery: BatteryView? = null |
|
|
|
private var tvTimeBatteryP: BatteryView? = null |
|
|
|
private var tvTimeBatteryP: BatteryView? = null |
|
|
|
private var bitmap: Bitmap? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val headerHeight: Int |
|
|
|
val headerHeight: Int |
|
|
|
get() { |
|
|
|
get() { |
|
|
@ -61,13 +58,9 @@ class PageView(context: Context) : FrameLayout(context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getBitmap(): Bitmap? { |
|
|
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { |
|
|
|
return bitmap?.copy(Bitmap.Config.ARGB_8888, false) |
|
|
|
super.onSizeChanged(w, h, oldw, oldh) |
|
|
|
} |
|
|
|
upBg() |
|
|
|
|
|
|
|
|
|
|
|
private fun upBitmap() { |
|
|
|
|
|
|
|
bitmap?.recycle() |
|
|
|
|
|
|
|
bitmap = screenshot() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun upStyle() = binding.run { |
|
|
|
fun upStyle() = binding.run { |
|
|
@ -208,9 +201,9 @@ class PageView(context: Context) : FrameLayout(context) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setBg(bg: Drawable?) { |
|
|
|
fun upBg() { |
|
|
|
binding.vwRoot.backgroundColor = ReadBookConfig.bgMeanColor |
|
|
|
binding.vwRoot.backgroundColor = ReadBookConfig.bgMeanColor |
|
|
|
binding.vwBg.background = bg |
|
|
|
binding.vwBg.background = ReadBookConfig.bg |
|
|
|
upBgAlpha() |
|
|
|
upBgAlpha() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -236,7 +229,6 @@ class PageView(context: Context) : FrameLayout(context) { |
|
|
|
val time = timeFormat.format(Date(System.currentTimeMillis())) |
|
|
|
val time = timeFormat.format(Date(System.currentTimeMillis())) |
|
|
|
tvTimeBattery?.setBattery(battery, time) |
|
|
|
tvTimeBattery?.setBattery(battery, time) |
|
|
|
tvTimeBatteryP?.text = "$time $battery%" |
|
|
|
tvTimeBatteryP?.text = "$time $battery%" |
|
|
|
upBitmap() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setContent(textPage: TextPage, resetPageOffset: Boolean = true) { |
|
|
|
fun setContent(textPage: TextPage, resetPageOffset: Boolean = true) { |
|
|
@ -245,7 +237,6 @@ class PageView(context: Context) : FrameLayout(context) { |
|
|
|
resetPageOffset() |
|
|
|
resetPageOffset() |
|
|
|
} |
|
|
|
} |
|
|
|
binding.contentTextView.setContent(textPage) |
|
|
|
binding.contentTextView.setContent(textPage) |
|
|
|
upBitmap() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setContentDescription(content: String) { |
|
|
|
fun setContentDescription(content: String) { |
|
|
|