Exemplo n.º 1
0
        private ImageView CreateThumb()
        {
            if (null == thumbImage)
            {
                thumbImage = new ImageView()
                {
                    WidthResizePolicy      = ResizePolicyType.Fixed,
                    HeightResizePolicy     = ResizePolicyType.Fixed,
                    ParentOrigin           = NUI.ParentOrigin.Center,
                    PivotPoint             = NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true
                };
                if (slidedTrackImage != null)
                {
                    slidedTrackImage.Add(thumbImage);
                }
                thumbImage.TouchEvent += OnTouchEventForThumb;

                panGestureDetector = new PanGestureDetector();
                panGestureDetector.Attach(thumbImage);
                panGestureDetector.Detected += OnPanGestureDetected;
            }

            return(thumbImage);
        }
Exemplo n.º 2
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                StopScroll();

                if (mPanGestureDetector != null)
                {
                    mPanGestureDetector.Detected -= OnPanGestureDetected;
                    mPanGestureDetector.Dispose();
                    mPanGestureDetector = null;
                }

                if (mTapGestureDetector != null)
                {
                    mTapGestureDetector.Detected -= OnTapGestureDetected;
                    mTapGestureDetector.Dispose();
                    mTapGestureDetector = null;
                }
            }
            base.Dispose(type);
        }
Exemplo n.º 3
0
        public ScrollableBase() : base()
        {
            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            mPanGestureDetector.Detected += OnPanGestureDetected;

            mTapGestureDetector = new TapGestureDetector();
            mTapGestureDetector.Attach(this);
            mTapGestureDetector.Detected += OnTapGestureDetected;


            ClippingMode = ClippingModeType.ClipToBoundingBox;

            mScrollingChild = new View();
            mScrollingChild.Name = "DefaultScrollingChild";

            //Interrupt touching when panning is started;
            mInterruptTouchingChild = new View()
            {
                Name = "InterruptTouchingChild",
                Size = new Size(Window.Instance.WindowSize),
                BackgroundColor = Color.Transparent,
            };

            mInterruptTouchingChild.TouchEvent += (object source, View.TouchEventArgs args) => {
                return true;
            };

            Layout = new ScrollableBaseCustomLayout();
        }
Exemplo n.º 4
0
        public void PanGestureDetectorLocalPosition()
        {
            tlog.Debug(tag, $"PanGestureDetectorLocalPosition START");
            PanGestureDetector a1 = new PanGestureDetector();
            Vector2            v1 = a1.LocalPosition;

            tlog.Debug(tag, $"PanGestureDetectorLocalPosition END (OK)");
            Assert.Pass("PanGestureDetectorLocalPosition");
        }
Exemplo n.º 5
0
        public void PanGestureDetectorLocalDisplacement()
        {
            tlog.Debug(tag, $"PanGestureDetectorLocalDisplacement START");
            PanGestureDetector a1 = new PanGestureDetector();
            Vector2            v1 = a1.LocalDisplacement;

            tlog.Debug(tag, $"PanGestureDetectorLocalDisplacement END (OK)");
            Assert.Pass("PanGestureDetectorLocalDisplacement");
        }
Exemplo n.º 6
0
        public void PanGestureDetectorPanning()
        {
            tlog.Debug(tag, $"PanGestureDetectorPanning START");
            PanGestureDetector a1 = new PanGestureDetector();
            bool b1 = a1.Panning;

            tlog.Debug(tag, $"PanGestureDetectorPanning END (OK)");
            Assert.Pass("PanGestureDetectorPanning");
        }
Exemplo n.º 7
0
        public void PanGestureDetectorLocalVelocity()
        {
            tlog.Debug(tag, $"PanGestureDetectorLocalVelocity START");
            PanGestureDetector a1 = new PanGestureDetector();
            Vector2            v1 = a1.LocalVelocity;

            tlog.Debug(tag, $"PanGestureDetectorLocalVelocity END (OK)");
            Assert.Pass("PanGestureDetectorLocalVelocity");
        }
Exemplo n.º 8
0
        public void PanGestureDetectorSetMaximumTouchesRequired()
        {
            tlog.Debug(tag, $"PanGestureDetectorSetMaximumTouchesRequired START");
            PanGestureDetector a1 = new PanGestureDetector();

            a1.SetMaximumTouchesRequired(4);

            tlog.Debug(tag, $"PanGestureDetectorSetMaximumTouchesRequired END (OK)");
            Assert.Pass("PanGestureDetectorSetMaximumTouchesRequired");
        }
Exemplo n.º 9
0
        public void PanGestureDetectorSetPanGestureProperties()
        {
            tlog.Debug(tag, $"PanGestureDetectorSetPanGestureProperties START");
            PanGesture pan = new PanGesture();

            PanGestureDetector.SetPanGestureProperties(pan);

            tlog.Debug(tag, $"PanGestureDetectorSetPanGestureProperties END (OK)");
            Assert.Pass("PanGestureDetectorClearAngles");
        }
Exemplo n.º 10
0
        internal PanGestureDetector GetPanGestureDetector()
        {
            PanGestureDetector ret = new PanGestureDetector(Interop.ViewInternal.View_GetPanGestureDetector(swigCPtr), true);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 11
0
        public SwipeViewTest2Page()
        {
            InitializeComponent();

            panGestureDetector = new PanGestureDetector();
            panGestureDetector.Attach(text1View);
            panGestureDetector.Attach(text2View);
            panGestureDetector.Detected += (obj, e) =>
            {
                Vector2 velocity = e.PanGesture.Velocity;
                View    view     = e.View;
                if (view != null)
                {
                    if (e.PanGesture.State == Gesture.StateType.Started)
                    {
                        init1Position = text1View.Position;
                        init2Position = text2View.Position;
                    }
                    else if (e.PanGesture.State == Gesture.StateType.Finished || e.PanGesture.State == Gesture.StateType.Cancelled)
                    {
                        if (view.Position.X < -110)
                        {
                            var button = new Button()
                            {
                                Text = "Cancel",
                            };

                            button.Clicked += (object s, ClickedEventArgs a) =>
                            {
                                Navigator?.Pop();
                            };

                            if (view == text1View)
                            {
                                DialogPage.ShowAlertDialog("SwipeView", "SwipeItemView Invoked", button);
                            }
                            else if (view == text2View)
                            {
                                DialogPage.ShowAlertDialog("SwipeView", "SwipeItemView Command Executed", button);
                            }
                        }

                        text1View.Position = init1Position;
                        text2View.Position = init2Position;
                    }
                    else
                    {
                        if (velocity.X < 0 && view.Position.X > -140)
                        {
                            view.Position += new Position(e.PanGesture.ScreenDisplacement.X, 0, 0);
                        }
                    }
                }
            };
        }
Exemplo n.º 12
0
        private void Initialize()
        {
            currentSlidedOffset     = 0;
            isFocused               = false;
            isPressed               = false;
            LayoutDirectionChanged += OnLayoutDirectionChanged;

            panGestureDetector = new PanGestureDetector();
            panGestureDetector.Attach(this);
            panGestureDetector.Detected += OnPanGestureDetected;
        }
Exemplo n.º 13
0
        public void PanGestureDetectorGetPanGestureDetectorFromPtr()
        {
            tlog.Debug(tag, $"PanGestureDetectorGetPanGestureDetectorFromPtr START");
            PanGestureDetector a1 = new PanGestureDetector();

            PanGestureDetector.GetPanGestureDetectorFromPtr(PanGestureDetector.getCPtr(a1).Handle);
            a1.Dispose();

            tlog.Debug(tag, $"PanGestureDetectorGetPanGestureDetectorFromPtr END (OK)");
            Assert.Pass("PanGestureDetectorGetPanGestureDetectorFromPtr");
        }
Exemplo n.º 14
0
        public void PanGestureDetectorAddAngle()
        {
            tlog.Debug(tag, $"PanGestureDetectorAddAngle START");
            PanGestureDetector a1        = new PanGestureDetector();
            Radian             angle     = new Radian(4);
            Radian             threshold = new Radian(15);

            a1.AddAngle(angle);
            a1.AddAngle(angle, threshold);
            tlog.Debug(tag, $"PanGestureDetectorAddAngle END (OK)");
            Assert.Pass("PanGestureDetectorAddAngle");
        }
Exemplo n.º 15
0
        public void PanGestureDetectorDetected()
        {
            tlog.Debug(tag, $"PanGestureDetectorDetected START");
            PanGestureDetector a1 = new PanGestureDetector();

            a1.Detected += OnDetected;
            a1.Detected -= OnDetected;

            a1.Dispose();
            tlog.Debug(tag, $"PanGestureDetectorDetected END (OK)");
            Assert.Pass("PanGestureDetectorDetected");
        }
Exemplo n.º 16
0
        public void PanGestureDetectorConstructor()
        {
            tlog.Debug(tag, $"PanGestureDetectorConstructor START");
            PanGestureDetector a1 = new PanGestureDetector();
            PanGestureDetector a2 = new PanGestureDetector(a1);

            a1.Dispose();
            a2.Dispose();

            tlog.Debug(tag, $"PanGestureDetectorConstructor END (OK)");
            Assert.Pass("PanGestureDetectorConstructor");
        }
Exemplo n.º 17
0
        private void init(View view)
        {
            mTapGestureDetector   = new TapGestureDetector();
            mLongGestureDetector  = new LongPressGestureDetector();
            mPanGestureDetector   = new PanGestureDetector();
            mPinchGestureDetector = new PinchGestureDetector();

            mTapGestureDetector.Attach(view);
            mLongGestureDetector.Attach(view);
            mPanGestureDetector.Attach(view);
            mPinchGestureDetector.Attach(view);
        }
Exemplo n.º 18
0
        public void PanGestureDetectorConstructor()
        {
            tlog.Debug(tag, $"PanGestureDetectorConstructor START");

            var testingTarget = new PanGestureDetector();

            Assert.IsNotNull(testingTarget, "Can't create success object Hover");
            Assert.IsInstanceOf <PanGestureDetector>(testingTarget, "Should be an instance of PanGestureDetector type.");

            testingTarget.Dispose();
            tlog.Debug(tag, $"PanGestureDetectorConstructor END (OK)");
            Assert.Pass("PanGestureDetectorConstructor");
        }
Exemplo n.º 19
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (layout != null)
                {
                    layout.StopScroll(false);
                    layout.ClearRecyclerView();
                    layout = null;
                }

                if (adapter != null)
                {
                    adapter.ItemEvent -= OnItemEvent;
                }

                if (panGestureDetector != null)
                {
                    panGestureDetector.Detected -= OnPanGestureDetected;
                    panGestureDetector.Dispose();
                    panGestureDetector = null;
                }

                if (scrollBarShowTimer != null)
                {
                    scrollBarShowTimer.Tick -= OnShowTimerTick;
                    scrollBarShowTimer.Stop();
                    scrollBarShowTimer.Dispose();
                    scrollBarShowTimer = null;
                }

                if (recyclerPool != null)
                {
                    recyclerPool.Clear();
                    recyclerPool = null;
                }

                if (childHelper != null)
                {
                    childHelper.Clear();
                    childHelper.Dispose();
                    childHelper = null;
                }
            }
            base.Dispose(type);
        }
Exemplo n.º 20
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (mLayout != null)
                {
                    mLayout.StopScroll(false);
                    mLayout.ClearRecyclerView();
                    mLayout = null;
                }

                if (mAdapter != null)
                {
                    mAdapter.ItemEvent -= OnItemEvent;
                }

                if (mPanGestureDetector != null)
                {
                    mPanGestureDetector.Detected -= OnPanGestureDetected;
                    mPanGestureDetector.Dispose();
                    mPanGestureDetector = null;
                }

                if (mScrollBarShowTimer != null)
                {
                    mScrollBarShowTimer.Tick -= OnShowTimerTick;
                    mScrollBarShowTimer.Stop();
                    mScrollBarShowTimer.Dispose();
                    mScrollBarShowTimer = null;
                }

                if (mRecyclerPool != null)
                {
                    mRecyclerPool.Clear();
                    mRecyclerPool = null;
                }

                if (mChildHelper != null)
                {
                    mChildHelper.Clear();
                    mChildHelper.Dispose();
                    mChildHelper = null;
                }
            }
            base.Dispose(type);
        }
Exemplo n.º 21
0
        public void PanGestureDetectorClearAngles()
        {
            tlog.Debug(tag, $"PanGestureDetectorClearAngles START");
            PanGestureDetector a1 = new PanGestureDetector();

            Radian angle = new Radian(4);

            a1.AddAngle(angle);

            a1.ClearAngles();

            tlog.Debug(tag, $"PanGestureDetectorClearAngles END (OK)");
            Assert.Pass("PanGestureDetectorClearAngles");
        }
Exemplo n.º 22
0
        public void PanGestureDetectorScreenDisplacement()
        {
            tlog.Debug(tag, $"PanGestureDetectorScreenDisplacement START");

            var testingTarget = new PanGestureDetector();

            Assert.IsNotNull(testingTarget, "Can't create success object Hover");
            Assert.IsInstanceOf <PanGestureDetector>(testingTarget, "Should be an instance of PanGestureDetector type.");

            tlog.Debug(tag, "ScreenDisplacement : " + testingTarget.ScreenDisplacement);

            tlog.Debug(tag, $"PanGestureDetectorScreenDisplacement END (OK)");
            Assert.Pass("PanGestureDetectorScreenDisplacement");
        }
Exemplo n.º 23
0
        public void PanGestureDetectorRemoveDirection()
        {
            tlog.Debug(tag, $"PanGestureDetectorRemoveDirection START");
            PanGestureDetector a1 = new PanGestureDetector();

            Radian angle = new Radian(4);

            a1.AddDirection(angle);

            a1.RemoveDirection(angle);

            tlog.Debug(tag, $"PanGestureDetectorRemoveDirection END (OK)");
            Assert.Pass("PanGestureDetectorClearAngles");
        }
Exemplo n.º 24
0
        public void PanGestureDetectorGetAngleCount()
        {
            tlog.Debug(tag, $"PanGestureDetectorGetAngleCount START");
            PanGestureDetector a1 = new PanGestureDetector();

            Radian angle = new Radian(4);

            a1.AddAngle(angle);

            a1.GetAngleCount();

            tlog.Debug(tag, $"PanGestureDetectorGetAngleCount END (OK)");
            Assert.Pass("PanGestureDetectorAddDirection");
        }
Exemplo n.º 25
0
        public void PanGestureDetectorLocalVelocity()
        {
            tlog.Debug(tag, $"PanGestureDetectorLocalVelocity START");

            var testingTarget = new PanGestureDetector();

            Assert.IsNotNull(testingTarget, "Can't create success object Hover");
            Assert.IsInstanceOf <PanGestureDetector>(testingTarget, "Should be an instance of PanGestureDetector type.");

            tlog.Debug(tag, "LocalVelocity : " + testingTarget.LocalVelocity);

            tlog.Debug(tag, $"PanGestureDetectorLocalVelocity END (OK)");
            Assert.Pass("PanGestureDetectorLocalVelocity");
        }
Exemplo n.º 26
0
        private void Initialize()
        {
            AccessibilityHighlightable = true;

            currentSlidedOffset     = 0;
            isFocused               = false;
            isPressed               = false;
            LayoutDirectionChanged += OnLayoutDirectionChanged;

            this.TouchEvent += OnTouchEventForTrack;

            panGestureDetector = new PanGestureDetector();
            panGestureDetector.Attach(this);
            panGestureDetector.Detected += OnPanGestureDetected;
        }
Exemplo n.º 27
0
        public RotarySelector()
        {
            rotarySelectorManager = new RotarySelectorManager(new Size(360, 360));
            this.Add(rotarySelectorManager.GetRotaryPagination());
            this.Add(rotarySelectorManager.GetRotaryLayerView());

            longPressDetector           = new LongPressGestureDetector();
            longPressDetector.Detected += Detector_Detected;
            longPressDetector.Attach(rotarySelectorManager.GetRotaryLayerView().GetMainText());

            panDetector = new PanGestureDetector();
            panDetector.Attach(this);
            panDetector.Detected += PanDetector_Detected;

            this.WheelEvent += RotarySelector_WheelEvent;
        }
Exemplo n.º 28
0
        public PanGestureTest1Page()
        {
            InitializeComponent();

            mPanDetector = new PanGestureDetector();
            mPanDetector.Attach(imageView);

            mPanDetector.Detected += (obj, e) =>
            {
                View view = e.View;
                if (view != null)
                {
                    view.Position += new Position(e.PanGesture.ScreenDisplacement.X, e.PanGesture.ScreenDisplacement.Y, 0);
                }
            };
        }
Exemplo n.º 29
0
        public FlexibleView()
        {
            mRecyclerPool = new RecycledViewPool(this);

            mRecycler = new FlexibleViewRecycler(this);
            mRecycler.SetRecycledViewPool(mRecyclerPool);

            mChildHelper = new ChildHelper(this);

            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.Detected += OnPanGestureDetected;

            mAdapteHelper = new AdapterHelper(this);

            ClippingMode = ClippingModeType.ClipToBoundingBox;
        }
Exemplo n.º 30
0
        public ScrollableBase() : base()
        {
            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            mPanGestureDetector.Detected += OnPanGestureDetected;

            mTapGestureDetector = new TapGestureDetector();
            mTapGestureDetector.Attach(this);
            mTapGestureDetector.Detected += OnTapGestureDetected;

            ClippingMode = ClippingModeType.ClipToBoundingBox;

            mScrollingChild = new View();

            Layout = new ScrollableBaseCustomLayout();
        }