markusressel / KodeHighlighter

Simple, extendable code highlighting for Spannables on Android.
MIT License
18 stars 3 forks source link

Generic StyleFactory to support span style for compose compatibility #23

Closed folab33 closed 2 years ago

markusressel commented 2 years ago

Hey @folab33 ! :nerd_face: Looks like you put a lot of effort into this one :astonished: Before I take a deep dive into the code, could you give me a short description of what you did? :thinking:

folab33 commented 2 years ago

Hey @folab33 ! 🤓 Looks like you put a lot of effort into this one 😲 Before I take a deep dive into the code, could you give me a short description of what you did? 🤔

Jetpack compose doesn't work with SpannedString but with AnnotatedString. I made StyleFactory generic for it to work with other style like SpanStyle which will be use to produce annotated string in compose.

markusressel commented 2 years ago

Dies this still work with SpannedString though? Or is it compose only?

folab33 commented 2 years ago

It works with both SpannedString and compose. I modified SpannableHighlighter to make it work with the existing implementation and I added a new class AnnotatedStringHighlighter to produces annotated string that can be used in compose.

markusressel commented 2 years ago

I will have to make some tests on my device before merging, but looks good :+1: Thx!