Lines Matching refs:text

17 package android.text;
35 public static final int getSelectionStart(CharSequence text) {
36 if (text instanceof Spanned)
37 return ((Spanned) text).getSpanStart(SELECTION_START);
46 public static final int getSelectionEnd(CharSequence text) {
47 if (text instanceof Spanned)
48 return ((Spanned) text).getSpanStart(SELECTION_END);
65 public static void setSelection(Spannable text, int start, int stop) {
66 // int len = text.length();
70 int ostart = getSelectionStart(text);
71 int oend = getSelectionEnd(text);
74 text.setSpan(SELECTION_START, start, start,
76 text.setSpan(SELECTION_END, stop, stop,
84 public static final void setSelection(Spannable text, int index) {
85 setSelection(text, index, index);
89 * Select the entire text.
91 public static final void selectAll(Spannable text) {
92 setSelection(text, 0, text.length());
98 public static final void extendSelection(Spannable text, int index) {
99 if (text.getSpanStart(SELECTION_END) != index)
100 text.setSpan(SELECTION_END, index, index, Spanned.SPAN_POINT_POINT);
104 * Remove the selection or cursor, if any, from the text.
106 public static final void removeSelection(Spannable text) {
107 text.removeSpan(SELECTION_START);
108 text.removeSpan(SELECTION_END);
119 public static boolean moveUp(Spannable text, Layout layout) {
120 int start = getSelectionStart(text);
121 int end = getSelectionEnd(text);
127 setSelection(text, min);
129 if (min == 0 && max == text.length()) {
148 setSelection(text, move);
160 public static boolean moveDown(Spannable text, Layout layout) {
161 int start = getSelectionStart(text);
162 int end = getSelectionEnd(text);
168 setSelection(text, max);
170 if (min == 0 && max == text.length()) {
189 setSelection(text, move);
202 public static boolean moveLeft(Spannable text, Layout layout) {
203 int start = getSelectionStart(text);
204 int end = getSelectionEnd(text);
207 setSelection(text, chooseHorizontal(layout, -1, start, end));
213 setSelection(text, to);
227 public static boolean moveRight(Spannable text, Layout layout) {
228 int start = getSelectionStart(text);
229 int end = getSelectionEnd(text);
232 setSelection(text, chooseHorizontal(layout, 1, start, end));
238 setSelection(text, to);
250 public static boolean extendUp(Spannable text, Layout layout) {
251 int end = getSelectionEnd(text);
265 extendSelection(text, move);
268 extendSelection(text, 0);
279 public static boolean extendDown(Spannable text, Layout layout) {
280 int end = getSelectionEnd(text);
294 extendSelection(text, move);
296 } else if (end != text.length()) {
297 extendSelection(text, text.length());
308 public static boolean extendLeft(Spannable text, Layout layout) {
309 int end = getSelectionEnd(text);
313 extendSelection(text, to);
324 public static boolean extendRight(Spannable text, Layout layout) {
325 int end = getSelectionEnd(text);
329 extendSelection(text, to);
336 public static boolean extendToLeftEdge(Spannable text, Layout layout) {
337 int where = findEdge(text, layout, -1);
338 extendSelection(text, where);
342 public static boolean extendToRightEdge(Spannable text, Layout layout) {
343 int where = findEdge(text, layout, 1);
344 extendSelection(text, where);
348 public static boolean moveToLeftEdge(Spannable text, Layout layout) {
349 int where = findEdge(text, layout, -1);
350 setSelection(text, where);
354 public static boolean moveToRightEdge(Spannable text, Layout layout) {
355 int where = findEdge(text, layout, 1);
356 setSelection(text, where);
360 private static int findEdge(Spannable text, Layout layout, int dir) {
361 int pt = getSelectionEnd(text);
405 // depends upon the directionality of the text