|
@@ -3,7 +3,7 @@ package com.kdanmobile.reader.screen.model
|
|
|
import android.graphics.RectF
|
|
|
import com.kdanmobile.kmpdfkit.pdfcommon.TextWord
|
|
|
|
|
|
-class SearchResultInfo(var page: Int, var search: String, var rf: RectF, lines: Array<TextWord>) {
|
|
|
+class SearchResultInfo(var page: Int, var keyword: String, var rect: RectF, lines: Array<TextWord>) {
|
|
|
var result: String = ""
|
|
|
|
|
|
init {
|
|
@@ -13,17 +13,17 @@ class SearchResultInfo(var page: Int, var search: String, var rf: RectF, lines:
|
|
|
|
|
|
val sb = StringBuilder()
|
|
|
var src = result.toLowerCase()
|
|
|
- val seh = search.toLowerCase()
|
|
|
- var index = src.indexOf(seh)
|
|
|
+ val key = keyword.toLowerCase()
|
|
|
+ var index = src.indexOf(key)
|
|
|
while (index >= 0) {
|
|
|
sb.append(src.subSequence(0, index))
|
|
|
sb.append("<font color=\"#ff0000\">")
|
|
|
result = result.substring(index)
|
|
|
- sb.append(result.substring(0, search.length))
|
|
|
+ sb.append(result.substring(0, keyword.length))
|
|
|
sb.append("</font>")
|
|
|
- result = result.substring(search.length)
|
|
|
- src = src.substring(index + search.length)
|
|
|
- index = src.indexOf(seh)
|
|
|
+ result = result.substring(keyword.length)
|
|
|
+ src = src.substring(index + keyword.length)
|
|
|
+ index = src.indexOf(key)
|
|
|
}
|
|
|
|
|
|
sb.append(result)
|