belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
InputConnectionCompat
public
final
class
InputConnectionCompat
extends Object
java.lang.Object | |
↳ | android.support.v13.view.inputmethod.InputConnectionCompat |
Helper for accessing features in InputConnection
introduced after API level 13 in a
backwards compatible fashion.
Summary
Nested classes | |
---|---|
interface |
InputConnectionCompat.OnCommitContentListener
Listener for commitContent method call, in a backwards compatible fashion. |
Constants | |
---|---|
int |
INPUT_CONTENT_GRANT_READ_URI_PERMISSION
When this flag is used, the editor will be able to request temporary access permissions to
the content URI contained in the |
Public constructors | |
---|---|
InputConnectionCompat()
|
Public methods | |
---|---|
static
boolean
|
commitContent(InputConnection inputConnection, EditorInfo editorInfo, InputContentInfoCompat inputContentInfo, int flags, Bundle opts)
Calls commitContent API, in a backwards compatible fashion. |
static
InputConnection
|
createWrapper(InputConnection inputConnection, EditorInfo editorInfo, InputConnectionCompat.OnCommitContentListener onCommitContentListener)
Creates a wrapper |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Constants
INPUT_CONTENT_GRANT_READ_URI_PERMISSION
int INPUT_CONTENT_GRANT_READ_URI_PERMISSION
When this flag is used, the editor will be able to request temporary access permissions to
the content URI contained in the InputContentInfoCompat
object, in a similar manner
that has been recommended in
Sharing Files.
Make sure that the content provider owning the Uri sets the
grantUriPermissions
attribute in its manifest or
included the <grant-uri-permissions>
tag.
Supported only on API >= 25.
On API <= 24 devices, IME developers need to ensure that the content URI is accessible
only from the target application, for example, by generating a URL with a unique name that
others cannot guess. IME developers can also rely on the following information of the target
application to do additional access checks in their ContentProvider
.
- On API >= 23
packageName
is guaranteed to not be spoofed, which can later be compared withgetCallingPackage()
in theContentProvider
. getUid()
is guaranteed to not be spoofed, which can later be compared withgetCallingUid()
in theContentProvider
.
Constant Value: 1 (0x00000001)
Public constructors
Public methods
commitContent
boolean commitContent (InputConnection inputConnection, EditorInfo editorInfo, InputContentInfoCompat inputContentInfo, int flags, Bundle opts)
Calls commitContent API, in a backwards compatible fashion.
Parameters | |
---|---|
inputConnection |
InputConnection : InputConnection with which commitContent API will be called |
editorInfo |
EditorInfo : EditorInfo associated with the given inputConnection |
inputContentInfo |
InputContentInfoCompat : content information to be passed to the editor |
flags |
int : 0 or INPUT_CONTENT_GRANT_READ_URI_PERMISSION |
opts |
Bundle : optional bundle data. This can be null |
Returns | |
---|---|
boolean |
true if this request is accepted by the application, no matter if the request
is already handled or still being handled in background
|
createWrapper
InputConnection createWrapper (InputConnection inputConnection, EditorInfo editorInfo, InputConnectionCompat.OnCommitContentListener onCommitContentListener)
Creates a wrapper InputConnection
object from an existing InputConnection
and InputConnectionCompat.OnCommitContentListener
that can be returned to the system.
By returning the wrapper object to the IME, the editor can be notified by
onCommitContent(InputContentInfoCompat, int, Bundle)
when the IME calls
commitContent(InputConnection, EditorInfo, InputContentInfoCompat, int, Bundle)
and the corresponding Framework API that is available
on API >= 25.
Parameters | |
---|---|
inputConnection |
InputConnection : InputConnection to be wrapped |
editorInfo |
EditorInfo : EditorInfo associated with the given inputConnection |
onCommitContentListener |
InputConnectionCompat.OnCommitContentListener : the listener that the wrapper object will call |
Returns | |
---|---|
InputConnection |
a wrapper InputConnection object that can be returned to the IME |
Throws | |
---|---|
IllegalArgumentException |
when inputConnection , editorInfo , or
onCommitContentListener is null
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.