|
|
@ -10,21 +10,21 @@ class ContentTextView : AppCompatTextView { |
|
|
|
|
|
|
|
|
|
|
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) |
|
|
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) |
|
|
|
|
|
|
|
|
|
|
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) |
|
|
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) |
|
|
|
|
|
|
|
: super(context, attrs, defStyleAttr) |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前页总字数 |
|
|
|
* 获取当前页总字数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun getCharNum(): Int { |
|
|
|
fun getCharNum(): Int { |
|
|
|
return layout.getLineEnd(getLineNum()) |
|
|
|
return layout?.getLineEnd(getLineNum()) ?: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前页总行数 |
|
|
|
* 获取当前页总行数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
fun getLineNum(): Int { |
|
|
|
fun getLineNum(): Int { |
|
|
|
val layout = layout |
|
|
|
|
|
|
|
val topOfLastLine = height - paddingTop - paddingBottom - lineHeight |
|
|
|
val topOfLastLine = height - paddingTop - paddingBottom - lineHeight |
|
|
|
return layout.getLineForVertical(topOfLastLine) |
|
|
|
return layout?.getLineForVertical(topOfLastLine) ?: 0 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|