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
This commit is contained in:
parent
7a06ebffad
commit
ecd4680696
1 changed files with 12 additions and 0 deletions
|
@ -113,6 +113,18 @@ public class LinkHelper {
|
||||||
}
|
}
|
||||||
builder.removeSpan(span);
|
builder.removeSpan(span);
|
||||||
builder.setSpan(customSpan, start, end, flags);
|
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.setText(builder);
|
||||||
view.setLinksClickable(true);
|
view.setLinksClickable(true);
|
||||||
|
|
Loading…
Reference in a new issue