예제 #1
0
        protected override void OnAttached()
        {
            isCanTouch       = Touch.GetIsEnabled(Element);
            commandStartTap  = Touch.GetStartTap(Element);
            commandFinishTap = Touch.GetFinishTap(Element);
            commandTap       = Touch.GetTap(Element);
            commandLongTap   = Touch.GetLongTap(Element);
            longTapLatency   = Touch.GetLongTapLatency(Element);
            gestureTap       = new GestureTouchSam(OnTap);
            gestureTap.MinimumPressDuration = 0;
            gestureTap.ShouldReceiveTouch  += (UIGestureRecognizer g, UITouch t) =>
            {
                return(true);
            };
            gestureTap.ShouldRecognizeSimultaneously += (UIGestureRecognizer g, UIGestureRecognizer t) =>
            {
                return(true);
            };

            if (commandLongTap != null)
            {
                TimerInit();
            }

            View.UserInteractionEnabled = true;
            View.AddGestureRecognizer(gestureTap);

            UpdateEffectColor();
        }
예제 #2
0
        protected override void OnAttached()
        {
            if (Touch.GetLongTap(Element) != null)
            {
                timer          = new System.Timers.Timer();
                timer.Elapsed += OnTimerEvent;
            }
            isEnabled                = Touch.GetIsEnabled(Element);
            View.Clickable           = true;
            View.LongClickable       = true;
            View.SoundEffectsEnabled = true;

            viewOverlay = new FrameLayout(Container.Context)
            {
                LayoutParameters = new ViewGroup.LayoutParams(-1, -1),
                Clickable        = false,
                Focusable        = false,
            };
            Container.LayoutChange += ViewOnLayoutChange;

            if (EnableRipple)
            {
                viewOverlay.Background = CreateRipple(color);
            }

            SetEffectColor();
            View.Touch += OnTouch;

            Container.AddView(viewOverlay);
            viewOverlay.BringToFront();
        }
예제 #3
0
 protected override void OnAttached()
 {
     if (View != null)
     {
         View.PointerPressed  += OnPointerPressed;
         View.PointerReleased += OnPointerReleased;
         View.PointerExited   += OnPointerExited;
         isCanTouch            = Touch.GetIsEnabled(Element);
     }
 }
예제 #4
0
        protected override void OnElementPropertyChanged(PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(e);

            if (e.PropertyName == Touch.ColorProperty.PropertyName)
            {
                SetEffectColor();
            }
            else if (e.PropertyName == Touch.IsEnabledProperty.PropertyName)
            {
                isEnabled = Touch.GetIsEnabled(Element);
            }
        }
예제 #5
0
        protected override void OnElementPropertyChanged(PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(e);

            if (e.PropertyName == Touch.IsEnabledProperty.PropertyName)
            {
                isCanTouch = Touch.GetIsEnabled(Element);

                if (!isCanTouch && isPressed)
                {
                    EndAnimationTap();
                }
            }
        }
예제 #6
0
        protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(e);

            if (e.PropertyName == Touch.IsEnabledProperty.PropertyName)
            {
                isCanTouch = Touch.GetIsEnabled(Element);
            }
            else if (e.PropertyName == Touch.ColorProperty.PropertyName)
            {
                UpdateEffectColor();
            }
            else if (e.PropertyName == Touch.TapProperty.PropertyName)
            {
                commandTap = Touch.GetTap(Element);
            }
            else if (e.PropertyName == Touch.StartTapProperty.PropertyName)
            {
                commandStartTap = Touch.GetStartTap(Element);
            }
            else if (e.PropertyName == Touch.FinishTapProperty.PropertyName)
            {
                commandFinishTap = Touch.GetFinishTap(Element);
            }
            else if (e.PropertyName == Touch.LongTapProperty.PropertyName)
            {
                commandLongTap = Touch.GetLongTap(Element);
                if (commandLongTap == null)
                {
                    TimerDispose();
                }
                else
                {
                    TimerInit();
                }
            }
            else if (e.PropertyName == Touch.LongTapLatencyProperty.PropertyName)
            {
                longTapLatency = Touch.GetLongTapLatency(Element);
            }
        }