예제 #1
0
        public void PanGestureDetectorAddDirection()
        {
            tlog.Debug(tag, $"PanGestureDetectorAddDirection START");
            PanGestureDetector a1 = new PanGestureDetector();

            Radian angle     = new Radian(4);
            Radian threshold = new Radian(15);

            a1.AddDirection(angle);

            a1.AddDirection(angle, threshold);


            tlog.Debug(tag, $"PanGestureDetectorAddDirection END (OK)");
            Assert.Pass("PanGestureDetectorAddDirection");
        }
예제 #2
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();
        }
예제 #3
0
        public void SetLayoutManager(FlexibleViewLayoutManager layoutManager)
        {
            if (null == layoutManager)
            {
                return;
            }
            mLayout = layoutManager;

            mLayout.SetRecyclerView(this);

            if (mLayout.CanScrollHorizontally())
            {
                mPanGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
            }
            else if (mLayout.CanScrollVertically())
            {
                mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            }
        }
예제 #4
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");
        }
예제 #5
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();
        }
예제 #6
0
        public ScrollableBase() : base()
        {
            base.Layout         = new ScrollableBaseCustomLayout();
            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
            mPanGestureDetector.Detected += OnPanGestureDetected;

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

            ClippingMode = ClippingModeType.ClipChildren;

            //Default Scrolling child
            ContentContainer = new View()
            {
                WidthSpecification  = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.MatchParent : LayoutParamPolicies.WrapContent,
                HeightSpecification = ScrollingDirection == Direction.Vertical ? LayoutParamPolicies.WrapContent : LayoutParamPolicies.MatchParent,
                Layout = new AbsoluteLayout()
                {
                    SetPositionByLayout = false
                },
            };
            ContentContainer.Relayout     += OnScrollingChildRelayout;
            propertyNotification           = ContentContainer.AddPropertyNotification("position", PropertyCondition.Step(1.0f));
            propertyNotification.Notified += OnPropertyChanged;
            base.Add(ContentContainer);

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

            Scrollbar = new Scrollbar();
        }
예제 #7
0
 // Relayout basic component: track, thumb and indicator
 private void RelayoutBaseComponent(bool isInitial = true)
 {
     if (direction == DirectionType.Horizontal)
     {
         if (slidedTrackImage != null)
         {
             slidedTrackImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             slidedTrackImage.PivotPoint             = NUI.PivotPoint.CenterLeft;
             slidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (warningTrackImage != null)
         {
             warningTrackImage.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             warningTrackImage.PivotPoint             = NUI.PivotPoint.CenterRight;
             warningTrackImage.PositionUsesPivotPoint = true;
         }
         if (warningSlidedTrackImage != null)
         {
             warningSlidedTrackImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             warningSlidedTrackImage.PivotPoint             = NUI.PivotPoint.CenterLeft;
             warningSlidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (thumbImage != null)
         {
             thumbImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             thumbImage.PivotPoint             = NUI.PivotPoint.Center;
             thumbImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorImage != null)
         {
             lowIndicatorImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             lowIndicatorImage.PivotPoint             = NUI.PivotPoint.CenterLeft;
             lowIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (highIndicatorImage != null)
         {
             highIndicatorImage.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             highIndicatorImage.PivotPoint             = NUI.PivotPoint.CenterRight;
             highIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorText != null)
         {
             lowIndicatorText.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             lowIndicatorText.PivotPoint             = NUI.PivotPoint.CenterLeft;
             lowIndicatorText.PositionUsesPivotPoint = true;
         }
         if (highIndicatorText != null)
         {
             highIndicatorText.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             highIndicatorText.PivotPoint             = NUI.PivotPoint.CenterRight;
             highIndicatorText.PositionUsesPivotPoint = true;
         }
         if (valueIndicatorImage != null)
         {
             valueIndicatorImage.ParentOrigin           = NUI.ParentOrigin.TopLeft;
             valueIndicatorImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             valueIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (valueIndicatorText != null)
         {
             valueIndicatorText.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             valueIndicatorText.PivotPoint             = NUI.PivotPoint.TopCenter;
             valueIndicatorText.PositionUsesPivotPoint = true;
             valueIndicatorText.Padding = new Extents(0, 0, 5, 0); // TODO : How to set the text as center
         }
         if (panGestureDetector != null)
         {
             if (!isInitial)
             {
                 panGestureDetector.RemoveDirection(PanGestureDetector.DirectionVertical);
             }
             panGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
         }
     }
     else if (direction == DirectionType.Vertical)
     {
         if (slidedTrackImage != null)
         {
             slidedTrackImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             slidedTrackImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             slidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (warningTrackImage != null)
         {
             warningTrackImage.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             warningTrackImage.PivotPoint             = NUI.PivotPoint.TopCenter;
             warningTrackImage.PositionUsesPivotPoint = true;
         }
         if (warningSlidedTrackImage != null)
         {
             warningSlidedTrackImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             warningSlidedTrackImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             warningSlidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (thumbImage != null)
         {
             thumbImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             thumbImage.PivotPoint             = NUI.PivotPoint.Center;
             thumbImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorImage != null)
         {
             lowIndicatorImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             lowIndicatorImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             lowIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (highIndicatorImage != null)
         {
             highIndicatorImage.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             highIndicatorImage.PivotPoint             = NUI.PivotPoint.TopCenter;
             highIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorText != null)
         {
             lowIndicatorText.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             lowIndicatorText.PivotPoint             = NUI.PivotPoint.BottomCenter;
             lowIndicatorText.PositionUsesPivotPoint = true;
         }
         if (highIndicatorText != null)
         {
             highIndicatorText.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             highIndicatorText.PivotPoint             = NUI.PivotPoint.TopCenter;
             highIndicatorText.PositionUsesPivotPoint = true;
         }
         if (valueIndicatorImage != null)
         {
             valueIndicatorImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             valueIndicatorImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             valueIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (valueIndicatorText != null)
         {
             valueIndicatorText.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             valueIndicatorText.PivotPoint             = NUI.PivotPoint.TopCenter;
             valueIndicatorText.PositionUsesPivotPoint = true;
             valueIndicatorText.Padding = new Extents(0, 0, 5, 0); // TODO : How to set the text as center
         }
         if (panGestureDetector != null)
         {
             if (!isInitial)
             {
                 panGestureDetector.RemoveDirection(PanGestureDetector.DirectionHorizontal);
             }
             panGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
         }
     }
 }
예제 #8
0
 // Relayout basic component: track, thumb and indicator
 private void RelayoutBaseComponent(bool isInitial = true)
 {
     if (direction == DirectionType.Horizontal)
     {
         if (slidedTrackImage != null)
         {
             slidedTrackImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             slidedTrackImage.PivotPoint             = NUI.PivotPoint.CenterLeft;
             slidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (thumbImage != null)
         {
             thumbImage.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             thumbImage.PivotPoint             = NUI.PivotPoint.Center;
             thumbImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorImage != null)
         {
             lowIndicatorImage.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             lowIndicatorImage.PivotPoint             = NUI.PivotPoint.CenterLeft;
             lowIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (highIndicatorImage != null)
         {
             highIndicatorImage.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             highIndicatorImage.PivotPoint             = NUI.PivotPoint.CenterRight;
             highIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorText != null)
         {
             lowIndicatorText.ParentOrigin           = NUI.ParentOrigin.CenterLeft;
             lowIndicatorText.PivotPoint             = NUI.PivotPoint.CenterLeft;
             lowIndicatorText.PositionUsesPivotPoint = true;
         }
         if (highIndicatorText != null)
         {
             highIndicatorText.ParentOrigin           = NUI.ParentOrigin.CenterRight;
             highIndicatorText.PivotPoint             = NUI.PivotPoint.CenterRight;
             highIndicatorText.PositionUsesPivotPoint = true;
         }
         if (panGestureDetector != null)
         {
             if (!isInitial)
             {
                 panGestureDetector.RemoveDirection(PanGestureDetector.DirectionVertical);
             }
             panGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
         }
     }
     else if (direction == DirectionType.Vertical)
     {
         if (slidedTrackImage != null)
         {
             slidedTrackImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             slidedTrackImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             slidedTrackImage.PositionUsesPivotPoint = true;
         }
         if (thumbImage != null)
         {
             thumbImage.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             thumbImage.PivotPoint             = NUI.PivotPoint.Center;
             thumbImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorImage != null)
         {
             lowIndicatorImage.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             lowIndicatorImage.PivotPoint             = NUI.PivotPoint.BottomCenter;
             lowIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (highIndicatorImage != null)
         {
             highIndicatorImage.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             highIndicatorImage.PivotPoint             = NUI.PivotPoint.TopCenter;
             highIndicatorImage.PositionUsesPivotPoint = true;
         }
         if (lowIndicatorText != null)
         {
             lowIndicatorText.ParentOrigin           = NUI.ParentOrigin.BottomCenter;
             lowIndicatorText.PivotPoint             = NUI.PivotPoint.BottomCenter;
             lowIndicatorText.PositionUsesPivotPoint = true;
         }
         if (highIndicatorText != null)
         {
             highIndicatorText.ParentOrigin           = NUI.ParentOrigin.TopCenter;
             highIndicatorText.PivotPoint             = NUI.PivotPoint.TopCenter;
             highIndicatorText.PositionUsesPivotPoint = true;
         }
         if (panGestureDetector != null)
         {
             if (!isInitial)
             {
                 panGestureDetector.RemoveDirection(PanGestureDetector.DirectionHorizontal);
             }
             panGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
         }
     }
 }