(String value, boolean debug)
| 2392 | // https://issuetracker.google.com/issues/37054851 |
| 2393 | |
| 2394 | static String getPrintableString(String value, boolean debug) { |
| 2395 | if (debug) { |
| 2396 | if (value == null) |
| 2397 | return "<null>"; |
| 2398 | if (TextUtils.isEmpty(value)) |
| 2399 | return "<empty>"; |
| 2400 | } else |
| 2401 | return value; |
| 2402 | StringBuilder result = new StringBuilder(); |
| 2403 | for (int i = 0; i < value.length(); ) { |
| 2404 | int codepoint = value.codePointAt(i); |
| 2405 | if (debug && codepoint == 10) |
| 2406 | result.append('|'); |
| 2407 | else if (debug && codepoint == 32) |
| 2408 | result.append('_'); |
| 2409 | else if (!Helper.isPrintableChar(codepoint) || codepoint == 160) |
| 2410 | result.append('{').append(Integer.toHexString(codepoint)).append('}'); |
| 2411 | else |
| 2412 | result.append(Character.toChars(codepoint)); |
| 2413 | i += Character.charCount(codepoint); |
| 2414 | } |
| 2415 | return result.toString(); |
| 2416 | } |
| 2417 | |
| 2418 | static DateFormat getTimeInstance(Context context) { |
| 2419 | return getTimeInstance(context, SimpleDateFormat.MEDIUM); |
no test coverage detected