|
|
|
|
|
by fngjdflmdflg
699 days ago
|
|
Yes, the Android SDK has to be one of the worst software packages to ever have been written. Just look at the sourcecode for TextView[0] if you want to see for yourself. 8,700 lines of code to show text on the screen? Well actually, TextView is actually a full blown text editor with the editing functionality turned off as a flag. EditText just wraps TextView and sets the `ediable` field to true. What genius software design! Ever wonder how those selection handles appear when you long press on text in a TextView? I wonder what component that is? Trick question – its built right in to TextView as well! It uses a popup window the displays the handles in global coordinates which it gets using a mixture of `getLocationInWindow` and `getLocationOnScreen`.[1] Another stroke of genius form the Android SDK! Want to change any of this functionality slightly? Now you have to make your own TextView starting from StaticLayout. [0] https://android.googlesource.com/platform/frameworks/base/+/... [1] https://cs.android.com/android/platform/superproject/main/+/... |
|
The fact your [1] link is a class that's not even used in the TextView class isn't lost on me to start. They share an interface though, scary!1!!
The fact your [0] link is to a copy of the TextView from 2017 is even funnier.
> Just look at the sourcecode for TextView[0] if you want to see for yourself. 8,700 lines of code to show text on the screen? Well actually, TextView is actually a full blown text editor with the editing functionality turned off as a flag.
Hmm yes, 8,700 lines to "just show text". No hyperbole detected there. Who cares about fonts, shadows, or any other visuals on or around the text, all we're showing is "just text".
> Well actually, TextView is actually a full blown text editor with the editing functionality turned off as a flag.
And? It's called code de-duplication. While realistically I think the better approach would have been to have TextEdit be the barebones display only and Editor add the editing functionality, sometimes code is so tightly coupled for reasons that you can't do that easily. This approach is much better than hitting cmd+c/cmd+v and copying the code into a new class.
The funniest part to me is that your rant is about TextViews though. When that's been soft deprecated for 5 years already (replaced by Compose Text element).