blob: 54afd3670d4ab721ac5addec9a7e9e0e8c477dba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using Android.Views;
namespace Xamarin.Forms.Platform.Android
{
internal class MotionEventHelper
{
VisualElement _element;
bool _isInViewCell;
public bool HandleMotionEvent(IViewParent parent, MotionEvent motionEvent)
{
if (_isInViewCell || _element.InputTransparent || motionEvent.Action == MotionEventActions.Cancel)
{
return false;
}
var renderer = parent as Platform.DefaultRenderer;
if (renderer == null)
{
return false;
}
// Let the container know that we're "fake" handling this event
renderer.NotifyFakeHandling();
return true;
}
public void UpdateElement(VisualElement element)
{
_isInViewCell = false;
_element = element;
if (_element == null)
{
return;
}
// Determine whether this control is inside a ViewCell;
// we don't fake handle the events because ListView needs them for row selection
_isInViewCell = element.IsInViewCell();
}
}
}
|