Permalink
Browse files

Added ability to read text normally only visible by hovering over ima…

…ges.
  • Loading branch information...
1 parent eeed9f2 commit a0dcd974a8c3be8e1fc620d7ff2f84193b8b7193 @eyecreate committed Aug 21, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/com/andrewshu/android/reddit/comments/DownloadCommentsTask.java
View
15 src/com/andrewshu/android/reddit/comments/DownloadCommentsTask.java
@@ -507,7 +507,20 @@ private void addJumpTargetContext(ThingInfo comment) {
private void processCommentSlowSteps(ThingInfo comment) {
if (comment.getBody_html() != null) {
- CharSequence spanned = createSpanned(comment.getBody_html());
+ //get title and put in body since images aren't shown
+ String useMeForSpan = comment.getBody_html();
+ if(useMeForSpan.contains("title=")) {
+ String[] splitHTML = useMeForSpan.split("title=");
+ for (int i =0; i<splitHTML.length;i++){
+ if(i>0){
@talklittle
talklittle Aug 22, 2011

instead of having the if condition inside, could just say "for (int i = 1; ...)"

@eyecreate
eyecreate Aug 22, 2011

Good one, I missed that.

+ String[] tags=splitHTML[i].split("&gt;");
+ tags[2]="["+splitHTML[i].split("\"")[1]+"]"+tags[2];
+ splitHTML[i]=join(tags,"&gt;");
+ }
+ }
+ useMeForSpan=join(splitHTML,"title=");
+ }
+ CharSequence spanned = createSpanned(useMeForSpan);
comment.setSpannedBody(spanned);
}
markdown.getURLs(comment.getBody(), comment.getUrls());

2 comments on commit a0dcd97

@talklittle

The splitting code is okay but a regex might be cleaner, and tighter code.
If we keep the code using split, we should probably extract to a separate method, called from inside processCommentSlowSteps.

@eyecreate
Owner

I'm not sure how I'd approach the rexexp to correctly mirror what the splitting is doing. I can move the splitting to it's own method.

Please sign in to comment.