예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.NonAdminDashboardLayout);

            findAllElements();
            setAllStringConstants();

            _mainPagerAdapter      = new ViewPagerAdapter(this);
            _mainViewPager.Adapter = _mainPagerAdapter;
            _circlePageIndicator.SetViewPager(_mainViewPager);
            _circlePageIndicator.SetPageColor(Color.White);
            _circlePageIndicator.SetFillColor(new Color(255, 255, 255, 64));

            _nonAdminDashboardContentInstance = new NonAdminContentAdapter(this);
            _nonAdminContentView = _nonAdminDashboardContentInstance.GetView();

            _gamificationContentInstance = new GamificationViewAdapter(this);
            _gamificationView            = _gamificationContentInstance.GetView();

            _mainPagerAdapter.AddView(_nonAdminContentView);
            _mainPagerAdapter.AddView(_gamificationView);
            _mainPagerAdapter.NotifyDataSetChanged();

            var timer = new Timer();

            _dashbardGradientTask = new DashboardGradientTimerHelper(this);
            timer.Schedule(_dashbardGradientTask, 0, NumberConstants.DashboardGradientTransition.DashboardGradientTransitionLengthInMilliseconds);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.AdminDashboardLayout);
            findAllElements();

            _mainPagerAdapter      = new ViewPagerAdapter(this);
            _mainViewPager.Adapter = _mainPagerAdapter;
            _circlePageIndicator.SetViewPager(_mainViewPager);
            _circlePageIndicator.SetPageColor(Color.White);
            _circlePageIndicator.SetFillColor(CoreColorConverter.GetColor(ColorConstants.CirclePageIndicatorColor));

            _adminDashboardContentInstance = new AdminDashboardContentView(this);
            _adminDashboardContentView     = _adminDashboardContentInstance.GetView();
            _allocateButton = _adminDashboardContentInstance.GetAllocateButton();

            _allocationPageInstance = new AllocationPageView(this);
            _allocationPageView     = _allocationPageInstance.GetView();

            _mainPagerAdapter.AddView(_adminDashboardContentView);
            _mainPagerAdapter.AddView(_allocationPageView);
            _mainPagerAdapter.NotifyDataSetChanged();

            var timer = new Timer();

            _dashbardGradientTask = new DashboardGradientTimerHelper(this);
            timer.Schedule(_dashbardGradientTask, 0, NumberConstants.DashboardGradientTransition.DashboardGradientTransitionLengthInMilliseconds);
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)

        {
            base.OnElementPropertyChanged(sender, e);



            var rect = this.Element.Bounds;



            switch (e.PropertyName)

            {
            case "Orientation":

                if (Element != null)

                {
                    orientationChanged = true;

                    SetNativeView();

                    Element.SendPositionSelected();

                    Element.PositionSelectedCommand?.Execute(null);
                }

                break;

            case "InterPageSpacing":

                //var metrics = Resources.DisplayMetrics;

                //var interPageSpacing = Element.InterPageSpacing * metrics.Density;

                //viewPager.PageMargin = (int)interPageSpacing;

                break;

            case "BackgroundColor":

                viewPager?.SetBackgroundColor(Element.BackgroundColor.ToAndroid());

                break;

            case "IsSwipingEnabled":

                SetIsSwipingEnabled();

                break;

            case "IndicatorsTintColor":

                indicators?.SetFillColor(Element.IndicatorsTintColor.ToAndroid());

                break;

            case "CurrentPageIndicatorTintColor":

                indicators?.SetPageColor(Element.CurrentPageIndicatorTintColor.ToAndroid());

                break;

            case "IndicatorsShape":

                indicators?.SetStyle(Element.IndicatorsShape);

                break;

            case "ShowIndicators":

                SetIndicators();

                break;

            case "ItemsSource":

                if (Element != null && viewPager != null)

                {
                    SetPosition();

                    viewPager.Adapter = new PageAdapter(Element);

                    viewPager.SetCurrentItem(Element.Position, false);

                    indicators?.SetViewPager(viewPager);

                    Element.SendPositionSelected();

                    Element.PositionSelectedCommand?.Execute(null);

                    if (Element.ItemsSource != null && Element.ItemsSource is INotifyCollectionChanged)
                    {
                        ((INotifyCollectionChanged)Element.ItemsSource).CollectionChanged += ItemsSource_CollectionChanged;
                    }
                }

                break;

            case "ItemTemplate":

                if (Element != null && viewPager != null)

                {
                    viewPager.Adapter = new PageAdapter(Element);

                    viewPager.SetCurrentItem(Element.Position, false);

                    indicators?.SetViewPager(viewPager);

                    Element.SendPositionSelected();

                    Element.PositionSelectedCommand?.Execute(null);
                }

                break;

            case "Position":

                if (Element != null && !isSwiping)

                {
                    SetCurrentPage(Element.Position);
                }

                break;

            case "ShowArrows":

                SetArrows();

                break;

            case "ArrowsBackgroundColor":

                if (prevBtn != null && nextBtn != null)

                {
                    prevBtn.SetBackgroundColor(Element.ArrowsBackgroundColor.ToAndroid());

                    nextBtn.SetBackgroundColor(Element.ArrowsBackgroundColor.ToAndroid());
                }

                break;

            case "ArrowsTintColor":

                if (prevBtn != null && nextBtn != null)

                {
                    var prevArrow = nativeView.FindViewById <AWidget.ImageView>(Resource.Id.prevArrow);

                    prevArrow.SetColorFilter(Element.ArrowsTintColor.ToAndroid());

                    var nextArrow = nativeView.FindViewById <AWidget.ImageView>(Resource.Id.nextArrow);

                    nextArrow.SetColorFilter(Element.ArrowsTintColor.ToAndroid());
                }

                break;
            }
        }
예제 #4
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (Element == null || viewPager == null)
            {
                return;
            }

            var rect = this.Element.Bounds;

            switch (e.PropertyName)
            {
            case "Orientation":
                orientationChanged = true;
                SetNativeView();
                Element.SendPositionSelected();
                Element.PositionSelectedCommand?.Execute(null);
                break;

            case "BackgroundColor":
                viewPager.SetBackgroundColor(Element.BackgroundColor.ToAndroid());
                break;

            case "IsSwipeEnabled":
                SetIsSwipeEnabled();
                break;

            case "IndicatorsTintColor":
                indicators?.SetFillColor(Element.IndicatorsTintColor.ToAndroid());
                break;

            case "CurrentPageIndicatorTintColor":
                indicators?.SetPageColor(Element.CurrentPageIndicatorTintColor.ToAndroid());
                break;

            case "IndicatorsShape":
                indicators?.SetStyle((int)Element.IndicatorsShape);
                break;

            case "ShowIndicators":
                SetIndicators();
                break;

            case "ItemsSource":
                SetPosition();
                viewPager.Adapter = new PageAdapter(Element);
                viewPager.SetCurrentItem(Element.Position, false);
                SetArrowsVisibility();
                indicators?.SetViewPager(viewPager);
                Element.SendPositionSelected();
                Element.PositionSelectedCommand?.Execute(null);
                if (Element.ItemsSource != null && Element.ItemsSource is INotifyCollectionChanged)
                {
                    ((INotifyCollectionChanged)Element.ItemsSource).CollectionChanged += ItemsSource_CollectionChanged;
                }
                break;

            case "ItemTemplate":
                viewPager.Adapter = new PageAdapter(Element);
                viewPager.SetCurrentItem(Element.Position, false);
                indicators?.SetViewPager(viewPager);
                Element.SendPositionSelected();
                Element.PositionSelectedCommand?.Execute(null);
                break;

            case "Position":
                if (!isChangingPosition)
                {
                    SetCurrentPage(Element.Position);
                }
                break;

            case "ShowArrows":
                SetArrows();
                break;

            case "ArrowsBackgroundColor":
                if (prevBtn == null || nextBtn == null)
                {
                    return;
                }
                prevBtn.SetBackgroundColor(Element.ArrowsBackgroundColor.ToAndroid());
                nextBtn.SetBackgroundColor(Element.ArrowsBackgroundColor.ToAndroid());
                break;

            case "ArrowsTintColor":
                var prevArrow = nativeView.FindViewById <AWidget.ImageView>(Resource.Id.prevArrow);
                prevArrow.SetColorFilter(Element.ArrowsTintColor.ToAndroid());
                var nextArrow = nativeView.FindViewById <AWidget.ImageView>(Resource.Id.nextArrow);
                nextArrow.SetColorFilter(Element.ArrowsTintColor.ToAndroid());
                break;

            case "ArrowsTransparency":
                if (prevBtn == null || nextBtn == null)
                {
                    return;
                }
                prevBtn.Alpha = Element.ArrowsTransparency;
                nextBtn.Alpha = Element.ArrowsTransparency;
                break;
            }
        }