You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For longer texts it is extremely slow. The biggest slow down is on the line 167 in Justify.java file. I looked at the code, and I optimized it a lot, but with this line, I have no idea... In Android sources in method setSpan(...) is a lot of IMHO unnecessary code, but I did not find any better solution (except of rendering a whole text by myself). Is it possible to do something? Thanks
The text was updated successfully, but these errors were encountered:
First, let me acknowledge that this is indeed slow on long strings.
Getting it to be really fast would involve rewriting most of the text rendering that is done in the Layout classes. It's very unfortunate that those classes are closed.
If setSpan on SpannableString is the problem, then you can replace SpannableString with your own implementation of Spannable by setting the Spannable.Factory on the TextView with: public final void setSpannableFactory(Spannable.Factory factory).
Then you can try to optimize the setSpan method in your class, or maybe add a setSpans method to do the changes in bulk rather than settings the spans one by one.
However, in my testing, this was not the point where most of the time was spent. If you managed to optimize the code so that it becomes the main slow down, then I would appreciate if you could share your optimizations. You can do so by sending the files or via a pull request.
I will then take a look at it and see if I can help optimize it further.
For longer texts it is extremely slow. The biggest slow down is on the line 167 in Justify.java file. I looked at the code, and I optimized it a lot, but with this line, I have no idea... In Android sources in method setSpan(...) is a lot of IMHO unnecessary code, but I did not find any better solution (except of rendering a whole text by myself). Is it possible to do something? Thanks
The text was updated successfully, but these errors were encountered: