Java Code Examples for android.text.Spannable#SPAN_MARK_MARK

The following examples show how to use android.text.Spannable#SPAN_MARK_MARK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyHtmlTagHandler.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
private Object getLast(Editable text, Class kind) {
    Object[] objs = text.getSpans(0, text.length(), kind);

    if (objs.length == 0) {
        return null;
    } else {
        for(int i = objs.length;i>0;i--) {
            if(text.getSpanFlags(objs[i-1]) == Spannable.SPAN_MARK_MARK) {
                return objs[i-1];
            }
        }
        return null;
    }
}
 
Example 2
Source File: HTMLCodeTagHandler.java    From Hews with MIT License 5 votes vote down vote up
private Object getLast(Editable text, Class kind) {
    Object[] objs = text.getSpans(0, text.length(), kind);
    if (objs.length == 0) {
        return null;
    } else {
        for (int i = objs.length; i > 0; i--) {
            if (text.getSpanFlags(objs[i - 1]) == Spannable.SPAN_MARK_MARK) {
                return objs[i - 1];
            }
        }
        return null;
    }
}
 
Example 3
Source File: KnifeTagHandler.java    From Knife with Apache License 2.0 5 votes vote down vote up
private static Object getLast(Editable text, Class kind) {
    Object[] spans = text.getSpans(0, text.length(), kind);

    if (spans.length == 0) {
        return null;
    } else {
        for (int i = spans.length; i > 0; i--) {
            if (text.getSpanFlags(spans[i - 1]) == Spannable.SPAN_MARK_MARK) {
                return spans[i - 1];
            }
        }

        return null;
    }
}
 
Example 4
Source File: HiHtmlTagHandler.java    From hipda with GNU General Public License v2.0 5 votes vote down vote up
private Object getLast(Editable text, Class kind) {
    Object[] objs = text.getSpans(0, text.length(), kind);

    if (objs.length == 0) {
        return null;
    } else {
        for (int i = objs.length; i > 0; i--) {
            if (text.getSpanFlags(objs[i - 1]) == Spannable.SPAN_MARK_MARK) {
                return objs[i - 1];
            }
        }
        return null;
    }
}
 
Example 5
Source File: FractionActivity.java    From advanced-textview with Apache License 2.0 5 votes vote down vote up
private Object getLast(Editable text, Class kind) {
  Object[] objs = text.getSpans(0, text.length(), kind);

  if (objs.length == 0) {
    return null;
  } else {
    for (int i = objs.length - 1; i >= 0; --i) {
      if(text.getSpanFlags(objs[i]) == Spannable.SPAN_MARK_MARK) {
        return objs[i];
      }
    }
    return null;
  }
}
 
Example 6
Source File: HtmlTagHandler.java    From v2ex with Apache License 2.0 5 votes vote down vote up
/**
 * Get last marked position of a specific tag kind (private class)
 *
 * @param text
 * @param kind
 * @return
 */
private Object getLast(Editable text, Class kind) {
    Object[] objs = text.getSpans(0, text.length(), kind);
    if (objs.length == 0) {
        return null;
    } else {
        for (int i = objs.length; i > 0; i--) {
            if (text.getSpanFlags(objs[i - 1]) == Spannable.SPAN_MARK_MARK) {
                return objs[i - 1];
            }
        }
        return null;
    }
}
 
Example 7
Source File: HtmlTagHandler.java    From html-textview with Apache License 2.0 5 votes vote down vote up
/**
 * Get last marked position of a specific tag kind (private class)
 */
private static Object getLast(Editable text, Class kind) {
    Object[] objs = text.getSpans(0, text.length(), kind);
    if (objs.length == 0) {
        return null;
    } else {
        for (int i = objs.length; i > 0; i--) {
            if (text.getSpanFlags(objs[i - 1]) == Spannable.SPAN_MARK_MARK) {
                return objs[i - 1];
            }
        }
        return null;
    }
}