public class ClipEntry(public val clipData: ClipData)
Android specific class that contains the primary clip in android.content.ClipboardManager.
Properties
clipMetadata
public val clipMetadata: ClipMetadata = clipData.description.toClipMetadata()
Functions
readText
public actual suspend fun readText(): String?
readPlainText
public actual suspend fun readPlainText(): String?
readHtml
public actual suspend fun readHtml(): String?
readUrl
public actual suspend fun readUrl(): String?
Members
Companion
public actual companion object
Functions
withText
public fun withText(plainText: String, html: String?): ClipEntry
withUrl
public fun withUrl(
url: String,
plainText: String,
html: String?,
): ClipEntry
public class ClipEntry
Platform specific protocol that expresses an item in the native Clipboard.
Properties
clipMetadata
public val clipMetadata: ClipMetadata
Returns a ClipMetadata which describes the contents of this ClipEntry. This is an ideal way to check whether to accept or reject what may be pasted from the clipboard without explicitly reading the content.
Calling this function does not trigger any content access warnings on any platform.
Functions
readText
public suspend fun readText(): String?
Reads the first available text representation of this clip.
Use readText() when you want the best-effort text value from a clip: it prefers plain text, then falls back to HTML or a URL. Use readPlainText, readHtml, or readUrl to request a specific representation.
Return
plain text, HTML markup, or URL text, or null if none can be read
readPlainText
public suspend fun readPlainText(): String?
Reads the plain-text representation.
Unlike readText, returns null when plain text is unavailable instead of trying other representations.
Use readPlainText() when the caller accepts only plain text and should get null rather than HTML or a URL if plain text is unavailable.
Return
plain text, or null if unavailable or reading fails
readHtml
public suspend fun readHtml(): String?
Reads the HTML representation. If there is no HTML representation available, this method doesn't try to read other text values.
Return
HTML markup, or null if unavailable or reading fails
readUrl
public suspend fun readUrl(): String?
Reads the URL representation. If there is no URL representation available, this method doesn't try to read other text values.
Return
URL string, or null if unavailable or reading fails
Members
Companion
public companion object
Functions
withText
public fun withText(plainText: String, html: String? = null): ClipEntry
Creates an entry with plainText and optional html representations.
Parameters
| plainText | plain-text representation of the item |
| html | optional HTML representation of the same text content |
withUrl
public fun withUrl(url: String, plainText: String = url, html: String? = null): ClipEntry
Creates an entry with URL, plain-text and optional HTML representation.
Parameters
| url | valid URL string to write; this function does not validate url |
| plainText | plain-text fallback, such as a label; defaults to url |
| html | optional HTML link for the same URL |