fix link's too large hitbox (#916)

* fix link's too large hitbox (tuskyapp#846)

* Use zero width space instead of normal space.

* Add comment.

* Remove unnecessary Html.fromHtml
main
kyori19 6 years ago committed by Konrad Pozniak
parent e09c691286
commit d66858abe7
  1. 12
      app/src/main/java/com/keylesspalace/tusky/util/LinkHelper.java

@ -113,6 +113,18 @@ public class LinkHelper {
}
builder.removeSpan(span);
builder.setSpan(customSpan, start, end, flags);
/* Add zero-width space after links in end of line to fix its too large hitbox.
* See also : https://github.com/tuskyapp/Tusky/issues/846
* https://github.com/tuskyapp/Tusky/pull/916 */
if(end >= builder.length()){
builder.insert(end, "\u200B");
} else {
if(builder.subSequence(end, end + 1).toString().equals("\n")){
builder.insert(end, "\u200B");
}
}
}
view.setText(builder);
view.setLinksClickable(true);

Loading…
Cancel
Save