|
1 | 1 | /* |
2 | | - * Copyright (c) 2023, the hapjs-platform Project Contributors |
| 2 | + * Copyright (c) 2023-present, the hapjs-platform Project Contributors |
3 | 3 | * SPDX-License-Identifier: Apache-2.0 |
4 | 4 | */ |
5 | 5 | package org.hapjs.widgets.view.readerdiv; |
@@ -231,7 +231,26 @@ protected void onDraw(Canvas canvas) { |
231 | 231 | mLineY += getLineHeight(); |
232 | 232 | } |
233 | 233 | if (hasDrawCount > 0 && mPageData.size() > 0 |
234 | | - && hasDrawCount < (mPageData.size() - 1)) { |
| 234 | + && hasDrawCount < mPageData.size()) { |
| 235 | + for (int i = hasDrawCount; i < mPageData.size(); i++) { |
| 236 | + String pageLineStr = mPageData.get(i); |
| 237 | + if (!TextUtils.isEmpty(pageLineStr)) { |
| 238 | + canvas.save(); |
| 239 | + canvas.clipRect(new RectF(0, mLineY, getWidth(), mLineY + mLineHeight)); |
| 240 | + canvas.drawColor(mBgColor); |
| 241 | + canvas.drawText(pageLineStr, 0, mLineY + mTextSize, paint); |
| 242 | + canvas.restore(); |
| 243 | + } |
| 244 | + //背景色 |
| 245 | + if (!TextUtils.isEmpty(pageLineStr) && mIsLineBgInvalid && i >= mStartLine && i < mEndLine) { |
| 246 | + canvas.save(); |
| 247 | + canvas.clipRect(new RectF(0, mLineY, getWidth(), mLineY + mLineHeight)); |
| 248 | + canvas.drawColor(mLineBgColor); |
| 249 | + canvas.drawText(pageLineStr, 0, mLineY + mTextSize, paint); |
| 250 | + canvas.restore(); |
| 251 | + } |
| 252 | + mLineY += getLineHeight(); |
| 253 | + } |
235 | 254 | Log.w(TAG, ReaderLayoutView.READER_LOG_TAG + "onDraw error hasDrawCount : " + hasDrawCount |
236 | 255 | + " mPageData.size() : " + mPageData.size() |
237 | 256 | + " Layout count : " + (null != layout ? layout.getLineCount() : "null layout")); |
|
0 commit comments