(StringBuilder out, CharSequence text,
int start, int end)
| 548 | |
| 549 | //@UnsupportedAppUsage |
| 550 | private /* static */ void withinStyle(StringBuilder out, CharSequence text, |
| 551 | int start, int end) { |
| 552 | for (int i = start; i < end; i++) { |
| 553 | try { |
| 554 | char c = text.charAt(i); |
| 555 | |
| 556 | if (c == '<') { |
| 557 | out.append("<"); |
| 558 | } else if (c == '>') { |
| 559 | out.append(">"); |
| 560 | } else if (c == '&') { |
| 561 | out.append("&"); |
| 562 | } else if (c >= 0xD800 && c <= 0xDFFF) { |
| 563 | if (c < 0xDC00 && i + 1 < end) { |
| 564 | char d = text.charAt(i + 1); |
| 565 | if (d >= 0xDC00 && d <= 0xDFFF) { |
| 566 | i++; |
| 567 | int codepoint = 0x010000 | (int) c - 0xD800 << 10 | (int) d - 0xDC00; |
| 568 | out.append("&#").append(codepoint).append(";"); |
| 569 | } |
| 570 | } |
| 571 | } else if (c > 0x7E || c < ' ') { |
| 572 | out.append("&#").append((int) c).append(";"); |
| 573 | } else if (c == ' ') { |
| 574 | boolean img = (i - 1 >= 0 && text.charAt(i - i) == '\uFFFC'); |
| 575 | |
| 576 | while (i + 1 < end && text.charAt(i + 1) == ' ') { |
| 577 | out.append(" "); |
| 578 | i++; |
| 579 | } |
| 580 | |
| 581 | out.append(img ? " " : ' '); |
| 582 | } else { |
| 583 | out.append(c); |
| 584 | } |
| 585 | } catch (Throwable ex) { |
| 586 | Log.e("withinStyle " + start + "..." + end + "/" + text.length() + " i=" + i + |
| 587 | "\n" + android.util.Log.getStackTraceString(ex)); |
| 588 | throw ex; |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | private static int nextSpanTransition(Spanned text, int start, int limit, Class type) { |
| 594 | try { |
no test coverage detected