File tree 1 file changed +10
-9
lines changed
flowtextview/src/main/java/uk/co/deanwild/flowtextview/helpers
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -40,19 +40,18 @@ public boolean onTouch(View view, MotionEvent event) {
40
40
distance = getPointDistance (x1 , y1 , x2 , y2 );
41
41
}
42
42
43
- if (distance < 10 ){
44
-
45
- if ( event_code == MotionEvent . ACTION_UP ){
46
- onClick (event .getX (), event .getY ());
43
+ if (distance < 10 ) { // my random guess at an acceptable drift distance to regard this as a click
44
+ if ( event_code == MotionEvent . ACTION_UP ) {
45
+ // if the event is an "up" and we havn't moved far since the "down", then it's a click
46
+ return onClick (event .getX (), event .getY ()); // process the click and say whether we consumed it
47
47
}
48
-
49
48
return true ;
50
- }else {
51
- return false ;
52
49
}
50
+
51
+ return false ;
53
52
}
54
53
55
- private void onClick (float x , float y ){
54
+ private boolean onClick (float x , float y ){
56
55
57
56
ArrayList <HtmlLink > links = mSpanParser .getLinks ();
58
57
@@ -66,10 +65,12 @@ private void onClick(float x, float y){
66
65
if (y > tlY && y < brY ){
67
66
// collision
68
67
onLinkClick (link .url );
69
- return ;
68
+ return true ; // the click was consumed
70
69
}
71
70
}
72
71
}
72
+
73
+ return false ;
73
74
}
74
75
75
76
private void onLinkClick (String url ){
You can’t perform that action at this time.
0 commit comments