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);
        }
예제 #2
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);
        }
        void init(View view)
        {
            mContainer = view.FindViewById <LinearLayout>(Resource.Id.linearLayout1);

            mTvTitle       = view.FindViewById <TextView>(Resource.Id.textView1);
            mTvDiscription = view.FindViewById <TextView>(Resource.Id.textView2);

            mAnimationLTR = AnimationUtils.LoadAnimation(Activity, Resource.Animation.left_to_right);
            mAnimationRTL = AnimationUtils.LoadAnimation(Activity, Resource.Animation.right_to_left);

            // رویداد کلیک روی عنوان
            mTvTitle.Click += delegate { RunAction(); };

            //رویداد کلیک روی توضیحات عکس
            mTvDiscription.Click += delegate { RunAction(); };


            mAdapter = new AdapterPagerSlide(Activity.SupportFragmentManager, mSlides);

            mPager         = view.FindViewById <ViewPager>(Resource.Id.pager);
            mPager.Adapter = mAdapter;
            mPager.AddOnPageChangeListener(this);



            CirclePageIndicator indicator = view.FindViewById <CirclePageIndicator>(Resource.Id.indicator);

            mIndicator = indicator;
            indicator.SetViewPager(mPager);
            indicator.SetBackgroundColor(Android.Graphics.Color.Transparent);

            SetConfig(mConfig);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            view = inflater.Inflate(Resource.Layout.translator_view, container, false);

            viewPager = view.FindViewById <ViewPager>(Resource.Id.vp_fragments);
            indicator = view.FindViewById <CirclePageIndicator>(Resource.Id.indicator);

            indicator.SetViewPager(viewPager);
            list = new List <Fragment>()
            {
                new TranslatorFragment()
            };

            return(view);
        }
 public override void OnActivityCreated(Bundle savedInstanceState)
 {
     base.OnActivityCreated(savedInstanceState);
     indicator.SetViewPager(viewPager);
     if (TranslatorSave.NewInstance().GetCountWords == "one or null")
     {
         pagerAdapter = new Adapters.TranslatePagesAdapter(Activity.SupportFragmentManager, list, 1);
     }
     else
     {
         list.Add(new WordsListFragment());
         pagerAdapter = new Adapters.TranslatePagesAdapter(Activity.SupportFragmentManager, list, 2);
     }
     viewPager.Adapter = pagerAdapter;
     viewPager.SetCurrentItem(TranslatorSave.NewInstance().GetPosition, true);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.simple_circles);

            mAdapter = new TestFragmentAdapter(SupportFragmentManager);

            mPager         = FindViewById <ViewPager>(Resource.Id.pager);
            mPager.Adapter = mAdapter;

            CirclePageIndicator indicator = FindViewById <CirclePageIndicator>(Resource.Id.indicator);

            mIndicator = indicator;
            indicator.SetViewPager(mPager);
            indicator.Snap = true;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.chooseFiles);
            ApiService      = new ApiConsumer();
            foldersCarousel = FindViewById <ViewPager>(Resource.Id.cardCarousel);
            ImageButton next     = FindViewById <ImageButton>(Resource.Id.next);
            ImageButton previous = FindViewById <ImageButton>(Resource.Id.previous);

            continueBtn        = FindViewById <Button>(Resource.Id.continueBtn);
            continueBtn.Click += ContinueBtn_Click;

            othersBtn        = FindViewById <Button>(Resource.Id.othersBtn);
            othersBtn.Click += OthersBtn_Click;

            carouselAdapter         = new CarouselAdapter(this, folderCarousel);
            foldersCarousel.Adapter = carouselAdapter;
            CirclePageIndicator indicator = FindViewById <CirclePageIndicator>(Resource.Id.indicator);

            indicator.SetViewPager(foldersCarousel);

            one   = FindViewById <ImageView>(Resource.Id.one);
            two   = FindViewById <ImageView>(Resource.Id.two);
            three = FindViewById <ImageView>(Resource.Id.three);
            four  = FindViewById <ImageView>(Resource.Id.four);
            five  = FindViewById <ImageView>(Resource.Id.five);

            oneFile    = FindViewById <TextView>(Resource.Id.oneFile);
            secondFile = FindViewById <TextView>(Resource.Id.secondFile);
            thirthFile = FindViewById <TextView>(Resource.Id.thirthFile);
            fourFile   = FindViewById <TextView>(Resource.Id.fourFile);
            fiveFile   = FindViewById <TextView>(Resource.Id.fiveFile);

            next.Click     += Next_Click;
            previous.Click += Previous_Click;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.simple_circles);

            mAdapter = new TestFragmentAdapter(SupportFragmentManager);

            mPager         = FindViewById <ViewPager>(Resource.Id.pager);
            mPager.Adapter = mAdapter;

            CirclePageIndicator indicator = FindViewById <CirclePageIndicator>(Resource.Id.indicator);

            mIndicator = indicator;
            indicator.SetViewPager(mPager);

            float density = Resources.DisplayMetrics.Density;

            indicator.SetBackgroundColor(Android.Graphics.Color.ParseColor("#ffcccccc"));
            indicator.Radius      = 10 * density;
            indicator.PageColor   = Color.ParseColor("#880000FF");
            indicator.FillColor   = Color.ParseColor("#FF888888");
            indicator.StrokeColor = Color.ParseColor("#FF000000");
            indicator.StrokeWidth = 2 * density;
        }
        async void ItemsSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)

        {
            // NewItems contains the item that was added.

            // If NewStartingIndex is not -1, then it contains the index where the new item was added.

            if (e.Action == NotifyCollectionChangedAction.Add)

            {
                InsertPage(Element?.ItemsSource.GetItem(e.NewStartingIndex), e.NewStartingIndex);
            }



            // OldItems contains the item that was removed.

            // If OldStartingIndex is not -1, then it contains the index where the old item was removed.

            if (e.Action == NotifyCollectionChangedAction.Remove)

            {
                await RemovePage(e.OldStartingIndex);
            }



            // OldItems contains the moved item.

            // OldStartingIndex contains the index where the item was moved from.

            // NewStartingIndex contains the index where the item was moved to.

            if (e.Action == NotifyCollectionChangedAction.Move)

            {
                // Fix for #168 Android NullReferenceException

                var Source = ((PageAdapter)viewPager?.Adapter)?.Source;



                if (Element != null && viewPager != null && viewPager?.Adapter != null && Source != null)

                {
                    Source.RemoveAt(e.OldStartingIndex);

                    Source.Insert(e.NewStartingIndex, e.OldItems[e.OldStartingIndex]);

                    viewPager.Adapter?.NotifyDataSetChanged();



                    Element.SendPositionSelected();

                    Element.PositionSelectedCommand?.Execute(null);
                }
            }



            // NewItems contains the replacement item.

            // NewStartingIndex and OldStartingIndex are equal, and if they are not -1,

            // then they contain the index where the item was replaced.

            if (e.Action == NotifyCollectionChangedAction.Replace)

            {
                // Fix for #168 Android NullReferenceException

                var Source = ((PageAdapter)viewPager?.Adapter)?.Source;



                if (Element != null && viewPager != null && viewPager?.Adapter != null && Source != null)

                {
                    Source[e.OldStartingIndex] = e.NewItems[e.NewStartingIndex];

                    viewPager.Adapter?.NotifyDataSetChanged();
                }
            }



            // No other properties are valid.

            if (e.Action == NotifyCollectionChangedAction.Reset)

            {
                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);
                }
            }
        }