Class ProcessTextChannel
ProcessTextChannel
is a platform channel that is used by the framework to initiate text
processing feature in the embedding and for the embedding to send back the results.
When the framework needs to query the list of text processing actions (for instance to expose
them in the selected text context menu), it will send to the embedding the message
ProcessText.queryTextActions
. In response, the ProcessTextPlugin
will return a map of all activities that can process text. The map keys are generated IDs and the
values are the activities labels. On the first request, the ProcessTextPlugin
will make a call to Android's package manager to query
all activities that can be performed for the Intent.ACTION_PROCESS_TEXT
intent.
When a text processing action has to be executed, the framework will send to the embedding the
message ProcessText.processTextAction
with the int id
of the choosen text action
and the String
of text to process as arguments. In response, the ProcessTextPlugin
will make a call to the Android application activity to
start the activity exposing the text action. The ProcessTextPlugin
will return the processed text if there is one, or null if the activity did not return a
transformed text.
ProcessTextPlugin
implements ProcessTextChannel.ProcessTextMethodHandler
that parses incoming messages from Flutter.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionProcessTextChannel
(DartExecutor dartExecutor, PackageManager packageManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setMethodHandler
(ProcessTextChannel.ProcessTextMethodHandler processTextMethodHandler) Sets theProcessTextChannel.ProcessTextMethodHandler
which receives all requests to the text processing feature sent through this channel.
-
Field Details
-
channel
-
packageManager
-
parsingMethodHandler
-
-
Constructor Details
-
ProcessTextChannel
public ProcessTextChannel(@NonNull DartExecutor dartExecutor, @NonNull PackageManager packageManager)
-
-
Method Details
-
setMethodHandler
public void setMethodHandler(@Nullable ProcessTextChannel.ProcessTextMethodHandler processTextMethodHandler) Sets theProcessTextChannel.ProcessTextMethodHandler
which receives all requests to the text processing feature sent through this channel.
-