app/src/main/java/org/andstatus/app/origin/Origin.java
/**
     * Calculates number of Characters left for this note taking shortened
     * URL's length into account.
     * 
     * @author yvolk@yurivolkov.com
     */
Calculates number of Characters left for this note taking shortened
URL's length into account.


Calculates number of Characters left for this note taking shortened URL ' s length into account .
public int charactersLeftForNote(String html) {
        int textLength = 0;
        if (!StringUtil.isEmpty(html)) {
            String textToPost = MyHtml.fromContentStored(html, originType.textMediaTypeToPost);
            textLength = textToPost.length();
            if (shortUrlLength > 0) {
                SpannableString ss = SpannableString.valueOf(textToPost);
                Linkify.addLinks(ss, Linkify.WEB_URLS);
                URLSpan[] spans = ss.getSpans(0, textLength, URLSpan.class);
                long nLinks = spans.length;
                for (int ind1 = 0; ind1 < nLinks; ind1++) {
                    int start = ss.getSpanStart(spans[ind1]);
                    int end = ss.getSpanEnd(spans[ind1]);
                    textLength += shortUrlLength - (end - start);
                }
            }
        }
        return textLimit - textLength;
    }
public int charactersLeftForNote ( String html ) { int textLength = 0 ; if ( ! StringUtil . isEmpty ( html ) ) { String textToPost = MyHtml . fromContentStored ( html , originType . textMediaTypeToPost ) ; textLength = textToPost . length ( ) ; if ( shortUrlLength > 0 ) { SpannableString ss = SpannableString . valueOf ( textToPost ) ; Linkify . addLinks ( ss , Linkify . WEB_URLS ) ; URLSpan [ ] spans = ss . getSpans ( 0 , textLength , URLSpan . class ) ; long nLinks = spans . length ; for ( int ind1 = 0 ; ind1 < nLinks ; ind1 ++ ) { int start = ss . getSpanStart ( spans [ ind1 ] ) ; int end = ss . getSpanEnd ( spans [ ind1 ] ) ; textLength += shortUrlLength - ( end - start ) ; } } } return textLimit - textLength ; }
Calculates number of Characters left for this note taking shortened
 URL's length into account.
Calculates number of Characters left for this note taking shortened URL ' s length into account .
// Now try to adjust the length taking links into account