The Android Developer Challenge is back! Submit your idea before December 2.

InputContentInfoCompat

class InputContentInfoCompat
kotlin.Any
   ↳ androidx.core.view.inputmethod.InputContentInfoCompat

Helper for accessing features in InputContentInfo introduced after API level 13 in a backwards compatible fashion.

Summary

Public constructors

<init>(@NonNull contentUri: Uri, @NonNull description: ClipDescription, @Nullable linkUri: Uri?)

Constructs InputContentInfoCompat.

Public methods

Uri

ClipDescription

Uri?

Unit

Releases a temporary read-only access permission for content URI associated with this object.

Unit

Requests a temporary read-only access permission for content URI associated with this object.

Any?

Gets the underlying framework android.

static InputContentInfoCompat?
wrap(@Nullable inputContentInfo: Any?)

Creates an instance from a framework android.

Public constructors

<init>

InputContentInfoCompat(@NonNull contentUri: Uri, @NonNull description: ClipDescription, @Nullable linkUri: Uri?)

Constructs InputContentInfoCompat.

Parameters
contentUri Uri: content URI to be exported from the input method. This cannot be null.
description Uri: a ClipDescription object that contains the metadata of contentUri such as MIME type(s). This object cannot be null. Also ClipDescription#getLabel() should be describing the content specified by contentUri for accessibility reasons.
linkUri Uri: an optional http or https URI. The editor author may provide a way to navigate the user to the specified web page if this is not null.

Public methods

getContentUri

@NonNull fun getContentUri(): Uri
Return
Uri: content URI with which the content can be obtained.

getDescription

@NonNull fun getDescription(): ClipDescription
Return
ClipDescription: ClipDescription object that contains the metadata of getContentUri() such as MIME type(s). ClipDescription#getLabel() can be used for accessibility purpose.

getLinkUri

@Nullable fun getLinkUri(): Uri?
Return
Uri?: an optional http or https URI that is related to this content.

releasePermission

fun releasePermission(): Unit

Releases a temporary read-only access permission for content URI associated with this object.

Does nothing if the temporary permission is not granted.

requestPermission

fun requestPermission(): Unit

Requests a temporary read-only access permission for content URI associated with this object.

Does nothing if the temporary permission is already granted.

unwrap

@Nullable fun unwrap(): Any?

Gets the underlying framework android.view.inputmethod.InputContentInfo object.

This method always returns null on API <= 24.

Return
Any?: an equivalent android.view.inputmethod.InputContentInfo object, or null if not supported.

wrap

@Nullable static fun wrap(@Nullable inputContentInfo: Any?): InputContentInfoCompat?

Creates an instance from a framework android.view.inputmethod.InputContentInfo object.

This method always returns null on API <= 24.

Parameters
inputContentInfo Any?: an android.view.inputmethod.InputContentInfo object, or null if none.
Return
InputContentInfoCompat?: an equivalent InputContentInfoCompat object, or null if not supported.