Exemplo n.º 1
0
        private void Initialize()
        {
            Style.IsSelectable = true;
            handlerAni         = new Animation(aniTime);
            trackImage         = new ImageView()
            {
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                PositionUsesPivotPoint = true,
                WidthResizePolicy      = ResizePolicyType.FillToParent,
                HeightResizePolicy     = ResizePolicyType.FillToParent,
                Name = "SwitchBackgroundImage",
            };
            Add(trackImage);
            trackImage.ApplyStyle(Style.Track);

            thumbImage = new ImageView()
            {
                ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.TopLeft,
                PositionUsesPivotPoint = true,
                Name = "SwitchHandlerImage",
            };
            trackImage.Add(thumbImage);
            thumbImage.ApplyStyle(Style.Thumb);
        }
Exemplo n.º 2
0
        private void Initialize()
        {
            this.Focusable = false;

            trackImage = new ImageView
            {
                Focusable              = false,
                WidthResizePolicy      = ResizePolicyType.FillToParent,
                HeightResizePolicy     = ResizePolicyType.FillToParent,
                PositionUsesPivotPoint = true,
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft
            };
            this.Add(trackImage);
            trackImage.ApplyStyle(Style.Track);

            thumbImage = new ImageView
            {
                Focusable              = false,
                WidthResizePolicy      = ResizePolicyType.Fixed,
                HeightResizePolicy     = ResizePolicyType.Fixed,
                PositionUsesPivotPoint = true,
                ParentOrigin           = Tizen.NUI.ParentOrigin.CenterLeft,
                PivotPoint             = Tizen.NUI.PivotPoint.CenterLeft
            };
            this.Add(thumbImage);
            thumbImage.ApplyStyle(Style.Thumb);

            scrollAniPlayer = new Animation(334);
            scrollAniPlayer.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);

            thumbImagePosX          = 0;
            thumbImagePosY          = 0;
            LayoutDirectionChanged += OnLayoutDirectionChanged;
        }
Exemplo n.º 3
0
        public override void ApplyStyle(ViewStyle style)
        {
            base.ApplyStyle(style);

            if (style is ScrollBarStyle scrollBarStyle)
            {
                trackImage.ApplyStyle(scrollBarStyle.Track);
                thumbImage.ApplyStyle(scrollBarStyle.Thumb);
                UpdateValue();
            }
        }
Exemplo n.º 4
0
        private void PlayAnimateTo(FrameData frame, TransitionAnimation transition)
        {
            if (transition != null)
            {
                //ResetImage();
                if (!providerImage)
                {
                    providerImage = new ImageView(transition.DefaultImageStyle);
                    providerImage.ParentOrigin           = transition.DefaultImageStyle.ParentOrigin;
                    providerImage.PivotPoint             = transition.DefaultImageStyle.PivotPoint;
                    providerImage.PositionUsesPivotPoint = true;
                    providerImage.AddRenderer(GetRenderer(frame));
                    if (mainView)
                    {
                        mainView.Add(providerImage);
                        providerImage.LowerToBottom();
                    }
                    else
                    {
                        window.Add(providerImage);
                    }
                }
                else
                {
                    providerImage.ApplyStyle(transition.DefaultImageStyle.Clone());
                }

                providerImage.Show();
                int propertyCount = transition.AnimationDataList.Count;
                animation            = new Animation(transition.DurationMilliSeconds + 80);
                animation.Properties = new string[propertyCount];
                animation.DestValue  = new string[propertyCount];
                animation.StartTime  = new int[propertyCount];
                animation.EndTime    = new int[propertyCount];

                for (int i = 0; i < propertyCount; i++)
                {
                    animation.Properties[i] = transition.AnimationDataList[i].Property;
                    animation.DestValue[i]  = transition.AnimationDataList[i].DestinationValue;
                    animation.StartTime[i]  = 80 + transition.AnimationDataList[i].StartTime;
                    animation.EndTime[i]    = 80 + transition.AnimationDataList[i].EndTime;
                }
                animation.PlayAnimateTo(providerImage);
                animation.Finished += Ani_Finished;
            }
            else
            {
                FinishAnimation();
            }
        }
Exemplo n.º 5
0
        public void AnimationPlayAnimateTo()
        {
            tlog.Debug(tag, $"AnimationPlayAnimateTo START");

            var testingTarget = new Animation(1500);

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <Animation>(testingTarget, "should be an instance of Animation class!");

            TransitionAnimation transition = new TransitionAnimation(300);
            ImageView           view       = new ImageView();

            view.ApplyStyle(transition.DefaultImageStyle.Clone());

            var dummy1 = new TransitionAnimationData()
            {
                Property         = "Size",
                DestinationValue = "100, 100",
                StartTime        = 300,
                EndTime          = 600
            };

            transition.AddAnimationData(dummy1);

            var dummy2 = new TransitionAnimationData()
            {
                Property         = "Position",
                DestinationValue = "150, 250",
                StartTime        = 300,
                EndTime          = 600
            };

            transition.AddAnimationData(dummy2);

            for (int i = 0; i < transition.AnimationDataList.Count; i++)
            {
                testingTarget.PropertyList.Add(transition.AnimationDataList[i].Property);
                testingTarget.DestValueList.Add(transition.AnimationDataList[i].DestinationValue);
                testingTarget.StartTimeList.Add(transition.AnimationDataList[i].StartTime);
                testingTarget.EndTimeList.Add(transition.AnimationDataList[i].EndTime);
            }
            testingTarget.PlayAnimateTo(view);

            view.Dispose();
            transition.Dispose();
            testingTarget.Dispose();
            tlog.Debug(tag, $"AnimationPlayAnimateTo END (OK)");
        }
Exemplo n.º 6
0
 private void InitializeBuffer()
 {
     if (null == bufferImage)
     {
         bufferImage = new ImageView
         {
             WidthResizePolicy      = ResizePolicyType.FillToParent,
             HeightResizePolicy     = ResizePolicyType.FillToParent,
             PositionUsesPivotPoint = true,
             ParentOrigin           = Tizen.NUI.ParentOrigin.TopLeft,
             PivotPoint             = Tizen.NUI.PivotPoint.TopLeft
         };
         Add(bufferImage);
         bufferImage.ApplyStyle(progressStyle.Buffer);
     }
 }
Exemplo n.º 7
0
 private void InitializeTrack()
 {
     if (null == trackImage)
     {
         trackImage = new ImageView
         {
             WidthResizePolicy      = ResizePolicyType.FillToParent,
             HeightResizePolicy     = ResizePolicyType.FillToParent,
             PositionUsesPivotPoint = true,
             ParentOrigin           = NUI.ParentOrigin.TopLeft,
             PivotPoint             = NUI.PivotPoint.TopLeft
         };
         Add(trackImage);
         trackImage.ApplyStyle(progressStyle.Track);
     }
 }
Exemplo n.º 8
0
 public override void ApplyStyle(ViewStyle viewStyle)
 {
     base.ApplyStyle(viewStyle);
     if (viewStyle != null && viewStyle is DefaultGridItemStyle defaultStyle)
     {
         if (itemLabel != null)
         {
             itemLabel.ApplyStyle(defaultStyle.Label);
         }
         if (itemImage != null)
         {
             itemImage.ApplyStyle(defaultStyle.Image);
         }
         if (itemBadge != null)
         {
             itemBadge.ApplyStyle(defaultStyle.Badge);
         }
     }
 }