Google 致力于为黑人社区推动种族平等。查看具体举措

ContentInfoCompat

class ContentInfoCompat
kotlin.Any
   ↳ androidx.core.view.ContentInfoCompat

Holds all the relevant data for a request to OnReceiveContentListener.

Summary

Nested classes

Builder for ContentInfoCompat.

Constants
static Int

Flag requesting that the content should be converted to plain text prior to inserting.

static Int

Specifies that the operation was triggered by the app that contains the target view.

static Int

Specifies that the operation was triggered by a paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the insertion/selection menu).

static Int

Specifies that the operation was triggered by the drag/drop framework.

static Int

Specifies that the operation was triggered from the soft keyboard (also known as input method editor or IME).

Public methods
ClipData

The data to be inserted.

Bundle?

Optional additional metadata.

Int

Optional flags that control the insertion behavior.

Uri?

Optional http/https URI for the content that may be provided by the IME.

Int

The source of the operation.

Pair<ContentInfoCompat!, ContentInfoCompat!>
partition(@NonNull itemPredicate: Predicate<Item!>)

Partitions this content based on the given predicate.

String

Constants

FLAG_CONVERT_TO_PLAIN_TEXT

static val FLAG_CONVERT_TO_PLAIN_TEXT: Int

Flag requesting that the content should be converted to plain text prior to inserting.

Value: 1 << 0

SOURCE_APP

static val SOURCE_APP: Int

Specifies that the operation was triggered by the app that contains the target view.

Value: 0

SOURCE_CLIPBOARD

static val SOURCE_CLIPBOARD: Int

Specifies that the operation was triggered by a paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the insertion/selection menu).

Value: 1

SOURCE_DRAG_AND_DROP

static val SOURCE_DRAG_AND_DROP: Int

Specifies that the operation was triggered by the drag/drop framework. See https://developer.android.com/guide/topics/ui/drag-drop for more info.

Value: 3

SOURCE_INPUT_METHOD

static val SOURCE_INPUT_METHOD: Int

Specifies that the operation was triggered from the soft keyboard (also known as input method editor or IME). See https://developer.android.com/guide/topics/text/image-keyboard for more info.

Value: 2

Public methods

getClip

@NonNull fun getClip(): ClipData

The data to be inserted.

getExtras

@Nullable fun getExtras(): Bundle?

Optional additional metadata. If the source is SOURCE_INPUT_METHOD, this will include the opts passed by the IME.

getFlags

fun getFlags(): Int

Optional flags that control the insertion behavior. See FLAG_ constants.

getLinkUri

@Nullable fun getLinkUri(): Uri?

Optional http/https URI for the content that may be provided by the IME. This is only populated if the source is SOURCE_INPUT_METHOD and if a non-empty linkUri was passed by the IME.

getSource

fun getSource(): Int

The source of the operation. See SOURCE_ constants. Future versions of Android may pass additional values.

partition

@NonNull fun partition(@NonNull itemPredicate: Predicate<Item!>): Pair<ContentInfoCompat!, ContentInfoCompat!>

Partitions this content based on the given predicate.

This function classifies the content and organizes it into a pair, grouping the items that matched vs didn't match the predicate.

Except for the ClipData items, the returned objects will contain all the same metadata as this ContentInfoCompat.

Parameters
itemPredicate Predicate<Item!>: The predicate to test each ClipData.Item to determine which partition to place it into.
Return
Pair<ContentInfoCompat!, ContentInfoCompat!> A pair containing the partitioned content. The pair's first object will have the content that matched the predicate, or null if none of the items matched. The pair's second object will have the content that didn't match the predicate, or null if all of the items matched.

toString

@NonNull fun toString(): String