private void convertParagraphs() {
        RTLayout rtLayout = new RTLayout(mText);

        // a manual for loop is faster than the for-each loop for an ArrayList:
        // see https://developer.android.com/training/articles/perf-tips.html#Loops
        ArrayList<Paragraph> paragraphs = rtLayout.getParagraphs();
        for (int i = 0, size = paragraphs.size(); i < size; i++) {
            Paragraph paragraph = paragraphs.get(i);

            // retrieve all spans for this paragraph
            Set<SingleParagraphStyle> styles = getParagraphStyles(mText, paragraph);

            // get the alignment span if there is any
            ParagraphType alignmentType = null;
            for (SingleParagraphStyle style : styles) {
                if (style.getType().isAlignment()) {
                    alignmentType = style.getType();
                    break;
                }
            }

            /*
             * start tag: bullet points, numbering and indentation
             */
            int newIndent = 0;
            ParagraphType newType = ParagraphType.NONE;
            for (SingleParagraphStyle style : styles) {
                newIndent += style.getIndentation();
                ParagraphType type = style.getType();
                newType = type.isBullet() ? ParagraphType.BULLET :
                        type.isNumbering() ? ParagraphType.NUMBERING :
                                type.isIndentation() && newType.isUndefined() ? ParagraphType.INDENTATION_UL : newType;
            }
            // process leading margin style
            processLeadingMarginStyle(new AccumulatedParagraphStyle(newType, newIndent, 0));
            // add start list tag
            mOut.append(newType.getListStartTag());

            /*
             * start tag: alignment (left, center, right)
             */
            if (alignmentType != null) {
                mOut.append(alignmentType.getStartTag());
            }

            /*
             * Convert the plain text
             */
            withinParagraph(mText, paragraph.start(), paragraph.end());

            /*
             * end tag: alignment (left, center, right)
             */
            if (alignmentType != null) {
                removeTrailingLineBreak(alignmentType);
                mOut.append(alignmentType.getEndTag());
            }


            // add end list tag
            removeTrailingLineBreak(newType);
            mOut.append(newType.getListEndTag());
        }

        /*
         * end tag: bullet points and indentation
         */
        while (!mParagraphStyles.isEmpty()) {
            removeParagraph();
        }
    }
private void convertParagraphs() {
        RTLayout rtLayout = new RTLayout(mText);

        
        
        ArrayList<Paragraph> paragraphs = rtLayout.getParagraphs();
        for (int i = 0, size = paragraphs.size(); i < size; i++) {
            Paragraph paragraph = paragraphs.get(i);

            
            Set<SingleParagraphStyle> styles = getParagraphStyles(mText, paragraph);

            
            ParagraphType alignmentType = null;
            for (SingleParagraphStyle style : styles) {
                if (style.getType().isAlignment()) {
                    alignmentType = style.getType();
                    break;
                }
            }

            
            int newIndent = 0;
            ParagraphType newType = ParagraphType.NONE;
            for (SingleParagraphStyle style : styles) {
                newIndent += style.getIndentation();
                ParagraphType type = style.getType();
                newType = type.isBullet() ? ParagraphType.BULLET :
                        type.isNumbering() ? ParagraphType.NUMBERING :
                                type.isIndentation() && newType.isUndefined() ? ParagraphType.INDENTATION_UL : newType;
            }
            
            processLeadingMarginStyle(new AccumulatedParagraphStyle(newType, newIndent, 0));
            
            mOut.append(newType.getListStartTag());

            
            if (alignmentType != null) {
                mOut.append(alignmentType.getStartTag());
            }

            
            withinParagraph(mText, paragraph.start(), paragraph.end());

            
            if (alignmentType != null) {
                removeTrailingLineBreak(alignmentType);
                mOut.append(alignmentType.getEndTag());
            }


            
            removeTrailingLineBreak(newType);
            mOut.append(newType.getListEndTag());
        }

        
        while (!mParagraphStyles.isEmpty()) {
            removeParagraph();
        }
    }
private void convertParagraphs ( ) { RTLayout rtLayout = new RTLayout ( mText ) ; // a manual for loop is faster than the for-each loop for an ArrayList: // see https://developer.android.com/training/articles/perf-tips.html#Loops ArrayList < Paragraph > paragraphs = rtLayout . getParagraphs ( ) ; for ( int i = 0 , size = paragraphs . size ( ) ; i < size ; i ++ ) { Paragraph paragraph = paragraphs . get ( i ) ; // retrieve all spans for this paragraph Set < SingleParagraphStyle > styles = getParagraphStyles ( mText , paragraph ) ; // get the alignment span if there is any ParagraphType alignmentType = null ; for ( SingleParagraphStyle style : styles ) { if ( style . getType ( ) . isAlignment ( ) ) { alignmentType = style . getType ( ) ; break ; } } /*
             * start tag: bullet points, numbering and indentation
             */ int newIndent = 0 ; ParagraphType newType = ParagraphType . NONE ; for ( SingleParagraphStyle style : styles ) { newIndent += style . getIndentation ( ) ; ParagraphType type = style . getType ( ) ; newType = type . isBullet ( ) ? ParagraphType . BULLET : type . isNumbering ( ) ? ParagraphType . NUMBERING : type . isIndentation ( ) && newType . isUndefined ( ) ? ParagraphType . INDENTATION_UL : newType ; } // process leading margin style processLeadingMarginStyle ( new AccumulatedParagraphStyle ( newType , newIndent , 0 ) ) ; // add start list tag mOut . append ( newType . getListStartTag ( ) ) ; /*
             * start tag: alignment (left, center, right)
             */ if ( alignmentType != null ) { mOut . append ( alignmentType . getStartTag ( ) ) ; } /*
             * Convert the plain text
             */ withinParagraph ( mText , paragraph . start ( ) , paragraph . end ( ) ) ; /*
             * end tag: alignment (left, center, right)
             */ if ( alignmentType != null ) { removeTrailingLineBreak ( alignmentType ) ; mOut . append ( alignmentType . getEndTag ( ) ) ; } // add end list tag removeTrailingLineBreak ( newType ) ; mOut . append ( newType . getListEndTag ( ) ) ; } /*
         * end tag: bullet points and indentation
         */ while ( ! mParagraphStyles . isEmpty ( ) ) { removeParagraph ( ) ; } }
****************************************** Process Paragraphs *******************************************
****************************************** Process Paragraphs *******************************************