Exemple #1
0
        void Initialize()
        {
            win = NUIApplication.GetDefaultWindow();
            var root = new ImageView()
            {
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent,
                ResourceUrl        = imagePath + "download2.jpeg",
                Layout             = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.CenterHorizontal,
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(10, 10),
                }
            };

            win.Add(root);

            var imageViewA = new ImageView()
            {
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.BottomLeft,
                ParentOrigin           = ParentOrigin.BottomLeft,
                Size               = new Size(150, 150),
                ResourceUrl        = imagePath + "background.jpg",
                CornerRadius       = 0.3f,
                CornerRadiusPolicy = VisualTransformPolicyType.Relative,
            };

            root.Add(imageViewA);
            imageViewA.TouchEvent += (s, e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    CreateSubWindowOne();
                }
                return(true);
            };

            var imageViewB = new ImageView()
            {
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.BottomLeft,
                ParentOrigin           = ParentOrigin.BottomLeft,
                Size               = new Size(150, 150),
                ResourceUrl        = imagePath + "netflex.png",
                CornerRadius       = 0.3f,
                CornerRadiusPolicy = VisualTransformPolicyType.Relative,
            };

            root.Add(imageViewB);
            imageViewB.TouchEvent += (s, e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    CreateSubWindowTwo();
                }
                return(true);
            };
        }
        // Add icons

        void AddIcon(string background, string icon, string text, Color textColor)
        {
            ImageView backgroundView = new ImageView();

            backgroundView.ResourceUrl            = background;
            backgroundView.Size                   = new Size(OBJECT_SIZE, OBJECT_SIZE);
            backgroundView.ParentOrigin           = ParentOrigin.CenterLeft;
            backgroundView.PivotPoint             = PivotPoint.CenterLeft;
            backgroundView.PositionUsesPivotPoint = true;
            layoutView.Add(backgroundView);
            frameUpdateCallback.AddId(backgroundView.ID);

            ImageView iconView = new ImageView();

            iconView.ResourceUrl            = icon;
            iconView.Position               = new Position(0, -15);
            iconView.ParentOrigin           = ParentOrigin.Center;
            iconView.PivotPoint             = PivotPoint.Center;
            iconView.PositionUsesPivotPoint = true;
            backgroundView.Add(iconView);

            TextLabel label = new TextLabel(text);

            label.Position               = new Position(0, 30);
            label.HorizontalAlignment    = HorizontalAlignment.Center;
            label.TextColor              = textColor;
            label.FontFamily             = "SamsungOneUI";
            label.PointSize              = 12;
            label.ParentOrigin           = ParentOrigin.Center;
            label.PivotPoint             = PivotPoint.Center;
            label.PositionUsesPivotPoint = true;
            backgroundView.Add(label);
        }
Exemple #3
0
        private ImageView CreateBackgroundTrack()
        {
            if (null == bgTrackImage)
            {
                bgTrackImage = new ImageView()
                {
                    WidthResizePolicy      = ResizePolicyType.Fixed,
                    HeightResizePolicy     = ResizePolicyType.Fixed,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true,
                    GrabTouchAfterLeave    = true,
                    AccessibilityHidden    = true,
                };
                this.Add(bgTrackImage);

                if (null != slidedTrackImage)
                {
                    bgTrackImage.Add(slidedTrackImage);
                }
                if (null != warningTrackImage)
                {
                    bgTrackImage.Add(warningTrackImage);
                }
                if (null != thumbImage)
                {
                    bgTrackImage.Add(thumbImage);
                    thumbImage.RaiseToTop();
                }
            }

            return(bgTrackImage);
        }
Exemple #4
0
        private ImageView CreateBackgroundTrack()
        {
            if (null == bgTrackImage)
            {
                bgTrackImage = new ImageView()
                {
                    WidthResizePolicy      = ResizePolicyType.Fixed,
                    HeightResizePolicy     = ResizePolicyType.Fixed,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    PositionUsesPivotPoint = true
                };
                this.Add(bgTrackImage);

                if (null != slidedTrackImage)
                {
                    bgTrackImage.Add(slidedTrackImage);
                }
                if (null != warningTrackImage)
                {
                    bgTrackImage.Add(warningTrackImage);
                }
                if (null != thumbImage)
                {
                    bgTrackImage.Add(thumbImage);
                    thumbImage.RaiseToTop();
                }

                bgTrackImage.TouchEvent += OnTouchEventForBgTrack;
            }

            return(bgTrackImage);
        }
Exemple #5
0
        private View CreateTile(string name, string title, Vector3 sizeMultiplier, Vector2 position)
        {
            ImageView focusableTile = new ImageView();

            focusableTile.SetStyleName("DemoTile");
            focusableTile.ResourceUrl            = CommonResource.GetDaliResourcePath() + "DaliDemo/demo-tile-texture.9.png";
            focusableTile.PositionUsesPivotPoint = true;
            focusableTile.ParentOrigin           = ParentOrigin.Center;
            focusableTile.WidthResizePolicy      = focusableTile.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
            focusableTile.SetSizeModeFactor(sizeMultiplier);
            focusableTile.Name = name;

            // Set the tile to be keyboard focusable
            focusableTile.Focusable = true;

            // Register a property with the ImageView. This allows us to inject the scroll-view position into the shader.
            PropertyValue value         = new PropertyValue(new Vector3(0.0f, 0.0f, 0.0f));
            int           propertyIndex = focusableTile.RegisterProperty("uCustomPosition", value);

            // Create an ImageView for the 9-patch border around the tile.
            ImageView borderImage = new ImageView();

            borderImage.SetStyleName("DemoTileBorder");
            borderImage.ResourceUrl            = CommonResource.GetDaliResourcePath() + "DaliDemo/item-background.9.png";
            borderImage.PositionUsesPivotPoint = true;
            borderImage.PivotPoint             = PivotPoint.Center;
            borderImage.ParentOrigin           = ParentOrigin.Center;
            borderImage.WidthResizePolicy      = borderImage.HeightResizePolicy = ResizePolicyType.FillToParent;
            borderImage.Opacity = 0.8f;
            focusableTile.Add(borderImage);

            TextLabel label = new TextLabel();

            label.PositionUsesPivotPoint = true;
            label.PivotPoint             = PivotPoint.Center;
            label.ParentOrigin           = ParentOrigin.Center;
            label.SetStyleName("LauncherLabel");
            label.MultiLine           = true;
            label.Text                = title;
            label.HorizontalAlignment = HorizontalAlignment.Center;
            label.VerticalAlignment   = VerticalAlignment.Center;
            label.WidthResizePolicy   = ResizePolicyType.FillToParent;
            label.HeightResizePolicy  = ResizePolicyType.FillToParent;

            var fit = new PropertyMap();

            fit.Add("enable", new PropertyValue(true)).Add("minSize", new PropertyValue(5.0f)).Add("maxSize", new PropertyValue(50.0f));
            label.TextFit = fit;

            // Pad around the label as its size is the same as the 9-patch border. It will overlap it without padding.
            label.SetPadding(new PaddingType((int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING));

            focusableTile.Add(label);

            // Connect to the touch events
            focusableTile.TouchEvent += OnTilePressed;

            return(focusableTile);
        }
Exemple #6
0
    public void CreateDeleteWindowTest()
    {
        if (!_textButton[0]._window)
        {
            _textButton[0]._window = new Window(new Rectangle(0, 0, 720, 1280))
            {
                BackgroundColor = Color.Cyan,
                Title           = "new window 1",
            };

            _textButton[0]._button.Text = _textButton[0]._textToggled;

            var layout = new FlexLayout()
            {
                Direction      = FlexLayout.FlexDirection.Column,
                Justification  = FlexLayout.FlexJustification.SpaceAround,
                ItemsAlignment = FlexLayout.AlignmentType.Center,
            };

            var view = new ImageView("./res/images/background-1.jpg")
            {
                Layout              = layout,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            _textButton[0]._window.Add(view);

            // Create a simple TextLabel
            TextLabel title = new TextLabel("Click the same button to\ndelete this window")
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextColor           = Color.Cyan,
                MultiLine           = true,
            };

            // Add the text to the window
            view.Add(title);

            TextEditor textEditor = new TextEditor()
            {
                BackgroundColor = Color.Cyan,
                Text            = " Input your text ",
                PointSize       = 20,
                TextColor       = Color.Black,
                LineWrapMode    = LineWrapMode.Character,
            };

            view.Add(textEditor);
        }
        else
        {
            _textButton[0]._window.Destroy();
            _textButton[0]._button.Text = _textButton[0]._text;
        }
    }
        protected override void OnCreate()
        {
            base.OnCreate();

            appWindow = Window.Instance;
            appWindow.BackgroundColor = Color.White;

            //Setup event handlers.
            appWindow.KeyEvent   += OnKeyEvent;
            appWindow.TouchEvent += OnWindowTouched;

            //Create application background. Background image is loaded from resources directory.
            ImageView background = new ImageView(DirectoryInfo.Resource + "/images/bg.png");

            appWindow.Add(background);

            //Setting the background parameters so that it occupies the entire application window
            background.Size2D     = new Size2D(appWindow.Size.Width, appWindow.Size.Height);
            background.Position2D = new Position2D(0, 0);

            //Create the menu layer. It will be used to show icons on top of the background content.
            menuLayer = new Layer();
            appWindow.AddLayer(menuLayer);

            //Help label - describes left side of the screen action
            TextLabel leftLabel = new TextLabel("Tap left side of the screen to show menu");

            leftLabel.Size2D              = new Size2D(appWindow.Size.Width / 2 - 40, appWindow.Size.Height);
            leftLabel.Position2D          = new Position2D(20, 0);
            leftLabel.HorizontalAlignment = HorizontalAlignment.Center;
            leftLabel.VerticalAlignment   = VerticalAlignment.Center;
            leftLabel.MultiLine           = true;
            background.Add(leftLabel);

            //Help label - describes right side of the screen action
            TextLabel rightLabel = new TextLabel("Tap right side of the screen to hide menu");

            rightLabel.Size2D              = new Size2D(appWindow.Size.Width / 2 - 40, appWindow.Size.Height);
            rightLabel.Position2D          = new Position2D(appWindow.Size.Width / 2 + 20, 0);
            rightLabel.HorizontalAlignment = HorizontalAlignment.Center;
            rightLabel.VerticalAlignment   = VerticalAlignment.Center;
            rightLabel.MultiLine           = true;
            background.Add(rightLabel);

            //Creates menu component
            menu = new View();
            menu.BackgroundColor = new Color(0.6f, 0.6f, 0.6f, 0.5f);
            menu.Size2D          = new Size2D(100, appWindow.Size.Height);

            //Add the menu to the layer (separated from the background)
            menuLayer.Add(menu);

            addIcons(menu);
        }
Exemple #8
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);
        }
Exemple #9
0
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            if (viewStyle is SwitchStyle switchStyle)
            {
                if (Extension is SwitchExtension extension)
                {
                    track.Unparent();
                    thumb.Unparent();
                    track = extension.OnCreateTrack(this, track);
                    thumb = extension.OnCreateThumb(this, thumb);
                    track.Add(thumb);
                }

                if (switchStyle.Track != null)
                {
                    Track.ApplyStyle(switchStyle.Track);
                }

                if (switchStyle.Thumb != null)
                {
                    Thumb.ApplyStyle(switchStyle.Thumb);
                }
            }

            base.ApplyStyle(viewStyle);
        }
Exemple #10
0
        void CreateSubWindowOne()
        {
            if (subWindowOne == null)
            {
                subWindowOne = new Window("subwin1", null, new Rectangle(20, 20, 800, 800), false);

                var root = new ImageView()
                {
                    WidthResizePolicy  = ResizePolicyType.FillToParent,
                    HeightResizePolicy = ResizePolicyType.FillToParent,
                    ResourceUrl        = imagePath + "gallery-large-9.jpg",
                    CornerRadius       = new Vector4(0.03f, 0.03f, 0.03f, 0.03f),
                    CornerRadiusPolicy = VisualTransformPolicyType.Relative,
                };
                subWindowOne.Add(root);

                TextLabel text = new TextLabel("Hello Tizen NUI World");
                text.HorizontalAlignment = HorizontalAlignment.Center;
                text.VerticalAlignment   = VerticalAlignment.Center;
                text.TextColor           = Color.CornflowerBlue;
                text.HeightResizePolicy  = ResizePolicyType.FillToParent;
                text.WidthResizePolicy   = ResizePolicyType.FillToParent;
                root.Add(text);

                Animation animation = new Animation(2000);
                animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);
                animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);
                animation.Looping = true;
                animation.Play();
            }
            else
            {
                subWindowOne.Minimize(false);
            }
        }
Exemple #11
0
        private ImageView CreateWarningTrack()
        {
            if (null == warningTrackImage)
            {
                warningTrackImage = new ImageView()
                {
                    WidthResizePolicy   = ResizePolicyType.Fixed,
                    HeightResizePolicy  = ResizePolicyType.Fixed,
                    AccessibilityHidden = true,
                };

                if (bgTrackImage != null)
                {
                    bgTrackImage.Add(warningTrackImage);
                }

                if (warningSlidedTrackImage != null)
                {
                    warningTrackImage.Add(warningSlidedTrackImage);
                }

                if (slidedTrackImage != null)
                {
                    warningTrackImage.RaiseAbove(slidedTrackImage);
                }
            }

            return(warningTrackImage);
        }
Exemple #12
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);
        }
        /// <summary>
        /// Class construction
        /// </summary>
        /// <param name="parent">parent view</param>
        public ActionReminder(View parent)
        {
            _parent = parent;
            _actionReminderProgressCount     = 0;
            _actionReminderTouchOriginToggle = false;
            _actionReminderProgressMax       = 4;

            _actionReminderAnimationDuration      = Constants.ActionReminderAnimationDuration;
            _actionReminderTouchAnimationDuration = Constants.ActionReminderTouchAnimationDuration;

            // We want to zoom into the circular control on the remote. This is slightly higher up than the center of the image.
            float imageZoomCenter = 0.354f;

            _actionReminderRemote      = new ImageView(Constants.ResourcePath + "/images/ActionReminder/remote.png");
            _actionReminderRemote.Name = "remote";
            _actionReminderRemote.WidthResizePolicy  = ResizePolicyType.UseNaturalSize;
            _actionReminderRemote.HeightResizePolicy = ResizePolicyType.UseNaturalSize;
            _actionReminderRemote.PivotPoint         = new Position(0.5f, imageZoomCenter, 0.5f);
            _actionReminderRemote.Scale                  = new Size(0.1f, 0.1f, 0.1f);
            _actionReminderRemote.ParentOrigin           = Tizen.NUI.ParentOrigin.Center;
            _actionReminderRemote.PositionUsesPivotPoint = true;
            _actionReminderRemote.SetProperty(_actionReminderRemote.GetPropertyIndex("ColorAlpha"), new PropertyValue(0.0f));

            _actionReminderRemoteCloseUp      = new ImageView(Constants.ResourcePath + "/images/ActionReminder/remote-close-up.png");
            _actionReminderRemoteCloseUp.Name = "remoteCloseUp";
            _actionReminderRemoteCloseUp.WidthResizePolicy      = ResizePolicyType.UseNaturalSize;
            _actionReminderRemoteCloseUp.HeightResizePolicy     = ResizePolicyType.UseNaturalSize;
            _actionReminderRemoteCloseUp.PivotPoint             = Tizen.NUI.PivotPoint.Center;
            _actionReminderRemoteCloseUp.ParentOrigin           = new Position(0.5f, imageZoomCenter, 0.5f);
            _actionReminderRemoteCloseUp.PositionUsesPivotPoint = true;
            _actionReminderRemoteCloseUp.Position     = new Position(-0.6f, 0.0f, 0.0f);
            _actionReminderRemoteCloseUp.Scale        = new Size(0.1f, 0.1f, 0.1f);
            _actionReminderRemoteCloseUp.InheritScale = false;
            //_actionReminderRemoteCloseUp.InheritOpacity = false;
            _actionReminderRemoteCloseUp.SetProperty(_actionReminderRemoteCloseUp.GetPropertyIndex("ColorAlpha"), new PropertyValue(0.0f));

            _remoteTouch      = new ImageView(Constants.ResourcePath + "/images/ActionReminder/touch-point-highlight.png");
            _remoteTouch.Name = "remoteTouch";
            _remoteTouch.WidthResizePolicy      = ResizePolicyType.UseNaturalSize;
            _remoteTouch.HeightResizePolicy     = ResizePolicyType.UseNaturalSize;
            _remoteTouch.PivotPoint             = Tizen.NUI.PivotPoint.Center;
            _remoteTouch.ParentOrigin           = new Position(0.315f, 0.41f, 0.5f);
            _remoteTouch.PositionUsesPivotPoint = true;
            _remoteTouch.InheritScale           = false;
            //_remoteTouch.InheritOpacity = false;
            _remoteTouch.SetProperty(_actionReminderRemoteCloseUp.GetPropertyIndex("ColorAlpha"), new PropertyValue(0.0f));
            _remoteTouchPointOrigin = new Vector2(0.1855f, 0.408f);

            _actionReminderRemoteCloseUp.Add(_remoteTouch);
            _actionReminderRemote.Add(_actionReminderRemoteCloseUp);

            _actionReminderAnimation           = new Animation(_actionReminderAnimationDuration);
            _actionReminderAnimation.Finished += AnimationFinished;
            _actionReminderProgressCount       = 0;

            // Define the animation effects used by the ActionReminder.
            CreateEffects();
        }
Exemple #14
0
        private ImageView CreateSlidedTrack()
        {
            if (null == slidedTrackImage)
            {
                slidedTrackImage = new ImageView()
                {
                    WidthResizePolicy  = ResizePolicyType.Fixed,
                    HeightResizePolicy = ResizePolicyType.Fixed
                };

                if (bgTrackImage != null)
                {
                    bgTrackImage.Add(slidedTrackImage);
                }
            }

            return(slidedTrackImage);
        }
Exemple #15
0
    public void ShowHideWindowTest()
    {
        if (!_textButton[3]._window)
        {
            _textButton[3]._window = new Window(new Rectangle(0, 0, 720, 1280))
            {
                BackgroundColor = Color.Cyan,
                Title           = "new window 4",
            };
            _textButton[3]._button.Text = _textButton[3]._textToggled;

            var layout = new FlexLayout()
            {
                Direction      = FlexLayout.FlexDirection.Column,
                Justification  = FlexLayout.FlexJustification.Center,
                ItemsAlignment = FlexLayout.AlignmentType.Center,
            };

            var view = new ImageView("./res/images/background-4.jpg")
            {
                Layout              = layout,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            _textButton[3]._window.Add(view);

            var image = new ImageView("./res/images/gallery-5.jpg");
            view.Add(image);

            Animation rotateAnimation = new Animation()
            {
                Duration  = 4000,
                Looping   = true,
                EndAction = Animation.EndActions.Discard,
            };
            rotateAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.Z), 0, 2000);
            rotateAnimation.AnimateTo(image, "Orientation", new Rotation(new Radian(new Degree(360.0f)), PositionAxis.Z), 2000, 4000);
            rotateAnimation.Play();
        }
        else
        {
            if (_textButton[3]._button.Text == _textButton[3]._text)
            {
                _textButton[3]._window.Show();
                _textButton[3]._button.Text = _textButton[3]._textToggled;
            }
            else
            {
                _textButton[3]._window.Hide();
                _textButton[3]._button.Text = _textButton[3]._text;
            }
        }
    }
 public MultiImageMediaItemCell(string key) : base(key)
 {
     Enumerable.Range(0, 4).ForEach(x =>
     {
         var imageView = new UIImageView {
             Alpha = 0, Frame = new CGRect(0, 0, ImageWidth / 2, ImageWidth / 2)
         };
         ImageViews[x] = imageView;
         ImageView.Add(imageView);
     });
 }
Exemple #17
0
        public override void OnInitialize()
        {
            track = new ImageView();
            thumb = new ImageView();
            track.Add(thumb);

            base.OnInitialize();
            SetAccessibilityConstructor(Role.ToggleButton);

            IsSelectable = true;
#if PROFILE_MOBILE
            Feedback = true;
#endif
        }
Exemple #18
0
        private void CreateSelectTitle()
        {
            Tizen.Log.Fatal("NUI.ChannelList", "CreateSelectTitle...");

            //Selected, Title area, title background
            ImageView titleBackGround = new ImageView(titleBackGroundImage);

            titleBackGround.SizeWidth  = windowSize.Width * 0.344270f;//0.385937f
            titleBackGround.SizeHeight = windowSize.Height * 0.112037f;
            selectContentLayout.AddChild(titleBackGround, new TableView.CellPosition(0, 0));

            //Selected, Title area, title icon
            selectTitleIcon                        = new ImageView(titleIconFavorite);
            selectTitleIcon.SizeWidth              = windowSize.Width * 0.041666f;
            selectTitleIcon.SizeHeight             = windowSize.Height * 0.074074f;
            selectTitleIcon.PositionUsesPivotPoint = true;
            selectTitleIcon.PivotPoint             = PivotPoint.CenterLeft;
            selectTitleIcon.ParentOrigin           = ParentOrigin.CenterLeft;
            selectTitleIcon.Position               = new Position(windowSize.Width * 0.011458f, 0, 0);
            titleBackGround.Add(selectTitleIcon);

            //Selected, Title area, title text
            selectTitleText                        = new TextLabel("Favorite");
            selectTitleText.SizeWidth              = windowSize.Width * (0.385937f - 0.011458f - 0.041666f - 0.010416f * 2 - 0.063451f);
            selectTitleText.SizeHeight             = windowSize.Height * 0.074074f;
            selectTitleText.PositionUsesPivotPoint = true;
            selectTitleText.PivotPoint             = PivotPoint.CenterLeft;
            selectTitleText.ParentOrigin           = ParentOrigin.CenterLeft;
            selectTitleText.Position               = new Position(windowSize.Width * (0.011458f + 0.041666f + 0.010416f), 0, 0);
            selectTitleText.HorizontalAlignment    = HorizontalAlignment.Begin;
            selectTitleText.VerticalAlignment      = VerticalAlignment.Center;
            //selectTitleText.PointSize = 48.0f;
            selectTitleText.PointSize  = DeviceCheck.PointSize10;
            selectTitleText.TextColor  = new Vector4(1, 1, 1, 1);
            selectTitleText.FontFamily = "SamsungOne 300";
            titleBackGround.Add(selectTitleText);
        }
Exemple #19
0
    public void RaiseLowerWindowTest()
    {
        if (!_textButton[2]._window)
        {
            _textButton[2]._window = new Window(new Rectangle(0, 0, 720, 1280))
            {
                BackgroundColor = Color.Cyan,
                Title           = "new window 3",
            };
            _textButton[2]._button.Text = _textButton[2]._textToggled;

            var layout = new GridLayout()
            {
                Columns = 2,
            };

            var view = new ImageView("./res/images/background-3.jpg")
            {
                Layout              = layout,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            _textButton[2]._window.Add(view);

            for (int i = 1; i < 9; i++)
            {
                var image = new ImageView("./res/images/gallery-" + i + ".jpg");
                image.Margin = new Extents(20, 20, 20, 20);
                view.Add(image);
            }
        }
        else
        {
            if (_textButton[2]._button.Text == _textButton[2]._text)
            {
                _textButton[2]._window.Raise();
                _textButton[2]._button.Text = _textButton[2]._textToggled;
            }
            else
            {
                _textButton[2]._window.Lower();
                _textButton[2]._button.Text = _textButton[2]._text;
            }
        }
    }
Exemple #20
0
        private TextLabel CreateValueIndicatorText()
        {
            if (null == valueIndicatorText)
            {
                valueIndicatorText = new TextLabel()
                {
                    WidthResizePolicy  = ResizePolicyType.Fixed,
                    HeightResizePolicy = ResizePolicyType.Fixed
                };
                if (valueIndicatorImage != null)
                {
                    valueIndicatorImage.Add(valueIndicatorText);
                }
            }

            return(valueIndicatorText);
        }
Exemple #21
0
        private ImageView CreateWarningSlidedTrack()
        {
            if (null == warningSlidedTrackImage)
            {
                warningSlidedTrackImage = new ImageView()
                {
                    WidthResizePolicy  = ResizePolicyType.Fixed,
                    HeightResizePolicy = ResizePolicyType.Fixed
                };

                if (warningTrackImage != null)
                {
                    warningTrackImage.Add(warningSlidedTrackImage);
                }
            }

            return(warningSlidedTrackImage);
        }
Exemple #22
0
        /// <summary>
        /// This function uses ItemId as next FocusedItem and preforms Scroll and SpotLight animations on that item.
        /// </summary>
        /// <param name="itemId">the id of the item</param>
        /// <param name="force">force, default value is false</param>
        private void FocusItem(int itemId, bool force = false)
        {
            float focusedMargin = _margin;
            bool  noFocus       = itemId < 0;

            if (noFocus)
            {
                // If we want to render as if we have no focus, remove the focus margin.
                itemId        = _focusedItem;
                focusedMargin = 0.0f;
            }

            // Perform Spot Light animation
            if (force || noFocus || (_focusedItem != itemId))
            {
                // Note: The focus shine and the bounce animation use the same animation. We use different end times here so the user can specify different durations for each.
                if (!noFocus && _spotLight != null && _spotlightClip != null)
                {
                    _spotlightClip.Add(_spotLight);

                    // Stage and Play the selection effect.
                    _selectionEffect.Show(_items[itemId].item);
                }

                // Iterate through all items animating to their new target scales.
                _focusAnimation.Clear();
                AlphaFunction focusedAlphaFunction = new AlphaFunction(new Vector2(0.32f, 0.08f), new Vector2(0.38f, 1.72f));
                AlphaFunction normalAlphaFunction  = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSine);
                Vector3       focusedScale         = new Vector3(_focusScale, _focusScale, _focusScale);
                Vector3       normalScale          = new Vector3(1.0f, 1.0f, 1.0f);
                for (int i = 0; i < _items.Count; ++i)
                {
                    bool focused = !noFocus && (i == itemId);
                    _focusAnimation.AnimateTo(_items[i].item, "Scale", focused ? focusedScale : normalScale, 0, Constants.FocusDuration, focused ? focusedAlphaFunction : normalAlphaFunction);
                }

                _focusAnimation.Play();
            }

            // The focused item should appear above all other items.
            _items[itemId].item.RaiseToTop();
        }
Exemple #23
0
        private ImageView CreateValueIndicator()
        {
            if (valueIndicatorImage == null)
            {
                valueIndicatorImage = new ImageView()
                {
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.Center,
                    PivotPoint             = Tizen.NUI.PivotPoint.Center,
                    WidthResizePolicy      = ResizePolicyType.Fixed,
                    HeightResizePolicy     = ResizePolicyType.Fixed,
                };
                if (valueIndicatorText != null)
                {
                    valueIndicatorImage.Add(valueIndicatorText);
                }
                // TODO : ValueIndicator can be a child of Thumb
                this.Add(valueIndicatorImage);
            }

            valueIndicatorImage.Hide();
            return(valueIndicatorImage);
        }
Exemple #24
0
        private void CreateTitle()
        {
            Tizen.Log.Fatal("NUI.ChannelList", "CreateTitle...");
            //Title_area W:0.385937 x H:0.112037
            // Title area,title background image
            ImageView titleBackGround = new ImageView(titleBackGroundImage);

            titleBackGround.SizeWidth  = windowSize.Width * (0.323437f + 0.207812f);//0.385937f
            titleBackGround.SizeHeight = windowSize.Height * 0.112037f;
            contentLayout.AddChild(titleBackGround, new TableView.CellPosition(0, 0));

            //Title area, edit icon background:  0.061458 x 0.108333
            View editBackGround = new View();

            editBackGround.BackgroundColor        = new Vector4(1, 1, 1, 0.09f);
            editBackGround.SizeWidth              = windowSize.Width * 0.061458f;
            editBackGround.SizeHeight             = windowSize.Height * 0.108333f;
            editBackGround.PositionUsesPivotPoint = true;
            editBackGround.PivotPoint             = PivotPoint.TopLeft;
            editBackGround.ParentOrigin           = ParentOrigin.TopLeft;
            editBackGround.Position = new Position(windowSize.Width * (0.323437f + 0.001041f), windowSize.Height * 0.001851f, 0.0f);
            titleBackGround.Add(editBackGround);

            //Title area, edit background
            editBackGround1 = new View();
            editBackGround1.BackgroundColor        = new Vector4(1, 1, 1, 0.09f);
            editBackGround1.SizeWidth              = windowSize.Width * (0.207812f - 0.061458f - 0.001041f * 2);
            editBackGround1.SizeHeight             = windowSize.Height * 0.108333f;
            editBackGround1.PositionUsesPivotPoint = true;
            editBackGround1.PivotPoint             = PivotPoint.TopRight;
            editBackGround1.ParentOrigin           = ParentOrigin.TopRight;
            editBackGround1.Position = new Position(-windowSize.Width * 0.001041f, windowSize.Height * 0.001851f, 0.0f);
            titleBackGround.Add(editBackGround1);
            editBackGround1.Hide();

            //edit icon: 0.019791  x 0.035185
            //Title area, edit icon
            ImageView edit = new ImageView(editImage);

            edit.SizeWidth              = windowSize.Width * 0.019791f;
            edit.SizeHeight             = windowSize.Height * 0.035185f;
            edit.PositionUsesPivotPoint = true;
            edit.PivotPoint             = PivotPoint.Center;
            edit.ParentOrigin           = ParentOrigin.Center;
            edit.Hide();
            editBackGround.Add(edit);

            //edit text
            //Title area, edit text
            TextLabel editText = new TextLabel();

            editText.SizeWidth              = windowSize.Width * (0.207812f - 0.061458f - 0.001041f * 2);
            editText.SizeHeight             = windowSize.Height * 0.047037f;//0.037037f
            editText.PositionUsesPivotPoint = true;
            editText.PivotPoint             = PivotPoint.CenterLeft;
            editText.ParentOrigin           = ParentOrigin.CenterLeft;
            editText.Position            = new Position(windowSize.Width * 0.001041f, windowSize.Height * 0.001851f, 0.0f);
            editText.HorizontalAlignment = HorizontalAlignment.Begin;
            editText.VerticalAlignment   = VerticalAlignment.Center;
            editText.TextColor           = new Color(1, 1, 1, 1);
            //editText.PointSize = 8.0f;
            editText.PointSize  = DeviceCheck.PointSize8;
            editText.FontFamily = "SamsungOne 300";
            editText.Text       = "Select";
            editText.Hide();
            editBackGround1.Add(editText);

            //Title_icon image size: 0.041666 x 0.074074
            //Title area, title icon
            titleIcon                        = new ImageView(titleIconAll);
            titleIcon.SizeWidth              = windowSize.Width * 0.041666f;
            titleIcon.SizeHeight             = windowSize.Height * 0.074074f;
            titleIcon.PositionUsesPivotPoint = true;
            titleIcon.PivotPoint             = PivotPoint.CenterLeft;
            titleIcon.ParentOrigin           = ParentOrigin.CenterLeft;
            titleIcon.Position               = new Position(windowSize.Width * 0.011458f, 0, 0);
            titleBackGround.Add(titleIcon);

            //Title_text size width: 0.322395 - 0.011458f - 0.041666f - 0.010416f * 2
            //Title area, title text
            titleText                        = new TextLabel("All Channels");
            titleText.SizeWidth              = windowSize.Width * (0.385937f - 0.011458f - 0.041666f - 0.010416f * 2 - 0.063541f);
            titleText.SizeHeight             = windowSize.Height * 0.074074f;
            titleText.PositionUsesPivotPoint = true;
            titleText.PivotPoint             = PivotPoint.CenterLeft;
            titleText.ParentOrigin           = ParentOrigin.CenterLeft;
            titleText.Position               = new Position(windowSize.Width * (0.011458f + 0.041666f + 0.010416f), 0, 0);
            titleText.HorizontalAlignment    = HorizontalAlignment.Begin;
            titleText.VerticalAlignment      = VerticalAlignment.Center;
            //titleText.PointSize = 48.0f;
            titleText.PointSize  = DeviceCheck.PointSize10;
            titleText.TextColor  = new Vector4(1, 1, 1, 1);
            titleText.FontFamily = "SamsungOne 300";
            titleBackGround.Add(titleText);
        }
Exemple #25
0
        private View CreateTile(string name, string title, Vector3 sizeMultiplier, Vector2 position)
        {
            ImageView focusableTile = new ImageView();

            focusableTile.SetStyleName("DemoTile");
            focusableTile.ResourceUrl            = CommonResource.GetDaliResourcePath() + "demo-tile-texture.9.png";
            focusableTile.PositionUsesPivotPoint = true;
            focusableTile.ParentOrigin           = ParentOrigin.Center;
            focusableTile.WidthResizePolicy      = focusableTile.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
            focusableTile.SetSizeModeFactor(sizeMultiplier);
            focusableTile.Name = name;

            // Set the tile to be keyboard focusable
            focusableTile.Focusable = true;

            // Register a property with the ImageView. This allows us to inject the scroll-view position into the shader.
            PropertyValue value         = new PropertyValue(new Vector3(0.0f, 0.0f, 0.0f));
            int           propertyIndex = focusableTile.RegisterProperty("uCustomPosition", value);

            // We create a constraint to perform a precalculation on the scroll-view X offset
            // and pass it to the shader uniform, along with the tile's position.
            //Constraint shaderPosition = Constraint::New<Vector3>(focusableTile, propertyIndex, TileShaderPositionConstraint(mPageWidth, position.x));
            //shaderPosition.AddSource(Source(mScrollView, ScrollView::Property::SCROLL_POSITION) );
            //shaderPosition.SetRemoveAction(Constraint::Discard );
            //shaderPosition.Apply();
            //focusableTile.Add( tileContent );

            // Create an ImageView for the 9-patch border around the tile.
            ImageView borderImage = new ImageView();

            borderImage.SetStyleName("DemoTileBorder");
            borderImage.ResourceUrl            = CommonResource.GetDaliResourcePath() + "item-background.9.png";
            borderImage.PositionUsesPivotPoint = true;
            borderImage.PivotPoint             = PivotPoint.Center;
            borderImage.ParentOrigin           = ParentOrigin.Center;
            borderImage.WidthResizePolicy      = borderImage.HeightResizePolicy = ResizePolicyType.FillToParent;
            borderImage.Opacity = 0.8f;
            focusableTile.Add(borderImage);

            TextLabel label = new TextLabel();

            label.PositionUsesPivotPoint = true;
            label.PivotPoint             = PivotPoint.Center;
            label.ParentOrigin           = ParentOrigin.Center;
            label.SetStyleName("LauncherLabel");
            label.MultiLine           = true;
            label.Text                = title;
            label.HorizontalAlignment = HorizontalAlignment.Center;
            label.VerticalAlignment   = VerticalAlignment.Center;
            label.HeightResizePolicy  = ResizePolicyType.FillToParent;

            // Pad around the label as its size is the same as the 9-patch border. It will overlap it without padding.
            label.SetPadding(new PaddingType((int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING, (int)TILE_LABEL_PADDING));
            focusableTile.Add(label);

            // Connect to the touch events
            focusableTile.TouchEvent += OnTilePressed;
            //focusableTile.HoverEvent += OnTileHovered;

            return(focusableTile);
        }
Exemple #26
0
        // Initialisation
        private void OnInitialize()
        {
            // Initialize menus.
            TVConfiguration tvConfiguration = new TVConfiguration();

            _configuration = tvConfiguration.GetConfiguration();

            _window = Window.Instance;
            _window.SetOpaqueState(false);
            _windowSize          = _window.Size;
            _resourcePath        = Constants.ResourcePath;
            _posterMenuHideStack = new List <int>();

            // Precalculations for re-use:
            // The poster-menu height is based on factors for scalability.
            // The height of the poster-menu is increased to take into account the amount revealed by the lower-menu animation.
            _posterMenuHeight = _windowSize.Height * (Constants.TopContainerHeightFactor + (Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor));
            // Y position is the % of the screen occupied by the menu, minus the amount of the screen that the menu hides by.
            // This is so when the menu is partially hidden, all of the posters can be seen exactly.
            // We increase the Hide factor to give more overlap as the hide animation overshoots when it bounces.
            _posterMenuY = _windowSize.Height * (Constants.MenuContainerHeightFactor - (Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor * 1.5f));

            if (!Constants.TransparentWindow)
            {
                ImageView backgroundImage = new ImageView(_resourcePath + "/images/Backgrounds/source_bg.png");
                backgroundImage.Name = "backgroundImage";
                backgroundImage.WidthResizePolicy      = ResizePolicyType.FillToParent;
                backgroundImage.HeightResizePolicy     = ResizePolicyType.Fixed;
                backgroundImage.Size2D                 = new Size2D(0, _windowSize.Height - (int)(_posterMenuHeight - _posterMenuY));
                backgroundImage.ParentOrigin           = ParentOrigin.TopCenter;
                backgroundImage.PivotPoint             = PivotPoint.TopCenter;
                backgroundImage.PositionUsesPivotPoint = true;
                _window.Add(backgroundImage);
            }

            // Create a SpotLight for items / images of both Poster and Menu ScrollContainers
            ImageView spotLight = new ImageView(_resourcePath + "/images/HighlightEffect/highlight-spotlight.png");

            spotLight.Name = "spotLight";
            spotLight.WidthResizePolicy      = ResizePolicyType.UseNaturalSize;
            spotLight.HeightResizePolicy     = ResizePolicyType.UseNaturalSize;
            spotLight.ParentOrigin           = ParentOrigin.Center;
            spotLight.PivotPoint             = PivotPoint.Center;
            spotLight.PositionUsesPivotPoint = true;

            // Create the poster menu in the middle of the screen
            _posterMenuContainer = new ImageView(_resourcePath + "/images/Backgrounds/background.png");
            _posterMenuContainer.WidthResizePolicy      = ResizePolicyType.FillToParent;
            _posterMenuContainer.HeightResizePolicy     = ResizePolicyType.Fixed;
            _posterMenuContainer.Size2D                 = new Size2D(0, (int)_posterMenuHeight);
            _posterMenuContainer.PositionUsesPivotPoint = true;
            _posterMenuContainer.ParentOrigin           = ParentOrigin.BottomCenter;
            _posterMenuContainer.PivotPoint             = PivotPoint.BottomCenter;
            _posterMenuContainer.Position               = new Position(0.0f, -_posterMenuY, 0.0f);
            _window.Add(_posterMenuContainer);
            CreatePosterMenus(spotLight);
            _posterMenuContainer.Add(_posterMenus[0].ScrollMenu());
            _currentMenuIndex = 1;
            UpdateActivePosterMenu(0);

            _menuContainer      = new ImageView(_resourcePath + "/images/Backgrounds/background.png");
            _menuContainer.Name = "menuContainer";
            _menuContainer.WidthResizePolicy      = ResizePolicyType.FillToParent;
            _menuContainer.HeightResizePolicy     = ResizePolicyType.Fixed;
            _menuContainer.Size2D                 = new Size2D(0, (int)(_windowSize.Height * Constants.MenuContainerHeightFactor));
            _menuContainer.PositionUsesPivotPoint = true;
            _menuContainer.ParentOrigin           = ParentOrigin.BottomRight;
            _menuContainer.PivotPoint             = PivotPoint.BottomRight;
            _window.Add(_menuContainer);

            // Create the lower menu and items.
            Size2D sourceMenuSize     = new Size2D(Convert.ToInt32(_windowSize.Width - Constants.SystemMenuWidth), Convert.ToInt32(_windowSize.Height * Constants.MenuContainerHeightFactor));
            Size2D sourceMenuItemSize = new Size2D(Convert.ToInt32((_windowSize.Width * Constants.MenuItemWidthFactor) - Constants.SourceMenuPadding), Convert.ToInt32(_windowSize.Height * Constants.MenuItemHeightFactor));

            _menu = new SourceMenu(sourceMenuSize, sourceMenuItemSize);

            // Create the showing and hiding menu effects.
            _menu.ShowMenuEffect           = new Effect(_menuContainer, Constants.ShowMenuDuration);
            _menu.ShowMenuEffect.EndAction = Animation.EndActions.Cancel;
            _menu.ShowMenuEffect.AddAction(new Effect.AnimateTo("menuContainer", "Position", new Position(0.0f, 0.0f, 0.0f), new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSine)));

            // Hide animation bounces away.
            _menu.HideMenuEffect           = new Effect(_menuContainer, Constants.ShowMenuDuration);
            _menu.HideMenuEffect.EndAction = Animation.EndActions.Cancel;
            float         yPosition         = _windowSize.Height * Constants.MenuContainerHeightFactor * Constants.MenuContainerHideFactor;
            AlphaFunction hideAlphaFunction = new AlphaFunction(new Vector2(0.32f, 0.08f), new Vector2(0.38f, 1.72f));

            _menu.HideMenuEffect.AddAction(new Effect.AnimateTo("menuContainer", "Position", new Position(0.0f, yPosition, 0.0f), hideAlphaFunction));

            CreateMenuHighlightEffects(_menu.ScrollMenu(), "SourceMenu", spotLight);
            _menuContainer.Add(_menu.ScrollMenu());
            _moveSourceMenuAnimation           = new Animation(Constants.ShowMenuDuration);
            _moveSourceMenuAnimation.EndAction = Animation.EndActions.Cancel;

            // Create the system menu on the bottom left of the screen.
            _systemMenu = new SystemMenu(new Size2D(Convert.ToInt32(Constants.SystemMenuWidth), Convert.ToInt32(_windowSize.Height * Constants.MenuContainerHeightFactor)),
                                         new Position2D(-_windowSize.Width / 2, _windowSize.Height / 2));
            _menuContainer.Add(_systemMenu.GetView());

            // Initialize PreFocusChange event of KeyboardFocusManager
            _keyboardFocusManager = FocusManager.Instance;
            _keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChangeSignal;
            _keyboardFocusManager.FocusIndicator  = new View(); //todor
            _keyboardFocusManager.SetAsFocusGroup(_systemMenu.GetView(), true);
            _keyboardFocusManager.SetAsFocusGroup(_menu.ScrollMenu(), true);
            for (int i = 0; i < _posterMenus.Count; ++i)
            {
                _keyboardFocusManager.SetAsFocusGroup(_posterMenus[i].ScrollMenu(), true);
            }

            _keyboardFocusManager.FocusGroupLoop = false;

            // Set up automation if in benchmarking mode.
            if (_benchmarkMode)
            {
                _automation              = new Automation();
                _automation.EventSignal += AutomationHandler;
                AutomationConfiguration automationConfiguration = new AutomationConfiguration();
                automationConfiguration.Configure(_automation, _menu.Count);
                _automation.Start();
            }

            //todor comment
            _actionReminder = new ActionReminder(_posterMenuContainer);
            _actionReminder.GetView().ParentOrigin = new Position(0.07f, -0.25f, 0.5f);
            _actionReminderTickCounter     = 0;
            _actionReminderTimePeriod      = Constants.ActionReminderTimePeriod;
            _actionReminderRemoteShowTicks = Constants.ActionReminderRemoteShowTicks;
            _actionReminderTimer           = new Timer(_actionReminderTimePeriod);
            _actionReminderTimer.Tick     += ActionReminderTimerHandler;

            // Start the timer that will fire the animation sequence when triggered.
            _actionReminderTimer.Start();

            // Move Focus to Bottom Container (Menu ScrollContainer)
            _menu.ScrollMenu().SetActive(true);
            _keyboardFocusManager.SetCurrentFocusView(_menu.ScrollMenu().GetCurrentFocusedItem());

            Window.Instance.KeyEvent += AppBack;
        }
Exemple #27
0
        private void CreateMenuHighlightEffects(ScrollMenu menu, String resourceSubDirectory, ImageView spotLight)
        {
            View highlightContainer = new View();

            highlightContainer.PositionUsesPivotPoint = true;
            highlightContainer.PivotPoint             = Tizen.NUI.PivotPoint.Center;
            highlightContainer.ParentOrigin           = Tizen.NUI.ParentOrigin.Center;
            highlightContainer.WidthResizePolicy      = ResizePolicyType.FillToParent;
            highlightContainer.HeightResizePolicy     = ResizePolicyType.FillToParent;
            ImageView spotlightClip = ClippingImage.Create(_resourcePath + "/images/" + resourceSubDirectory + "/rounded-mask.png");

            spotlightClip.WidthResizePolicy  = ResizePolicyType.FillToParent;
            spotlightClip.HeightResizePolicy = ResizePolicyType.FillToParent;
            ImageView shineClip = ClippingImage.Create(_resourcePath + "/images/" + resourceSubDirectory + "/rounded-border-mask.png");

            shineClip.WidthResizePolicy  = ResizePolicyType.FillToParent;
            shineClip.HeightResizePolicy = ResizePolicyType.FillToParent;
            // We use a member variable for the shine as it gets reparented it can get garbage collected before it is accessed.
            ImageView shine = new ImageView(_resourcePath + "/images/HighlightEffect/source-shine.png");

            shine.Name = "shine";
            shine.WidthResizePolicy  = ResizePolicyType.FillToParent;
            shine.HeightResizePolicy = ResizePolicyType.FillToParent;
            shineClip.Add(shine);
            highlightContainer.Add(spotlightClip);
            highlightContainer.Add(shineClip);
            // TODO: We are only adding these to the menu as they cannot be encapsulated in the Effect class yet.
            menu.SpotLightClip = spotlightClip;
            menu.SpotLight     = spotLight;
            menu.Shine         = shine;

            // Create the selection effect, which includes a moving shine and a spotlight rotating in a circle.
            Effect selectionEffect = new Effect(highlightContainer);

            selectionEffect.Name = "selectionEffect";
            Size2D itemDimensions = menu.ItemDimensions;

            selectionEffect.AddAction(new Effect.AnimateBetween("shine", "PositionX", -itemDimensions.Width, itemDimensions.Width, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine), 0, Constants.ShineDuration));
            Position topLeft      = new Position(-0.25f * itemDimensions.Width, -0.25f * itemDimensions.Height, 0.0f);
            Position topRight     = new Position(0.25f * itemDimensions.Width, -0.25f * itemDimensions.Height, 0.0f);
            Position bottomRight  = new Position(0.25f * itemDimensions.Width, 0.25f * itemDimensions.Height, 0.0f);
            Position bottomLeft   = new Position(-0.25f * itemDimensions.Width, 0.25f * itemDimensions.Height, 0.0f);
            Path     circularPath = new Path();

            circularPath.AddPoint(topLeft);
            circularPath.AddPoint(topRight);
            circularPath.AddPoint(bottomRight);
            circularPath.AddPoint(bottomLeft);
            circularPath.AddPoint(topLeft);
            circularPath.GenerateControlPoints(0.5f);
            Effect.AnimatePath spotlightAction = new Effect.AnimatePath("spotLight", circularPath, new Vector3(0.0f, 0.0f, 0.0f), new AlphaFunction(AlphaFunction.BuiltinFunctions.Default), 0, Constants.SpotLightDuration);
            spotlightAction.Looping = true;
            selectionEffect.AddAction(spotlightAction);
            menu.SelectionEffect = selectionEffect;

            // Create the pulse effect, which is a non-symetric X/Y scale "bounce" effect to the animation.
            Effect pulseEffect = new Effect(highlightContainer);

            pulseEffect.Name = "selectionEffect";
            // Note: The menu will automatically set the target of the pulse effect to the correct menu item itself.
            pulseEffect.AddAction(new Effect.AnimateTo(null, "Scale", new Vector3(1.3f, 1.0f, 1.0f), new AlphaFunction(AlphaFunction.BuiltinFunctions.Bounce)));
            menu.PulseEffect = pulseEffect;
        }
Exemple #28
0
        void Initialize()
        {
            win = NUIApplication.GetDefaultWindow();

            var root = new ImageView()
            {
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent,
                ResourceUrl        = imagePath + "gallery-large-14.jpg",
                Layout             = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.CenterHorizontal,
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(10, 10),
                }
            };

            win.Add(root);


            var appFunctionList = new View()
            {
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.BottomLeft,
                ParentOrigin           = ParentOrigin.BottomLeft,
                BackgroundColor        = new Color(0, 1, 1, 0.5f),
                Size               = new Size(500, 200),
                CornerRadius       = 0.3f,
                CornerRadiusPolicy = VisualTransformPolicyType.Relative,
                Layout             = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.CenterHorizontal,
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(10, 10),
                    Padding           = new Extents(10, 10, 10, 10),
                }
            };

            root.Add(appFunctionList);

            var defaultBorder = new View()
            {
                Size   = new Size(150, 180),
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                AccessibilityHighlightable = true,
            };

            var imageViewA = new ImageView()
            {
                Size               = new Size(150, 150),
                ResourceUrl        = imagePath + "gallery-large-9.jpg",
                CornerRadius       = 0.3f,
                CornerRadiusPolicy = VisualTransformPolicyType.Relative,
            };

            var textViewA = new TextLabel()
            {
                Text = "Default",
            };

            defaultBorder.Add(imageViewA);
            defaultBorder.Add(textViewA);
            appFunctionList.Add(defaultBorder);
            defaultBorder.TouchEvent += (s, e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    CreateSubWindowOne();
                }
                return(true);
            };
            defaultBorder.AccessibilityActivated += (s, e) =>
            {
                CreateSubWindowOne();
            };

            var customBorder = new View()
            {
                Size   = new Size(150, 180),
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                },
                AccessibilityHighlightable = true,
            };

            var imageViewB = new ImageView()
            {
                Size               = new Size(150, 150),
                ResourceUrl        = imagePath + "gallery-large-5.jpg",
                CornerRadius       = 0.3f,
                CornerRadiusPolicy = VisualTransformPolicyType.Relative,
            };
            var textViewB = new TextLabel()
            {
                Text = "Custom",
            };

            customBorder.Add(imageViewB);
            customBorder.Add(textViewB);
            appFunctionList.Add(customBorder);
            customBorder.TouchEvent += (s, e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Up)
                {
                    CreateSubWindowTwo();
                }
                return(true);
            };
            customBorder.AccessibilityActivated += (s, e) =>
            {
                CreateSubWindowTwo();
            };
        }
Exemple #29
0
    public void ResizeMoveWindowTest()
    {
        if (!_textButton[1]._window)
        {
            _textButton[1]._window = new Window(new Rectangle(0, 0, 720, 1280))
            {
                BackgroundColor = Color.Cyan,
                Title           = "new window 2",
            };
            _textButton[1]._button.Text = _textButton[1]._text;

            var layout = new FlexLayout()
            {
                Direction      = FlexLayout.FlexDirection.Column,
                Justification  = FlexLayout.FlexJustification.SpaceAround,
                ItemsAlignment = FlexLayout.AlignmentType.Center,
            };

            var view = new ImageView("./res/images/background-2.jpg")
            {
                Layout              = layout,
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            _textButton[1]._window.Add(view);

            Button resizeButton = new Button()
            {
                Name = "resize-button",
                Text = "Click me to resize this window",
            };

            resizeButton.Clicked += (sender, e) =>
            {
                Size2D windowSize = _textButton[1]._window.WindowSize;
                if (windowSize.Width > windowSize.Height)
                {
                    windowSize.Width /= 2;
                }
                else
                {
                    windowSize.Width *= 2;
                }
                _textButton[1]._window.WindowSize = windowSize;
            };

            view.Add(resizeButton);

            Button moveButton = new Button()
            {
                Name = "move-button",
                Text = "Click me to move this window right",
            };

            moveButton.Clicked += (sender, e) =>
            {
                Position2D windowPosition = _textButton[1]._window.WindowPosition;
                windowPosition.X += 100;
                _textButton[1]._window.WindowPosition = windowPosition;
            };

            view.Add(moveButton);
        }
        else
        {
            _textButton[1]._window.Raise();
        }
    }
Exemple #30
0
        public View NewItemView(uint itemId)
        {
            // Create an image view for this item
            string imagePath = CommonResource.GetDaliResourcePath() + "ItemViewDemo/gallery/gallery-medium-";
            uint   id        = itemId % 53;

            imagePath += id.ToString();
            imagePath += ".jpg";
            PropertyMap propertyMap = new PropertyMap();

            propertyMap.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
            propertyMap.Insert(ImageVisualProperty.URL, new PropertyValue(imagePath));
            propertyMap.Insert(ImageVisualProperty.FittingMode, new PropertyValue((int)VisualFittingModeType.FitKeepAspectRatio));
            ImageView actor = new ImageView();

            actor.Image = propertyMap;

            // Add a border image child actor
            ImageView borderActor = new ImageView();

            borderActor.ParentOrigin           = ParentOrigin.Center;
            borderActor.PivotPoint             = PivotPoint.Center;
            borderActor.PositionUsesPivotPoint = true;
            borderActor.HeightResizePolicy     = ResizePolicyType.SizeFixedOffsetFromParent;
            borderActor.WidthResizePolicy      = ResizePolicyType.SizeFixedOffsetFromParent;
            borderActor.SetSizeModeFactor(new Vector3(2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f));
            borderActor.SetColorMode(ColorMode.UseParentColor);

            PropertyMap borderProperty = new PropertyMap();

            borderProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border));
            borderProperty.Insert(BorderVisualProperty.Color, new PropertyValue(Color.White));
            borderProperty.Insert(BorderVisualProperty.Size, new PropertyValue(ITEM_BORDER_SIZE));
            borderProperty.Insert(BorderVisualProperty.AntiAliasing, new PropertyValue(true));
            borderActor.Image = borderProperty;

            actor.Add(borderActor);

            Size spiralItemSize = new Size(30, 30, 0);
            // Add a checkbox child actor; invisible until edit-mode is enabled
            ImageView checkBox = new ImageView();

            checkBox.Name = "CheckBox";
            checkBox.SetColorMode(ColorMode.UseParentColor);
            checkBox.ParentOrigin = ParentOrigin.TopRight;
            checkBox.PivotPoint   = PivotPoint.TopRight;
            checkBox.Size         = spiralItemSize;
            checkBox.PositionZ    = 0.1f;

            PropertyMap solidColorProperty = new PropertyMap();

            solidColorProperty.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color));
            solidColorProperty.Insert(ColorVisualProperty.MixColor, new PropertyValue(new Color(0.0f, 0.0f, 0.0f, 0.6f)));
            checkBox.Image = solidColorProperty;

            if (Mode.MODE_REMOVE_MANY != mMode &&
                Mode.MODE_INSERT_MANY != mMode &&
                Mode.MODE_REPLACE_MANY != mMode)
            {
                checkBox.Hide();
            }
            borderActor.Add(checkBox);

            ImageView tick = new ImageView(SELECTED_IMAGE);

            tick.Name         = "Tick";
            tick.ParentOrigin = ParentOrigin.TopRight;
            tick.PivotPoint   = PivotPoint.TopRight;
            tick.Size         = spiralItemSize;
            tick.Hide();
            checkBox.Add(tick);

            if (mTapDetector)
            {
                mTapDetector.Attach(actor);
            }
            return(actor);
        }