glebpopoff / Hacker-News-Droid-App

Hacker News Android App Full Source
https://market.android.com/details?id=com.glebpopov.hackernews
35 stars 9 forks source link

Preformatted text in comments is a mess #10

Open suan opened 12 years ago

suan commented 12 years ago

Whenever there are preformatted blocks in comments (especially code snippets), its an unreadable mess. My idea is to put in a special tag when a <pre> or <code> tag is detected (like what you do with __BR__) on the API side, and use a monospaced font on the app side.

This doesn't solve the issue of the code block wrapping due to the small width on phones though. To address that one thing that could be done is to embed a simple scrollview with the code block in it when the app displays that comment. Might be hard to ensure that the rest of the comment fits the screen width though...

Another idea would be to have the preformatted text "disappear" off the side of the screen, and if you tap it a scrollview would appear where you can view it properly.

There was an article today thats a good example of why this is needed =) http://news.ycombinator.com/item?id=3625710 (titled "what's wrong with the for loop")

glebpopoff commented 12 years ago

I was thinking about reverting back to HTML approach..it didn't work out initially that's why I was doing weird stuff with like BR characters. The easiest way would be to have API return HTML and on the app side we just Html.fromHtml when setting TextView value

suan commented 12 years ago

Sounds like a good idea. The API is so depdendent on the formatting of the Hacker News HTML anyways, and it seems the other APIs out there just pass along the HTML as well.