RTEditor/src/main/java/com/onegravity/rteditor/converter/ConverterHtmlToSpanned.java
private void endList() {
        List list = (List) getLast(List.class);
        if (list != null) {
            if (mResult.length() == 0 || mResult.charAt(mResult.length() - 1) != '\n') {
                mResult.append('\n');
            }
            int start = mResult.getSpanStart(list);
            int end = mResult.length();

            int nrOfIndents = list.mNrOfIndents;
            if (!list.mIsIndentation) {
                nrOfIndents--;
                int margin = Helper.getLeadingMarging();
                // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called
                Object span = list instanceof UL ?
                        new BulletSpan(margin, start == end, false, false) :
                        new NumberSpan(1, margin, start == end, false, false);
                mResult.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (nrOfIndents > 0) {
                int margin = nrOfIndents * Helper.getLeadingMarging();
                // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called
                IndentationSpan span = new IndentationSpan(margin, start == end, false, false);
                mResult.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            mResult.removeSpan(list);
        }
    }
private void endList() {
        List list = (List) getLast(List.class);
        if (list != null) {
            if (mResult.length() == 0 || mResult.charAt(mResult.length() - 1) != '\n') {
                mResult.append('\n');
            }
            int start = mResult.getSpanStart(list);
            int end = mResult.length();

            int nrOfIndents = list.mNrOfIndents;
            if (!list.mIsIndentation) {
                nrOfIndents--;
                int margin = Helper.getLeadingMarging();
                // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called
                Object span = list instanceof UL ?
                        new BulletSpan(margin, start == end, false, false) :
                        new NumberSpan(1, margin, start == end, false, false);
                mResult.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            if (nrOfIndents > 0) {
                int margin = nrOfIndents * Helper.getLeadingMarging();
                // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called
                IndentationSpan span = new IndentationSpan(margin, start == end, false, false);
                mResult.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            mResult.removeSpan(list);
        }
    }
private void endList ( ) { List list = ( List ) getLast ( List . class ) ; if ( list != null ) { if ( mResult . length ( ) == 0 || mResult . charAt ( mResult . length ( ) - 1 ) != ' ' ) { mResult . append ( ' ' ) ; } int start = mResult . getSpanStart ( list ) ; int end = mResult . length ( ) ; int nrOfIndents = list . mNrOfIndents ; if ( ! list . mIsIndentation ) { nrOfIndents -- ; int margin = Helper . getLeadingMarging ( ) ; // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called Object span = list instanceof UL ? new BulletSpan ( margin , start == end , false , false ) : new NumberSpan ( 1 , margin , start == end , false , false ) ; mResult . setSpan ( span , start , end , Spanned . SPAN_EXCLUSIVE_EXCLUSIVE ) ; } if ( nrOfIndents > 0 ) { int margin = nrOfIndents * Helper . getLeadingMarging ( ) ; // use SPAN_EXCLUSIVE_EXCLUSIVE here, will be replaced later anyway when the cleanup function is called IndentationSpan span = new IndentationSpan ( margin , start == end , false , false ) ; mResult . setSpan ( span , start , end , Spanned . SPAN_EXCLUSIVE_EXCLUSIVE ) ; } mResult . removeSpan ( list ) ; } }
Handles LI tags
Handles LI tags