1

Currently developing a IME (InputMethodEditor) app, so there is the subclassed InputMethodService and that inflates a keyboardView. In this case it's just inflating a view, its size is similar to any other keyboard app. The View logs the touch event position of down, move, and up actions. I have minimised it to this, because I am testing the touch position given on move events. All positions are logged relative to the IME window, but when a move gesture goes beyond the view (above it) the y coordinates do not continue and remain at zero.

Is there a way to continue to receive the actual coordinates of the pointer even though the action move is outside of the IME window.

EDIT: The aim was to test if an action move event from a view in IME window can be passed to a view in another window, (i.e. to seamlessly continue with the action move from the IME Window to another) and also to move back to the IME window. But because the move coordinates seem to be bound to the IME window this doesn't work when the touch event goes beyond the IME window.

bluewhale
  • 181
  • 2
  • 9
  • Try to put the IME view inside of a container view that match the parents width & height. make sure that the background of this container is nothing. Now when you inflate the view. you'll get both the IME, the transparent background so you can still control whats behind the keyboard, and your Y coordinates should show something other than zero I guess. let us know if that helped you ^.^ – MohammedAlSafwan Dec 17 '16 at 18:34
  • Though that would give out the correct y values for the related view, the IME would not function anymore. The IME would be practically a fullscreen and touches do not fall through to views underneath. Also apps set their dimens relative to the IME and if that's force to be fullscreen, then the app would not display. – bluewhale Dec 17 '16 at 20:51
  • @TK52 Actually what you suggested could work if you override the onComputeInsets() and set the values to the visible part of the IME you wanted. – bluewhale Dec 21 '16 at 21:08

1 Answers1

0

For security reasons this seems to be a limiting characteristics of the IME window and have not found a sensible way round this. Also there is no way of having an overlay to deal with this limitation, as stated in this answer: https://stackoverflow.com/a/33698077/3678942 , cannot allow touch events to pass through a window.

One way to work around this is to use the fact the y value is zero (i.e. it has reached the top most bounds of the IME window), and continue to use the touch event and its x values (which are still calculated), to process whatever handling is needed.

Having a candidate view also helps, the IME window increase its dimensions to accommodate it even if it is not shown and any underlying apps content will only measure to the visible input view.

bluewhale
  • 181
  • 2
  • 9