示例#1
0
        protected override void OnAttached()
        {
            host = Touch.GetHost(Element);
            View.UserInteractionEnabled = true;
            _layer = new UIView
            {
                UserInteractionEnabled = false,
                Opaque = false,
                Alpha  = 0,
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            gestureTap = new UILongPressGestureRecognizer(OnTap);
            gestureTap.MinimumPressDuration = 0;
            gestureTap.Delegate             = new TouchGestureDelegate(View);

            TimerInit();
            UpdateEffectColor();

            View.AddGestureRecognizer(gestureTap);
            View.AddSubview(_layer);
            View.BringSubviewToFront(_layer);

            _layer.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active       = true;
            _layer.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active     = true;
            _layer.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true;
            _layer.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active   = true;
        }
示例#2
0
 protected override void OnAttached()
 {
     if (View != null)
     {
         host              = Touch.GetHost(Element);
         View.Tapped      += OnTapped;
         View.RightTapped += OnRightTapped;
     }
 }
示例#3
0
        protected override void OnAttached()
        {
            host = Touch.GetHost(Element);

            if (host.CommandLongTapItem != null)
            {
                timer          = new System.Timers.Timer();
                timer.Elapsed += OnTimerEvent;
            }
            //View.Clickable = true;
            //View.LongClickable = true;
            //View.SoundEffectsEnabled = true;

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

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

            SetEffectColor();
            View.Clickable           = true;
            View.SoundEffectsEnabled = true;
            View.Touch += OnTouch;
            //View.SetOnTouchListener(new ClassClick());
            //View.SetOnLongClickListener(new ClassLongClick());

            Container.AddView(viewOverlay);
            viewOverlay.BringToFront();
        }