Example #1
0
        private View GetCircularRangeColors()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };
            RangeColorCollection rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = Color.ParseColor("#36BBE1"), Start = 0, End = 25
                },
                new RangeColor {
                    Color = Color.ParseColor("#9AEDE1"), Start = 25, End = 50
                },
                new RangeColor {
                    Color = Color.ParseColor("#FFDC28"), Start = 50, End = 75
                },
                new RangeColor {
                    Color = Color.ParseColor("#E15E0D"), Start = 75, End = 100
                }
            };
            SfCircularProgressBar progressBar = new SfCircularProgressBar(this.context)
            {
                Progress          = 100,
                ShowProgressValue = false,
                RangeColors       = rangeColorCollection,
                LayoutParameters  = this.layoutParams
            };

            progressBar.ValueChanged += this.ProgressBar_ValueChanged100;
            linearLayout.AddView(progressBar);
            return(linearLayout);
        }
Example #2
0
        private View GetLinearRangeColorsWithGradient()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Gradient"));

            RangeColorCollection rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#E9ECF7"), Start = 0, End = 20
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#A0D9EF"), Start = 20, End = 40
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#62C1E5"), Start = 40, End = 60
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#20A7DB"), Start = 60, End = 80
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#1C96C5"), Start = 80, End = 100
                }
            };

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration = 10000,
                Progress          = 100,
                LayoutParameters  = this.layoutParams,
                RangeColors       = rangeColorCollection
            };

            progressBar.ValueChanged += this.ProgressBar_ValueChanged;
            linearLayout.AddView(progressBar);
            return(linearLayout);
        }
Example #3
0
        private View GetLinearRangeColors()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Range colors"));

            RangeColorCollection rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = Color.ParseColor("#36BBE1"), Start = 0, End = 25
                },
                new RangeColor {
                    Color = Color.ParseColor("#9AEDE1"), Start = 25, End = 50
                },
                new RangeColor {
                    Color = Color.ParseColor("#FFDC28"), Start = 50, End = 75
                },
                new RangeColor {
                    Color = Color.ParseColor("#E15E0D"), Start = 75, End = 100
                }
            };

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration = 10000,
                Progress          = 100,
                LayoutParameters  = this.layoutParams,
                RangeColors       = rangeColorCollection
            };

            linearLayout.AddView(progressBar);
            progressBar.ValueChanged += this.ProgressBar_ValueChanged;
            return(linearLayout);
        }
Example #4
0
        public Linear()
        {
            this.linearDeterminateLable             = this.GetLabel("Determinate");
            this.linearIndeterminateLabel           = this.GetLabel("Indeterminate");
            this.linearCornerRadiusLabel            = this.GetLabel("Corner radius");
            this.linearRangeColorsLabel             = this.GetLabel("Range color");
            this.linearRangeColorsWithGradientLabel = this.GetLabel("Gradient");
            this.linearPaddingLabel = this.GetLabel("Padding");
            this.linearBufferLabel  = this.GetLabel("Buffer");
            this.linearSegmentLable = this.GetLabel("Segment");
            this.linearSegmentedCornerRadiusLabel = this.GetLabel("Segment with corner radius");

            // Determinate progress bar.
            this.linearDeterminate = new SfLinearProgressBar
            {
                Progress = 75,
            };

            // Indeterminate progress bar.
            linearIndeterminate = new SfLinearProgressBar
            {
                IsIndeterminate = true
            };

            // Progres bar with corner radius.
            this.linearCornerRadius = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                CornerRadius      = 10,
            };
            this.linearCornerRadius.ValueChanged += this.ProgressBar_ValueChanged;


            // Progress bar with padding.
            this.linearPadding = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                IndicatorPadding  = new UIEdgeInsets(1, 1, 1, 1),
                CornerRadius      = 10,
            };
            this.linearPadding.ValueChanged += this.ProgressBar_ValueChanged;

            var rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = UIColor.FromRGB(54, 187, 225), Start = 0, End = 25
                },
                new RangeColor {
                    Color = UIColor.FromRGB(154, 237, 225), Start = 25, End = 50
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 220, 40), Start = 50, End = 75
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 94, 13), Start = 75, End = 100
                }
            };

            // Progress bar with range colors customization.
            this.linearRangeColors = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                RangeColors       = rangeColorCollection,
            };
            this.linearRangeColors.ValueChanged += this.ProgressBar_ValueChanged;

            var gradianRangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(233, 236, 247), Start = 0, End = 20
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(160, 217, 239), Start = 20, End = 40
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(98, 193, 229), Start = 40, End = 60
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(32, 167, 219), Start = 60, End = 80
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(8, 150, 197), Start = 80, End = 100
                }
            };

            // Progress bar with gradient range colors.
            this.linearRangeColorsWithGradient = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                RangeColors       = gradianRangeColorCollection,
            };
            this.linearRangeColorsWithGradient.ValueChanged += this.ProgressBar_ValueChanged;

            // Progress bar with secondary progress.
            this.linearBuffer = new SfLinearProgressBar
            {
                AnimationDuration          = 2000,
                SecondaryAnimationDuration = 1000,
                Progress          = 100,
                SecondaryProgress = 100,
            };

            // Progress bar with segments.
            this.linearSegment = new SfLinearProgressBar
            {
                Progress     = 75,
                SegmentCount = 4
            };

            // Segmented progress bar with corner radius.
            this.linearSegmentedCornerRadius = new SfLinearProgressBar
            {
                Progress          = 100,
                CornerRadius      = 10,
                SegmentCount      = 4,
                GapWidth          = 7,
                AnimationDuration = 2000,
            };
            this.linearSegmentedCornerRadius.ValueChanged += this.ProgressBar_ValueChanged;

            AddSubview(this.linearDeterminate);
            AddSubview(this.linearIndeterminate);
            AddSubview(this.linearCornerRadius);
            AddSubview(this.linearRangeColors);
            AddSubview(this.linearRangeColorsWithGradient);
            AddSubview(this.linearPadding);
            AddSubview(this.linearBuffer);
            AddSubview(this.linearSegment);
            AddSubview(this.linearSegmentedCornerRadius);

            AddSubview(this.linearDeterminateLable);
            AddSubview(this.linearIndeterminateLabel);
            AddSubview(this.linearCornerRadiusLabel);
            AddSubview(this.linearRangeColorsLabel);
            AddSubview(this.linearRangeColorsWithGradientLabel);
            AddSubview(this.linearPaddingLabel);
            AddSubview(this.linearBufferLabel);
            AddSubview(this.linearSegmentLable);
            AddSubview(this.linearSegmentedCornerRadiusLabel);
        }
Example #5
0
        public Circular()
        {
            scrollView = new UIScrollView();
            this.AddSubview(scrollView);

            CircularDeterminateLabel = this.GetLabel("Detminate and indeterminate");
            CircularDeterminate      = new SfCircularProgressBar
            {
                Progress = 75
            };

            CircularInDeterminate = new SfCircularProgressBar
            {
                IsIndeterminate = true
            };

            scrollView.AddSubview(CircularDeterminateLabel);
            scrollView.AddSubview(CircularDeterminate);
            scrollView.AddSubview(CircularInDeterminate);

            CircularCustomContentLabel = this.GetLabel("Custom content");
            CircularCustomContent      = new SfCircularProgressBar()
            {
                Progress          = 75,
                AnimationDuration = 1,
            };
            this.SetCustomContentProgress();

            this.CircularVideoPlayer = new SfCircularProgressBar()
            {
                Progress             = 100,
                TrackInnerRadius     = 0f,
                IndicatorOuterRadius = 0.7f,
                IndicatorInnerRadius = 0.65f,
                AnimationDuration    = 2000,
            };
            this.CircularVideoPlayer.ValueChanged += this.ProgressBar_ValueChanged100;


            scrollView.AddSubview(this.CircularCustomContentLabel);
            scrollView.AddSubview(this.CircularCustomContent);
            scrollView.AddSubview(this.CircularVideoPlayer);

            UIView customView = new UIView();

            customView.Frame  = new CGRect(0, 40, 100, 80);
            playButton        = new UIButton();
            playButton.Hidden = true;
            playButton.SetImage(UIImage.FromFile("SfProgressPlay.png"), UIControlState.Normal);
            playButton.BackgroundColor = UIColor.Clear;
            pauseButton = new UIButton();
            pauseButton.BackgroundColor = UIColor.Clear;
            pauseButton.SetImage(UIImage.FromFile("SfProgressPause.png"), UIControlState.Normal);
            string deviceType = UIDevice.CurrentDevice.Model;

            if (deviceType == "iPhone" || deviceType == "iPod touch")
            {
                playButton.Frame  = new CGRect(18, 25, 65, 30);
                pauseButton.Frame = new CGRect(18, 25, 65, 30);
            }
            else
            {
                playButton.Frame  = new CGRect(0, 23, 100, 33);
                pauseButton.Frame = new CGRect(0, 23, 100, 33);
            }
            customView.AddSubview(playButton);
            customView.AddSubview(pauseButton);
            playButton.TouchUpInside += (sender, e) =>
            {
                this.CircularVideoPlayer.Progress = 100;
                this.pauseButton.Hidden           = false;
                this.playButton.Hidden            = true;
            };
            pauseButton.TouchUpInside += (sender, e) =>
            {
                this.CircularVideoPlayer.Progress =
                    (double)GetInternalPropertyValue(typeof(ProgressBarBase), this.CircularVideoPlayer, "ActualProgress");
                this.playButton.Hidden  = false;
                this.pauseButton.Hidden = true;
            };
            this.CircularVideoPlayer.Content = customView;

            this.CircularRadiusCustomizationLabel = this.GetLabel("Radius customization");
            this.CircularTrackOutside             = new SfCircularProgressBar()
            {
                Progress             = 100,
                IndicatorOuterRadius = 0.7f,
                IndicatorInnerRadius = 0.65f,
                ShowProgressValue    = false,
                AnimationDuration    = 2000,
            };
            this.CircularTrackOutside.ValueChanged += this.ProgressBar_ValueChanged100;

            this.CircularFilledIndicator = new SfCircularProgressBar()
            {
                Progress             = 100,
                IndicatorOuterRadius = 0.7f,
                IndicatorInnerRadius = 0f,
                ShowProgressValue    = false,
                AnimationDuration    = 2000,
            };
            this.CircularFilledIndicator.ValueChanged += this.ProgressBar_ValueChanged100;

            CircularTrackInside = new SfCircularProgressBar()
            {
                TrackOuterRadius  = 0.7f,
                TrackInnerRadius  = 0f,
                ShowProgressValue = true,
                AnimationDuration = 1,
            };

            this.SetTrackInsideStyleProgress();

            this.CircularThinTrackStyle = new SfCircularProgressBar()
            {
                Progress             = 100,
                IndicatorOuterRadius = 0.75f,
                IndicatorInnerRadius = 0.6f,
                TrackOuterRadius     = 0.7f,
                TrackInnerRadius     = 0.65f,
                AnimationDuration    = 2000,
                ShowProgressValue    = false,
            };
            this.CircularThinTrackStyle.ValueChanged += this.ProgressBar_ValueChanged100;

            scrollView.AddSubview(CircularRadiusCustomizationLabel);
            scrollView.AddSubview(CircularTrackOutside);
            scrollView.AddSubview(CircularFilledIndicator);
            scrollView.AddSubview(CircularTrackInside);
            scrollView.AddSubview(CircularThinTrackStyle);

            this.CircularSegmentLabel = this.GetLabel("Segment");
            this.CircularSegment      = new SfCircularProgressBar()
            {
                Progress          = 75,
                ShowProgressValue = false,
                SegmentCount      = 4,
                AnimationDuration = 2000,
            };
            this.CircularSegment.ValueChanged += this.ProgressBar_ValueChanged75;

            this.CircularSegmentPadding = new SfCircularProgressBar()
            {
                Progress             = 75,
                ShowProgressValue    = false,
                TrackInnerRadius     = 0.6f,
                IndicatorInnerRadius = 0.65f,
                IndicatorOuterRadius = 0.7f,
                AnimationDuration    = 2000,
                SegmentCount         = 4
            };
            this.CircularSegmentPadding.ValueChanged += this.ProgressBar_ValueChanged75;

            CircularSegmentFillStyle = new SfCircularProgressBar()
            {
                ShowProgressValue = false,
                SegmentCount      = 20,
                AnimationDuration = 1,
            };
            this.SetSegmentedFillingStyleProgress();

            scrollView.AddSubview(CircularSegmentLabel);
            scrollView.AddSubview(CircularSegment);
            scrollView.AddSubview(CircularSegmentPadding);
            scrollView.AddSubview(CircularSegmentFillStyle);

            this.CircularAngleCustomizationLabel = this.GetLabel("Angle customization");
            this.CircularAngleCustomization      = new SfCircularProgressBar()
            {
                Progress          = 100,
                StartAngle        = 130,
                EndAngle          = 410,
                AnimationDuration = 2000,
                ShowProgressValue = false
            };
            this.CircularAngleCustomization.ValueChanged += this.ProgressBar_ValueChanged100;

            scrollView.AddSubview(CircularAngleCustomizationLabel);
            scrollView.AddSubview(CircularAngleCustomization);

            this.CircularRangeColorsLabel = this.GetLabel("Range colors");
            var rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = UIColor.FromRGB(54, 187, 225), Start = 0, End = 25
                },
                new RangeColor {
                    Color = UIColor.FromRGB(154, 237, 225), Start = 25, End = 50
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 220, 40), Start = 50, End = 75
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 94, 13), Start = 75, End = 100
                }
            };

            this.CircularRangeColors = new SfCircularProgressBar()
            {
                Progress          = 100,
                AnimationDuration = 2000,
                ShowProgressValue = false,
                RangeColors       = rangeColorCollection
            };
            this.CircularRangeColors.ValueChanged += ProgressBar_ValueChanged100;

            scrollView.AddSubview(CircularRangeColorsLabel);
            scrollView.AddSubview(CircularRangeColors);
        }
        public void colorTheStatusBars(double process, SfLinearProgressBar bar, string type)
        {
            ready = false;
            double segments = 0;
            double grade    = 0;

            if (type == "CA")
            {
                segments = _subject.CA / 3;
                grade    = _subject.CA;
            }
            else if (type == "FE")
            {
                segments = _subject.FinalExam / 3;
                grade    = _subject.FinalExam;
            }
            else if (type == "GPA")
            {
                segments = 100 / 3;
                grade    = 100;
            }

            RangeColorCollection rangeColors = new RangeColorCollection();

            if (type == "CA" || type == "FE")
            {
                if (process <= grade / 3)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#ffcccb"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Red, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if ((process > grade / 3) && (process < grade / 3 * 2))
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#FDE8D3"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Orange, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if (process >= grade / 3 * 2)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#d2f8d2"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Green, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
            }
            else if (type == "GPA")
            {
                if (process < 40)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#ffcccb"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Red, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if ((process >= 40) && (process < 70))
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#FDE8D3"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Orange, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if (process > 70)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#d2f8d2"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#287c37"), IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
            }
            ready = true;
        }