本文整理汇总了Java中android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE属性的典型用法代码示例。如果您正苦于以下问题:Java Spanned.SPAN_EXCLUSIVE_EXCLUSIVE属性的具体用法?Java Spanned.SPAN_EXCLUSIVE_EXCLUSIVE怎么用?Java Spanned.SPAN_EXCLUSIVE_EXCLUSIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.Spanned
的用法示例。
在下文中一共展示了Spanned.SPAN_EXCLUSIVE_EXCLUSIVE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachFontFace
private static void attachFontFace(SpannableStringBuilder cueText, int fontFace,
int defaultFontFace, int start, int end, int spanPriority) {
if (fontFace != defaultFontFace) {
final int flags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | spanPriority;
boolean isBold = (fontFace & FONT_FACE_BOLD) != 0;
boolean isItalic = (fontFace & FONT_FACE_ITALIC) != 0;
if (isBold) {
if (isItalic) {
cueText.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), start, end, flags);
} else {
cueText.setSpan(new StyleSpan(Typeface.BOLD), start, end, flags);
}
} else if (isItalic) {
cueText.setSpan(new StyleSpan(Typeface.ITALIC), start, end, flags);
}
boolean isUnderlined = (fontFace & FONT_FACE_UNDERLINE) != 0;
if (isUnderlined) {
cueText.setSpan(new UnderlineSpan(), start, end, flags);
}
if (!isUnderlined && !isBold && !isItalic) {
cueText.setSpan(new StyleSpan(Typeface.NORMAL), start, end, flags);
}
}
}
示例2: Builder
private Builder(@NonNull CharSequence text) {
this.text = text;
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = defaultValue;
backgroundColor = defaultValue;
quoteColor = defaultValue;
proportion = -1;
xProportion = -1;
mBuilder = new SpannableStringBuilder();
}
示例3: setDefault
private void setDefault() {
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = COLOR_DEFAULT;
backgroundColor = COLOR_DEFAULT;
lineHeight = -1;
quoteColor = COLOR_DEFAULT;
first = -1;
bulletColor = COLOR_DEFAULT;
iconMarginBitmap = null;
iconMarginDrawable = null;
iconMarginUri = null;
iconMarginResourceId = -1;
iconMarginGapWidth = -1;
fontSize = -1;
proportion = -1;
xProportion = -1;
isStrikethrough = false;
isUnderline = false;
isSuperscript = false;
isSubscript = false;
isBold = false;
isItalic = false;
isBoldItalic = false;
fontFamily = null;
typeface = null;
alignment = null;
clickSpan = null;
url = null;
blurRadius = -1;
shader = null;
shadowRadius = -1;
spans = null;
imageBitmap = null;
imageDrawable = null;
imageUri = null;
imageResourceId = -1;
spaceSize = -1;
}
示例4: Builder
public Builder() {
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = defaultValue;
backgroundColor = defaultValue;
quoteColor = defaultValue;
margin = -1;
fontSize = -1;
proportion = -1;
xProportion = -1;
align = ALIGN_BOTTOM;
mBuilder = new SpannableStringBuilder();
}
示例5: Builder
private Builder(Context context, @NonNull CharSequence text) {
this.mContext = context;
this.text = text;
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = defaultValue;
backgroundColor = defaultValue;
quoteColor = defaultValue;
proportion = -1;
xProportion = -1;
mBuilder = new SpannableStringBuilder();
}
示例6: setDefault
private void setDefault() {
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = DEFAULT_COLOR;
backgroundColor = DEFAULT_COLOR;
lineHeight = -1;
quoteColor = DEFAULT_COLOR;
first = -1;
bulletColor = DEFAULT_COLOR;
iconMarginBitmap = null;
iconMarginDrawable = null;
iconMarginUri = null;
iconMarginResourceId = -1;
iconMarginGapWidth = -1;
fontSize = -1;
proportion = -1;
xProportion = -1;
isStrikethrough = false;
isUnderline = false;
isSuperscript = false;
isSubscript = false;
isBold = false;
isItalic = false;
isBoldItalic = false;
fontFamily = null;
typeface = null;
alignment = null;
clickSpan = null;
url = null;
blurRadius = -1;
shader = null;
shadowRadius = -1;
spans = null;
imageBitmap = null;
imageDrawable = null;
imageUri = null;
imageResourceId = -1;
spaceSize = -1;
}
示例7: manageSpans
/**
* Remove and/or add {@link Spanned.SPAN_EXCLUSIVE_EXCLUSIVE} spans, since they should only exist
* as long as the text they cover is the same. All other spans will remain the same, since they
* will adapt to the new text, hence why {@link SpannableStringBuilder#replace} never removes
* them.
*/
private void manageSpans(SpannableStringBuilder spannableStringBuilder) {
Object[] spans = getText().getSpans(0, length(), Object.class);
for (int spanIdx = 0; spanIdx < spans.length; spanIdx++) {
// Remove all styling spans we might have previously set
if (ForegroundColorSpan.class.isInstance(spans[spanIdx]) ||
BackgroundColorSpan.class.isInstance(spans[spanIdx]) ||
AbsoluteSizeSpan.class.isInstance(spans[spanIdx]) ||
CustomStyleSpan.class.isInstance(spans[spanIdx]) ||
ReactTagSpan.class.isInstance(spans[spanIdx])) {
getText().removeSpan(spans[spanIdx]);
}
if ((getText().getSpanFlags(spans[spanIdx]) & Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) !=
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) {
continue;
}
Object span = spans[spanIdx];
final int spanStart = getText().getSpanStart(spans[spanIdx]);
final int spanEnd = getText().getSpanEnd(spans[spanIdx]);
final int spanFlags = getText().getSpanFlags(spans[spanIdx]);
// Make sure the span is removed from existing text, otherwise the spans we set will be
// ignored or it will cover text that has changed.
getText().removeSpan(spans[spanIdx]);
if (sameTextForSpan(getText(), spannableStringBuilder, spanStart, spanEnd)) {
spannableStringBuilder.setSpan(span, spanStart, spanEnd, spanFlags);
}
}
}
示例8: getSpanPointMarkFlag
private static int getSpanPointMarkFlag(final boolean isStartExclusive,
final boolean isEndExclusive) {
if (isStartExclusive) {
return isEndExclusive ? Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
: Spanned.SPAN_EXCLUSIVE_INCLUSIVE;
}
return isEndExclusive ? Spanned.SPAN_INCLUSIVE_EXCLUSIVE
: Spanned.SPAN_INCLUSIVE_INCLUSIVE;
}
示例9: Builder
private Builder(@NonNull CharSequence text) {
this.text = text;
flag = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
foregroundColor = defaultValue;
backgroundColor = defaultValue;
quoteColor = defaultValue;
textSize = -1;
proportion = -1;
xProportion = -1;
mBuilder = new SpannableStringBuilder();
}
示例10: exclusive
@Override
public StyleEZ exclusive() {
spanFlags = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
return this;
}