|
1 | 1 | /* Copyright (C) 2015 evilbinary. |
2 | 2 | |
| 3 | + * Copyright 2016 Alex Zhang aka. ztc1997 |
3 | 4 | This program is free software: you can redistribute it and/or modify |
4 | 5 | it under the terms of the GNU General Public License as published by |
5 | 6 | the Free Software Foundation, either version 3 of the License, or |
|
17 | 18 | package org.evilbinary.highliter; |
18 | 19 |
|
19 | 20 | import android.content.Context; |
20 | | -import android.graphics.Canvas; |
21 | | -import android.graphics.Paint; |
22 | | -import android.graphics.Point; |
23 | | -import android.graphics.Rect; |
24 | | -import android.graphics.Typeface; |
| 21 | +import android.graphics.*; |
25 | 22 | import android.text.SpannableStringBuilder; |
26 | 23 | import android.text.Spanned; |
27 | | -import android.text.method.ScrollingMovementMethod; |
28 | 24 | import android.text.style.CharacterStyle; |
29 | 25 | import android.view.GestureDetector; |
30 | 26 | import android.view.GestureDetector.OnGestureListener; |
31 | 27 | import android.view.MotionEvent; |
32 | 28 | import android.view.inputmethod.InputMethodManager; |
33 | 29 | import android.widget.EditText; |
34 | 30 | import android.widget.Scroller; |
35 | | - |
36 | 31 | import org.evilbinary.highliter.parsers.MyTagToSpannedConverter; |
37 | 32 | import org.evilbinary.highliter.parsers.SyntaxHighlight; |
38 | 33 | import org.evilbinary.managers.Configure; |
@@ -91,6 +86,9 @@ public class HighlightEditText extends EditText implements OnGestureListener { |
91 | 86 |
|
92 | 87 | public HighlightEditText(Context context, Configure conf) { |
93 | 88 | super(context); |
| 89 | + |
| 90 | + setTextIsSelectable(true); |
| 91 | + |
94 | 92 | mConfigure = conf; |
95 | 93 |
|
96 | 94 | mPaintNumbers = new Paint(); |
@@ -276,7 +274,7 @@ private void updateSettings() { |
276 | 274 | // wordwrap |
277 | 275 | setHorizontallyScrolling(!mConfigure.mSettings.WORDWRAP); |
278 | 276 | if (!mConfigure.mSettings.WORDWRAP)// 卡顿问题 |
279 | | - setMovementMethod(ScrollingMovementMethod.getInstance()); |
| 277 | + setMovementMethod(SelectableScrollingMovementMethod.getInstance()); |
280 | 278 |
|
281 | 279 | // setTextColor(Color.BLACK); |
282 | 280 | mPaintHighlight.setColor(mConfigure.mLineHighlightColor); |
|
0 commit comments