IWindowManager.TransferTouchGesture Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Transfer the currently in progress touch gesture from the transferFromToken to the transferToToken.
[Android.Runtime.Register("transferTouchGesture", "(Landroid/window/InputTransferToken;Landroid/window/InputTransferToken;)Z", "GetTransferTouchGesture_Landroid_window_InputTransferToken_Landroid_window_InputTransferToken_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)]
public virtual bool TransferTouchGesture (Android.Window.InputTransferToken transferFromToken, Android.Window.InputTransferToken transferToToken);
[<Android.Runtime.Register("transferTouchGesture", "(Landroid/window/InputTransferToken;Landroid/window/InputTransferToken;)Z", "GetTransferTouchGesture_Landroid_window_InputTransferToken_Landroid_window_InputTransferToken_Handler:Android.Views.IWindowManager, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=35)>]
abstract member TransferTouchGesture : Android.Window.InputTransferToken * Android.Window.InputTransferToken -> bool
override this.TransferTouchGesture : Android.Window.InputTransferToken * Android.Window.InputTransferToken -> bool
Parameters
- transferFromToken
- InputTransferToken
the InputTransferToken for the currently active gesture
- transferToToken
- InputTransferToken
the InputTransferToken to transfer the gesture to.
Returns
Whether the touch stream was transferred.
- Attributes
Remarks
Transfer the currently in progress touch gesture from the transferFromToken to the transferToToken.
<br> This requires that the fromToken and toToken are associated with each other. The association can be done different ways, depending on how the embedded window is created. <ul> <li> Creating a SurfaceControlViewHost
and passing the host's InputTransferToken
for SurfaceControlViewHost#SurfaceControlViewHost(Context, Display, InputTransferToken)
. </li> <li> Registering a SurfaceControl for input and passing the host's token to either #registerBatchedSurfaceControlInputReceiver(InputTransferToken, SurfaceControl, Choreographer, SurfaceControlInputReceiver)
or #registerUnbatchedSurfaceControlInputReceiver(InputTransferToken, SurfaceControl, Looper, SurfaceControlInputReceiver)
. </li> </ul>
The host is likely to be an AttachedSurfaceControl
so the host token can be retrieved via AttachedSurfaceControl#getInputTransferToken()
.
<br> Only the window currently receiving touch is allowed to transfer the gesture so if the caller attempts to transfer touch gesture from a token that doesn't have touch, it will fail the transfer.
<br> When the host wants to transfer touch gesture to the embedded, it can retrieve the embedded token via SurfaceControlViewHost.SurfacePackage#getInputTransferToken()
or use the value returned from either #registerBatchedSurfaceControlInputReceiver(InputTransferToken, SurfaceControl, Choreographer, SurfaceControlInputReceiver)
or #registerUnbatchedSurfaceControlInputReceiver(InputTransferToken, SurfaceControl, Looper, SurfaceControlInputReceiver)
and pass its own token as the transferFromToken.
When the embedded wants to transfer touch gesture to the host, it can pass in its own token as the transferFromToken and use the associated host's InputTransferToken
as the transferToToken
<br> When the touch is transferred, the window currently receiving touch gets an ACTION_CANCEL and does not receive any further input events for this gesture.
The transferred-to window receives an ACTION_DOWN event and then the remainder of the input events for this gesture. It does not receive any of the previous events of this gesture that the originating window received.
The transferTouchGesture API only works for the current gesture. When a new gesture arrives, input dispatcher will do a new round of hit testing. So, if the host window is still the first thing that's being touched, then it will receive the new gesture again. It will again be up to the host to transfer this new gesture to the embedded.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.