本文整理汇总了Java中android.text.style.LeadingMarginSpan.Standard方法的典型用法代码示例。如果您正苦于以下问题:Java LeadingMarginSpan.Standard方法的具体用法?Java LeadingMarginSpan.Standard怎么用?Java LeadingMarginSpan.Standard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.style.LeadingMarginSpan
的用法示例。
在下文中一共展示了LeadingMarginSpan.Standard方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReplaces
import android.text.style.LeadingMarginSpan; //导入方法依赖的package包/类
@Override
protected Object[] getReplaces(final Editable text, final int indentation) {
// Nested BulletSpans increases distance between BULLET_SPAN and text, so we must prevent it.
int bulletMargin = INDENT_PX;
if (indentation > 1) {
bulletMargin = INDENT_PX - BULLET_SPAN.getLeadingMargin(true);
if (indentation > 2) {
// This get's more complicated when we add a LeadingMarginSpan into the same line:
// we have also counter it's effect to BulletSpan
bulletMargin -= (indentation - 2) * LIST_ITEM_INDENT_PX;
}
}
return new Object[]{
new LeadingMarginSpan.Standard(LIST_ITEM_INDENT_PX * (indentation - 1)),
new BulletSpan(bulletMargin)
};
}
示例2: writeSingleParagraphStyle
import android.text.style.LeadingMarginSpan; //导入方法依赖的package包/类
private void writeSingleParagraphStyle(ParagraphStyle style, DataOutputStream dos) throws IOException {
Class clazz = style.getClass();
dos.writeInt(mString.getSpanStart(style));
dos.writeInt(mString.getSpanEnd(style));
dos.writeInt(mString.getSpanFlags(style));
if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
int tag = mCharacterStylesTags.get(clazz.getSimpleName());
if (mCharacterStylesTags.containsKey(clazz.getSimpleName())) {
dos.writeInt(tag);
}
switch (tag) {
case 24: // AligmentSpan.Standard
AlignmentSpan.Standard as2 = (AlignmentSpan.Standard)style;
dos.writeInt(as2.getAlignment().ordinal());
break;
case 25: // BulletSpan
BulletSpan bs = (BulletSpan)style;
dos.writeInt(bs.getLeadingMargin(true));
dos.writeInt(bs.getLeadingMargin(false));
break;
case 30: // LeadingMarginSpan.Sandard
LeadingMarginSpan.Standard lms = (LeadingMarginSpan.Standard)style;
dos.writeInt(lms.getLeadingMargin(true));
dos.writeInt(lms.getLeadingMargin(false));
break;
case 34: // QuoteSpan
QuoteSpan qs = (QuoteSpan)style;
dos.writeInt(qs.getColor());
break;
case 36: // TabStopSpan.Standard
TabStopSpan.Standard tss = (TabStopSpan.Standard)style;
dos.writeInt(tss.getTabStop());
break;
default:
}
} else {
write(style,dos);
}
}
示例3: readSingleParagraph
import android.text.style.LeadingMarginSpan; //导入方法依赖的package包/类
private SpanPlacementInfo readSingleParagraph(DataInputStream dis) throws IOException {
SpanPlacementInfo spi = new SpanPlacementInfo();
spi.start = dis.readInt();
spi.end = dis.readInt();
spi.mode = dis.readInt();
int tag = dis.readInt(); // mCharacterStylesTags.get(clazz.getSimpleName());
switch (tag) {
case 24: // AligmentSpan.Standard
spi.span = new AlignmentSpan.Standard(Alignment.values()[dis.readInt()]);
break;
case 25: // BulletSpan
spi.span = new BulletSpan(dis.readInt());
dis.readInt(); // skip gap width for other lines
break;
case 30: // LeadingMarginSpan.Sandard
spi.span = new LeadingMarginSpan.Standard(dis.readInt(),dis.readInt());
break;
case 34: // QuoteSpan
spi.span = new QuoteSpan(dis.readInt());
break;
case 36: // TabStopSpan.Standard
spi.span = new TabStopSpan.Standard(dis.readInt());
break;
case 80: // RemoteDrawableSpan
break;
default:
spi.span = read(tag,dis);
}
return spi;
}
示例4: leadingMargin
import android.text.style.LeadingMarginSpan; //导入方法依赖的package包/类
public static Node leadingMargin(Integer every, Object... nodes) {
return new SpanNode(new LeadingMarginSpan.Standard(every), nodes);
}
示例5: getNode
import android.text.style.LeadingMarginSpan; //导入方法依赖的package包/类
private TagNode getNode (Object span) {
TagNode node = new TagNode();
node.start = noteContent.getSpanStart(span);
node.end = noteContent.getSpanEnd(span);
if( span instanceof StyleSpan ) {
StyleSpan style = (StyleSpan) span;
if( (style.getStyle()&Typeface.BOLD)>0 )
{
node.setType(TagType.BOLD);
}
if( (style.getStyle()&Typeface.ITALIC)>0 )
{
node.setType(TagType.ITALIC);
}
}
else if( span instanceof StrikethroughSpan )
{
node.setType(TagType.STRIKETHROUGH);
}
else if( span instanceof BackgroundColorSpan )
{
BackgroundColorSpan bgcolor = (BackgroundColorSpan) span;
if( bgcolor.getBackgroundColor()==Note.NOTE_HIGHLIGHT_COLOR )
{
node.setType(TagType.HIGHLIGHT);
}
}
else if( span instanceof TypefaceSpan )
{
TypefaceSpan typeface = (TypefaceSpan) span;
if( typeface.getFamily()==Note.NOTE_MONOSPACE_TYPEFACE )
{
node.setType(TagType.MONOSPACE);
}
}
else if( span instanceof RelativeSizeSpan )
{
RelativeSizeSpan size = (RelativeSizeSpan) span;
if( size.getSizeChange()==Note.NOTE_SIZE_SMALL_FACTOR )
{
node.setType(TagType.SIZE_SMALL);
}
else if( size.getSizeChange()==Note.NOTE_SIZE_LARGE_FACTOR )
{
node.setType(TagType.SIZE_LARGE);
}
else if( size.getSizeChange()==Note.NOTE_SIZE_HUGE_FACTOR )
{
node.setType(TagType.SIZE_HUGE);
}
}
else if( span instanceof LinkInternalSpan )
{
node.setType(TagType.LINK_INTERNAL);
}
else if( span instanceof LeadingMarginSpan.Standard )
{
LeadingMarginSpan.Standard margin = (LeadingMarginSpan.Standard) span;
int currentMargin = margin.getLeadingMargin(true);
node.setType(TagType.MARGIN);
node.listLevel = currentMargin / Note.NOTE_BULLET_INTENT_FACTOR;
}
else if( span instanceof BulletSpan )
{
node.setType(TagType.LIST_ITEM);
}
else {
node.setType(TagType.OTHER);
}
return node;
}