Java Code Examples for android.text.Spanned#SPAN_POINT_MARK_MASK

The following examples show how to use android.text.Spanned#SPAN_POINT_MARK_MASK . 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: BaseInputConnection.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/** @hide */
public static void setComposingSpans(Spannable text, int start, int end) {
    final Object[] sps = text.getSpans(start, end, Object.class);
    if (sps != null) {
        for (int i=sps.length-1; i>=0; i--) {
            final Object o = sps[i];
            if (o == COMPOSING) {
                text.removeSpan(o);
                continue;
            }

            final int fl = text.getSpanFlags(o);
            if ((fl & (Spanned.SPAN_COMPOSING | Spanned.SPAN_POINT_MARK_MASK))
                    != (Spanned.SPAN_COMPOSING | Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)) {
                text.setSpan(o, text.getSpanStart(o), text.getSpanEnd(o),
                        (fl & ~Spanned.SPAN_POINT_MARK_MASK)
                                | Spanned.SPAN_COMPOSING
                                | Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
        }
    }

    text.setSpan(COMPOSING, start, end,
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
}
 
Example 2
Source File: SpannableStringHelper.java    From revolution-irc with GNU General Public License v3.0 5 votes vote down vote up
public static boolean checkSpanInclude(int spanStart, int spanEnd, int spanFlags, int start, int end) {
    int pointFlags = spanFlags & Spanned.SPAN_POINT_MARK_MASK;
    boolean includesStart = pointFlags == Spanned.SPAN_INCLUSIVE_EXCLUSIVE ||
            pointFlags == Spanned.SPAN_INCLUSIVE_INCLUSIVE;
    boolean includesEnd = pointFlags == Spanned.SPAN_EXCLUSIVE_INCLUSIVE ||
            pointFlags == Spanned.SPAN_INCLUSIVE_INCLUSIVE;
    return (start > spanStart || (spanStart == start && includesStart)) &&
            (end < spanEnd || (spanEnd == end && includesEnd));
}
 
Example 3
Source File: LocaleSpanCompatUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
private static int getSpanFlag(final int originalFlag,
        final boolean isStartExclusive, final boolean isEndExclusive) {
    return (originalFlag & ~Spanned.SPAN_POINT_MARK_MASK) |
            getSpanPointMarkFlag(isStartExclusive, isEndExclusive);
}
 
Example 4
Source File: LocaleSpanCompatUtils.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
private static int getSpanFlag(final int originalFlag,
        final boolean isStartExclusive, final boolean isEndExclusive) {
    return (originalFlag & ~Spanned.SPAN_POINT_MARK_MASK) |
            getSpanPointMarkFlag(isStartExclusive, isEndExclusive);
}