Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

[Android] Support `PerformContextMenuAction`

Open ijklam opened this issue 9 months ago • 7 comments

What does the pull request do?

Support PerformContextMenuAction so that application can react on IME copy paste command

What is the current behavior?

App will not react when press copy/paste/cut/select all button on IME

https://github.com/AvaloniaUI/Avalonia/assets/43789618/ed788058-6278-4203-bd82-2ea8255d3e9d

What is the updated/expected behavior with this PR?

App will react when press copy/paste/cut/select-all button on IME now

https://github.com/AvaloniaUI/Avalonia/assets/43789618/cb52adbe-4f79-4611-828c-649ec33a1c2c

How was the solution implemented (if it's not obvious)?

When press copy/paste/cut/select-all button, the Android IME will call BaseInputConnection.performContextMenuAction(int id) to make command work

Checklist

  • [ ] Added unit tests (if possible)?
  • [ ] Added XML documentation to any related classes?
  • [ ] Consider submitting a PR to https://github.com/AvaloniaUI/avalonia-docs with user documentation

Breaking changes

Obsoletions / Deprecations

Fixed issues

ijklam avatar May 04 '24 17:05 ijklam

You can test this PR using the following package version. 11.2.999-cibuild0048080-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar May 04 '24 18:05 avaloniaui-bot

@Gillibald @emmauss don't we have a better API in the IME for that? If not, it might make sense to add, instead of creating fake hotkey input.

maxkatz6 avatar May 04 '24 23:05 maxkatz6

All this should go through the TextInputMethodClient so y we need to add some API for inserting and deleting

Gillibald avatar May 05 '24 08:05 Gillibald

So I should wait for the API changed?

ijklam avatar May 05 '24 09:05 ijklam

any updates?

ijklam avatar May 09 '24 10:05 ijklam

We need a common way of executing known context Manu action. Ideally an enum with known action names.

TextInputMethodClient will then expose ExecuteContextMenuAction or similar

Gillibald avatar May 09 '24 12:05 Gillibald

You can test this PR using the following package version. 11.2.999-cibuild0048280-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot avatar May 09 '24 16:05 avaloniaui-bot

When will this be contained in the Release? (In the 11.1.0 rc)

ijklam avatar Jul 09 '24 07:07 ijklam

@Tangent-90 it will be in 11.1.1 release.

maxkatz6 avatar Jul 09 '24 19:07 maxkatz6

@Tangent-90 it will be in 11.1.1 release.

It is 11.1.2 now, but this and #15603 still not be released. Including these will improve the input expression on Android devices.

And I really need these features.

ijklam avatar Aug 10 '24 18:08 ijklam