|
YAACC - UPNP Client and Server
|
Makes names that come from another app safe to show on one line. More...

Static Public Member Functions | |
| static String | clean (String untrusted) |
| static String | forShare (String providerName, String fallback) |
The name to show for a shared file: the provider's name, cleaned, or, if nothing visible is left, the cleaned fallback (a fixed, localized text such as "a shared file"). | |
Static Public Attributes | |
| static final int | MAX_LENGTH = 200 |
| The longest cleaned name, in chars. | |
Makes names that come from another app safe to show on one line.
Plain Java so it can be unit tested on the JVM. The name of a shared file is shown to the user before anything is played (the receiver picker names what is about to be shared), so it must not be able to fake or hide parts of itself.
This is the one cleaner for LAN- and app-supplied texts; MiniPlayerPresenter delegates here, so the rules are the same everywhere: whitespace runs (including line breaks and tabs) become one space, control characters, format characters (Unicode category Cf: bidirectional controls, zero-width characters, soft hyphen, tag characters, ...) and the blank Hangul letters are dropped (the zero-width joiner is kept so emoji sequences survive, and the non-joiner for scripts that need it), the result is trimmed and cut at MAX_LENGTH chars without splitting a surrogate pair. Show the result with setText; it is not markup-escaped.
|
static |
| untrusted | the text from another app or device, may be null |
Referenced by de.yaacc.share.DisplayName.forShare(), and de.yaacc.share.PendingShare.offer().

|
static |
The name to show for a shared file: the provider's name, cleaned, or, if nothing visible is left, the cleaned fallback (a fixed, localized text such as "a shared file").
| providerName | the display name the sending app reported, may be null |
| fallback | the text for "no usable name", may be null |
? only if the fallback is unusable too) 