kunfei 4 ani în urmă
părinte
comite
05e806abfc

+ 20 - 1
app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt

@@ -28,7 +28,7 @@ import io.legado.app.utils.toastOnUi
 import kotlin.math.min
 
 /**
- * 阅读内容界面
+ * 阅读内容视图
  */
 class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
     var selectAble = context.getPrefBoolean(PreferKey.textSelectAble, true)
@@ -65,12 +65,18 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
         callBack = activity as CallBack
     }
 
+    /**
+     * 设置内容
+     */
     fun setContent(textPage: TextPage) {
         this.textPage = textPage
         imagePaint.isAntiAlias = AppConfig.useAntiAlias
         invalidate()
     }
 
+    /**
+     * 更新绘制区域
+     */
     fun upVisibleRect() {
         visibleRect.set(
             ChapterProvider.paddingLeft.toFloat(),
@@ -121,6 +127,9 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
         }
     }
 
+    /**
+     * 绘制页面
+     */
     private fun draw(
         canvas: Canvas,
         textPage: TextPage,
@@ -259,6 +268,9 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
         invalidate()
     }
 
+    /**
+     * 重置滚动位置
+     */
     fun resetPageOffset() {
         pageOffset = 0
     }
@@ -288,6 +300,9 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
      * @return true:已处理, false:未处理
      */
     fun click(x: Float, y: Float): Boolean {
+        touch(x, y) { _, relativePos, textPage, lineIndex, textLine, charIndex, textChar ->
+
+        }
         return false
     }
 
@@ -342,6 +357,10 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
         }
     }
 
+    /**
+     * 触碰位置信息
+     * @param touched 回调
+     */
     private fun touch(
         x: Float,
         y: Float,

+ 1 - 1
app/src/main/java/io/legado/app/ui/book/read/page/PageView.kt

@@ -24,7 +24,7 @@ import splitties.views.backgroundColor
 import java.util.*
 
 /**
- * 阅读界面
+ * 页面视图
  */
 class PageView(context: Context) : FrameLayout(context) {
 

+ 3 - 1
app/src/main/java/io/legado/app/ui/book/read/page/ReadView.kt

@@ -32,7 +32,9 @@ import java.text.BreakIterator
 import java.util.*
 import kotlin.math.abs
 
-
+/**
+ * 阅读视图
+ */
 class ReadView(context: Context, attrs: AttributeSet) :
     FrameLayout(context, attrs),
     DataSource {