private static boolean spanWillOverlap ( Spannable spanText , URLSpan [ ] spanList , int start , int end ) { if ( start == end ) { // empty span, ignore return false ; } for ( URLSpan span : spanList ) { int existingStart = spanText . getSpanStart ( span ) ; int existingEnd = spanText . getSpanEnd ( span ) ; if ( ( start >= existingStart && start < existingEnd ) || end > existingStart && end <= existingEnd ) { if ( Log . isLoggable ( TAG , Log . VERBOSE ) ) { CharSequence seq = spanText . subSequence ( start , end ) ; Log . v ( TAG , "Not linkifying " + seq + " as phone number due to overlap" ) ; } return true ; } } return false ; }
Determines whether a new span at [ start end ) will overlap with any existing span .