5
5
import android .os .Build ;
6
6
import android .support .v7 .widget .AppCompatEditText ;
7
7
import android .text .Editable ;
8
+ import android .text .Layout ;
8
9
import android .text .Spanned ;
9
10
import android .text .TextWatcher ;
10
11
import android .text .style .BackgroundColorSpan ;
14
15
import android .text .style .StyleSpan ;
15
16
import android .util .AttributeSet ;
16
17
import android .util .TypedValue ;
18
+ import android .view .MotionEvent ;
17
19
import android .view .View ;
18
20
import android .view .inputmethod .EditorInfo ;
19
21
20
22
import com .chinalwb .are .android .inner .Html ;
21
23
import com .chinalwb .are .events .AREMovementMethod ;
22
24
import com .chinalwb .are .render .AreImageGetter ;
23
25
import com .chinalwb .are .render .AreTagHandler ;
26
+ import com .chinalwb .are .spans .ARE_Clickable_Span ;
27
+ import com .chinalwb .are .spans .AreImageSpan ;
24
28
import com .chinalwb .are .spans .AreSubscriptSpan ;
25
29
import com .chinalwb .are .spans .AreSuperscriptSpan ;
26
30
import com .chinalwb .are .spans .AreUnderlineSpan ;
@@ -84,7 +88,7 @@ private void initGlobalValues() {
84
88
}
85
89
86
90
private void init () {
87
- // this.setMovementMethod(new AREMovementMethod());
91
+ // this.setMovementMethod(new AREMovementMethod());
88
92
this .setFocusableInTouchMode (true );
89
93
this .setBackgroundColor (Color .WHITE );
90
94
this .setInputType (EditorInfo .TYPE_CLASS_TEXT | EditorInfo .TYPE_TEXT_FLAG_MULTI_LINE
@@ -95,6 +99,17 @@ private void init() {
95
99
this .setTextSize (TypedValue .COMPLEX_UNIT_SP , Constants .DEFAULT_FONT_SIZE );
96
100
}
97
101
102
+ @ Override
103
+ public boolean onTouchEvent (MotionEvent event ) {
104
+ int off = AREMovementMethod .getTextOffset (this , this .getEditableText (), event );
105
+ ARE_Clickable_Span [] clickableSpans = this .getText ().getSpans (off , off , ARE_Clickable_Span .class );
106
+ if (clickableSpans .length == 1 && clickableSpans [0 ] instanceof AreImageSpan ) {
107
+ return true ;
108
+ }
109
+
110
+ return super .onTouchEvent (event );
111
+ }
112
+
98
113
/**
99
114
* Sets up listeners for controls.
100
115
*/
0 commit comments