mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
5ac5f8d60b
commit
e213de75a1
@ -96,7 +96,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||||
super.onSizeChanged(w, h, oldw, oldh)
|
super.onSizeChanged(w, h, oldw, oldh)
|
||||||
if (!isMainView) return
|
if (!isMainView) return
|
||||||
ChapterProvider.upViewSize(w, h, oldw, oldh)
|
ChapterProvider.upViewSize(w, h)
|
||||||
upVisibleRect()
|
upVisibleRect()
|
||||||
textPage.format()
|
textPage.format()
|
||||||
}
|
}
|
||||||
@ -106,6 +106,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
if (longScreenshot) {
|
if (longScreenshot) {
|
||||||
canvas.translate(0f, scrollY.toFloat())
|
canvas.translate(0f, scrollY.toFloat())
|
||||||
}
|
}
|
||||||
|
check(!visibleRect.isEmpty) { "visibleRect 为空" }
|
||||||
canvas.clipRect(visibleRect)
|
canvas.clipRect(visibleRect)
|
||||||
if (!callBack.isScroll && !isNoAnim) {
|
if (!callBack.isScroll && !isNoAnim) {
|
||||||
pictureMirror.draw(canvas, width, height) {
|
pictureMirror.draw(canvas, width, height) {
|
||||||
|
@ -869,16 +869,14 @@ object ChapterProvider {
|
|||||||
/**
|
/**
|
||||||
* 更新View尺寸
|
* 更新View尺寸
|
||||||
*/
|
*/
|
||||||
fun upViewSize(width: Int, height: Int, oldWidth: Int, oldHeight: Int) {
|
fun upViewSize(width: Int, height: Int) {
|
||||||
if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
|
if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
|
||||||
viewWidth = width
|
viewWidth = width
|
||||||
viewHeight = height
|
viewHeight = height
|
||||||
upLayout()
|
upLayout()
|
||||||
if (oldWidth > 0 && oldHeight > 0) {
|
|
||||||
postEvent(EventBus.UP_CONFIG, true)
|
postEvent(EventBus.UP_CONFIG, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新绘制尺寸
|
* 更新绘制尺寸
|
||||||
|
Loading…
Reference in New Issue
Block a user