Fix #583
This commit is contained in:
parent
ae6ce0f9b0
commit
148b8e9369
|
@ -105,10 +105,11 @@ public class ClickableLinksDelegate implements CustomViewHelper{
|
||||||
int lstart=l.getLineForOffset(start);
|
int lstart=l.getLineForOffset(start);
|
||||||
int lend=l.getLineForOffset(end);
|
int lend=l.getLineForOffset(end);
|
||||||
if(line>=lstart && line<=lend){
|
if(line>=lstart && line<=lend){
|
||||||
if(line==lstart && event.getX()-view.getPaddingLeft()<l.getPrimaryHorizontal(start)){
|
boolean isRTL=l.getParagraphDirection(line)==-1;
|
||||||
|
if(line==lstart && ((!isRTL && event.getX()-view.getPaddingLeft()<l.getPrimaryHorizontal(start)) || (isRTL && event.getX()-view.getPaddingLeft()>l.getPrimaryHorizontal(start)))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(line==lend && event.getX()-view.getPaddingLeft()>l.getPrimaryHorizontal(end)){
|
if(line==lend && ((!isRTL && event.getX()-view.getPaddingLeft()>l.getPrimaryHorizontal(end)) || (isRTL && event.getX()-view.getPaddingLeft()<l.getPrimaryHorizontal(end)))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hlPath=new Path();
|
hlPath=new Path();
|
||||||
|
@ -118,12 +119,21 @@ public class ClickableLinksDelegate implements CustomViewHelper{
|
||||||
for(int j=lstart;j<=lend;j++){
|
for(int j=lstart;j<=lend;j++){
|
||||||
Rect bounds=new Rect();
|
Rect bounds=new Rect();
|
||||||
l.getLineBounds(j, bounds);
|
l.getLineBounds(j, bounds);
|
||||||
|
isRTL=l.getParagraphDirection(line)==-1;
|
||||||
//bounds.left+=view.getPaddingLeft();
|
//bounds.left+=view.getPaddingLeft();
|
||||||
if(j==lstart){
|
if(j==lstart){
|
||||||
bounds.left=Math.round(l.getPrimaryHorizontal(start));
|
int startOffset=Math.round(l.getPrimaryHorizontal(start));
|
||||||
|
if(isRTL)
|
||||||
|
bounds.right=startOffset;
|
||||||
|
else
|
||||||
|
bounds.left=startOffset;
|
||||||
}
|
}
|
||||||
if(j==lend){
|
if(j==lend){
|
||||||
bounds.right=Math.round(l.getPrimaryHorizontal(end));
|
int endOffset=Math.round(l.getPrimaryHorizontal(end));
|
||||||
|
if(isRTL)
|
||||||
|
bounds.left=endOffset;
|
||||||
|
else
|
||||||
|
bounds.right=endOffset;
|
||||||
}else{
|
}else{
|
||||||
CharSequence lineChars=view.getText().subSequence(l.getLineStart(j), l.getLineEnd(j));
|
CharSequence lineChars=view.getText().subSequence(l.getLineStart(j), l.getLineEnd(j));
|
||||||
bounds.right=Math.round(view.getPaint().measureText(lineChars.toString()))/*+view.getPaddingRight()*/;
|
bounds.right=Math.round(view.getPaint().measureText(lineChars.toString()))/*+view.getPaddingRight()*/;
|
||||||
|
|
Loading…
Reference in New Issue