While the default behavior of the ShortcutManager is usually desirable, the
Shortcuts widget takes a ShortcutManager that you can subclass to customize
its functionality.

For example, if you wanted to log each key that a Shortcuts widget handled,
you could make a LoggingShortcutManager:

Now, every time the Shortcuts widget handles a shortcut, it prints out the key
event and relevant context.

Actions

Actions allow for the definition of operations that the application can
perform by invoking them with an Intent. Actions can be enabled or disabled,
and receive the intent instance that invoked them as an argument to allow
configuration by the intent.

Defining actions

Actions, in their simplest form, are just subclasses of Action<Intent> with an
invoke() method. Here’s a simple action that simply invokes a function on the
provided model:

Or, if it’s too much of a bother to create a new class, use a CallbackAction: