File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
codeview/src/main/java/io/github/kbiakov/codeview/adapters Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import java.util.*
29
29
abstract class AbstractCodeAdapter <T > : RecyclerView .Adapter <AbstractCodeAdapter .ViewHolder > {
30
30
31
31
protected val context: Context
32
- protected var lines: List <String > = ArrayList () // items
32
+ protected var lines: List <String > = ArrayList ()
33
33
protected var droppedLines: List <String >? = null
34
34
35
35
internal var options: Options
@@ -157,6 +157,7 @@ abstract class AbstractCodeAdapter<T> : RecyclerView.Adapter<AbstractCodeAdapter
157
157
*/
158
158
private fun updateContent (code : String , onUpdated : () -> Unit ) {
159
159
options.code = code
160
+ options.isHighlighted = true
160
161
prepareCodeLines()
161
162
ui(onUpdated)
162
163
}
@@ -227,7 +228,7 @@ abstract class AbstractCodeAdapter<T> : RecyclerView.Adapter<AbstractCodeAdapter
227
228
}
228
229
}
229
230
tvLineContent.apply {
230
- text = html( lines[pos])
231
+ text = lines[pos]. let { if (options.isHighlighted) html(it) else it }
231
232
textSize = fontSize
232
233
setTextColor(options.theme.noteColor.color())
233
234
}
@@ -333,6 +334,8 @@ data class Options(
333
334
var maxLines : Int = 0 ,
334
335
var lineClickListener : OnCodeLineClickListener ? = null ) {
335
336
337
+ internal var isHighlighted: Boolean = false
338
+
336
339
fun withCode (code : String ): Options {
337
340
this .code = code
338
341
return this
You can’t perform that action at this time.
0 commit comments