本文整理汇总了Java中android.text.Editable.getSpanFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Editable.getSpanFlags方法的具体用法?Java Editable.getSpanFlags怎么用?Java Editable.getSpanFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.Editable
的用法示例。
在下文中一共展示了Editable.getSpanFlags方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOpeningAnnotation
import android.text.Editable; //导入方法依赖的package包/类
/**
* Fetch the matching opening Annotation object and verify that it's the one added by QMail.
* @param output Spannable string we're working with.
* @return Starting Annotation object.
*/
private Object getOpeningAnnotation(Editable output) {
Object[] objs = output.getSpans(0, output.length(), Annotation.class);
for (int i = objs.length - 1; i >= 0; i--) {
Annotation span = (Annotation) objs[i];
if (output.getSpanFlags(objs[i]) == Spannable.SPAN_MARK_MARK
&& span.getKey().equals(IGNORED_ANNOTATION_KEY)
&& span.getValue().equals(IGNORED_ANNOTATION_VALUE)) {
return objs[i];
}
}
return null;
}
示例2: getLast
import android.text.Editable; //导入方法依赖的package包/类
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;
}
}
示例3: getLast
import android.text.Editable; //导入方法依赖的package包/类
/**
* 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;
}
}
示例4: updateFormattingAtCursor
import android.text.Editable; //导入方法依赖的package包/类
public void updateFormattingAtCursor() {
if (mEditText == null)
return;
Editable text = mEditText.getText();
int start = mEditText.getSelectionStart();
int end = mEditText.getSelectionEnd();
Object[] spans = text.getSpans(start, end, Object.class);
mBoldButton.setSelected(false);
mItalicButton.setSelected(false);
mUnderlineButton.setSelected(false);
int fgColor = -1;
int bgColor = -1;
for (Object span : spans) {
if (!SpannableStringHelper.checkSpanInclude(text, span, start, end) ||
(text.getSpanFlags(span) & Spanned.SPAN_COMPOSING) != 0)
continue;
if (span instanceof StyleSpan) {
int style = ((StyleSpan) span).getStyle();
if (style == Typeface.BOLD)
mBoldButton.setSelected(true);
else if (style == Typeface.ITALIC)
mItalicButton.setSelected(true);
} else if (span instanceof UnderlineSpan) {
mUnderlineButton.setSelected(true);
} else if (span instanceof ForegroundColorSpan) {
fgColor = ((ForegroundColorSpan) span).getForegroundColor();
} else if (span instanceof BackgroundColorSpan) {
bgColor = ((BackgroundColorSpan) span).getBackgroundColor();
}
}
ImageViewCompat.setImageTintList(mTextColorValue, fgColor != -1
? ColorStateList.valueOf(fgColor) : mTextColorValueDefault);
ImageViewCompat.setImageTintList(mFillColorValue, bgColor != -1
? ColorStateList.valueOf(bgColor) : mFillColorValueDefault);
}
示例5: hasCompositionString
import android.text.Editable; //导入方法依赖的package包/类
private static boolean hasCompositionString(Editable content) {
Object[] spans = content.getSpans(0, content.length(), Object.class);
if (spans != null) {
for (Object span : spans) {
if ((content.getSpanFlags(span) & Spanned.SPAN_COMPOSING) != 0) {
// Found composition string.
return true;
}
}
}
return false;
}