예제 #1
0
        GestureDetector InitializeTapAndPanDetector()
        {
            var listener = new InnerGestureListener(new TapGestureHandler(() => View),
                                                    new PanGestureHandler(() => View, Control.Context.FromPixels));

            return(new GestureDetector(listener));
        }
예제 #2
0
        GestureDetector InitializeTapAndPanAndSwipeDetector()
        {
            var context  = Control.Context;
            var listener = new InnerGestureListener(new TapGestureHandler(() => View),
                                                    new PanGestureHandler(() => View, context.FromPixels),
                                                    new SwipeGestureHandler(() => View, context.FromPixels));

            return(new GestureDetector(context, listener));
        }
예제 #3
0
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);

                if (disposing)
                {
                    if (_listener != null)
                    {
                        _listener.Dispose();
                        _listener = null;
                    }
                }
            }
        protected VisualElementRenderer() : base(Forms.Context)
        {
            _tapGestureHandler   = new TapGestureHandler(() => View);
            _panGestureHandler   = new PanGestureHandler(() => View, Context.FromPixels);
            _pinchGestureHandler = new PinchGestureHandler(() => View);

            _gestureDetector =
                new Lazy <GestureDetector>(
                    () =>
                    new GestureDetector(
                        _gestureListener =
                            new InnerGestureListener(_tapGestureHandler.OnTap, _tapGestureHandler.TapGestureRecognizers, _panGestureHandler.OnPan, _panGestureHandler.OnPanStarted, _panGestureHandler.OnPanComplete)));

            _scaleDetector = new Lazy <ScaleGestureDetector>(
                () => new ScaleGestureDetector(Context, new InnerScaleListener(_pinchGestureHandler.OnPinch, _pinchGestureHandler.OnPinchStarted, _pinchGestureHandler.OnPinchEnded))
                );
        }
예제 #5
0
 public TapAndPanGestureDetector(Context context, InnerGestureListener listener) : base(context, listener)
 {
     _listener = listener;
     UpdateLongPressSettings();
 }
        protected override void Dispose(bool disposing)
        {
            if ((_flags & VisualElementRendererFlags.Disposed) != 0)
            {
                return;
            }
            _flags |= VisualElementRendererFlags.Disposed;

            if (disposing)
            {
                if (Tracker != null)
                {
                    Tracker.Dispose();
                    Tracker = null;
                }

                if (_packager != null)
                {
                    _packager.Dispose();
                    _packager = null;
                }

                if (_scaleDetector != null && _scaleDetector.IsValueCreated)
                {
                    _scaleDetector.Value.Dispose();
                    _scaleDetector = null;
                }

                if (_gestureListener != null)
                {
                    _gestureListener.Dispose();
                    _gestureListener = null;
                }

                if (ManageNativeControlLifetime)
                {
                    int count = ChildCount;
                    for (var i = 0; i < count; i++)
                    {
                        AView child = GetChildAt(i);
                        child.Dispose();
                    }
                }

                RemoveAllViews();

                if (Element != null)
                {
                    Element.PropertyChanged -= _propertyChangeHandler;
                    UnsubscribeGestureRecognizers(Element);

                    if (Platform.GetRenderer(Element) == this)
                    {
                        Platform.SetRenderer(Element, null);
                    }

                    Element = null;
                }
            }

            base.Dispose(disposing);
        }
예제 #7
0
 public TapAndPanGestureDetector(Context context, InnerGestureListener listener) : base(context, listener)
 {
     _listener = listener;
 }