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.*
2929abstract class AbstractCodeAdapter <T > : RecyclerView .Adapter <AbstractCodeAdapter .ViewHolder > {
3030
3131 protected val context: Context
32- protected var lines: List <String > = ArrayList () // items
32+ protected var lines: List <String > = ArrayList ()
3333 protected var droppedLines: List <String >? = null
3434
3535 internal var options: Options
@@ -157,6 +157,7 @@ abstract class AbstractCodeAdapter<T> : RecyclerView.Adapter<AbstractCodeAdapter
157157 */
158158 private fun updateContent (code : String , onUpdated : () -> Unit ) {
159159 options.code = code
160+ options.isHighlighted = true
160161 prepareCodeLines()
161162 ui(onUpdated)
162163 }
@@ -227,7 +228,7 @@ abstract class AbstractCodeAdapter<T> : RecyclerView.Adapter<AbstractCodeAdapter
227228 }
228229 }
229230 tvLineContent.apply {
230- text = html( lines[pos])
231+ text = lines[pos]. let { if (options.isHighlighted) html(it) else it }
231232 textSize = fontSize
232233 setTextColor(options.theme.noteColor.color())
233234 }
@@ -333,6 +334,8 @@ data class Options(
333334 var maxLines : Int = 0 ,
334335 var lineClickListener : OnCodeLineClickListener ? = null ) {
335336
337+ internal var isHighlighted: Boolean = false
338+
336339 fun withCode (code : String ): Options {
337340 this .code = code
338341 return this
You can’t perform that action at this time.
0 commit comments