Exemple #1
0
        void setupViewPager()
        {
            PagerAdapter = new WeatherPagerAdapter(SupportFragmentManager);

            viewPager         = (ViewPager)FindViewById(Resource.Id.viewPager);
            viewPager.Adapter = PagerAdapter;

            viewPager.CurrentItem = Settings.WeatherPage;

            updateBackground();

            viewPager.PageSelected += (sender, e) => {
                Settings.WeatherPage = e.Position;

                updateBackground();
            };
        }
Exemple #2
0
        void setupViewPager()
        {
            pagerAdapter = new WeatherPagerAdapter(SupportFragmentManager);

            viewPager         = (ViewPager)FindViewById(Resource.Id.viewPager);
            viewPager.Adapter = pagerAdapter;

            viewPager.CurrentItem = Settings.WeatherPage;

            updateBackground();

            viewPager.PageSelected += (sender, e) =>
            {
                Analytics.TrackPageViewEnd(pagerAdapter.GetFragmentAtPosition(viewPagerCache), WuClient.Shared.Selected);

                Analytics.TrackPageViewStart(pagerAdapter.GetFragmentAtPosition(viewPager.CurrentItem), childPageName(viewPager.CurrentItem), WuClient.Shared.Selected);

                Settings.WeatherPage = e.Position;

                floatingButton?.Show();

                updateBackground();
            };


            viewPager.PageScrollStateChanged += (sender, e) =>
            {
                switch (e.State)
                {
                case ViewPager.ScrollStateDragging:

                    viewPagerCache = viewPager.CurrentItem;

                    break;

                case ViewPager.ScrollStateIdle:

                    var fragment = pagerAdapter?.GetFragmentAtPosition(viewPagerCache) as IRecyclerViewFragment;

                    fragment?.RecyclerView?.ScrollToPosition(0);

                    break;
                }
            };
        }
		void setupViewPager ()
		{
			pagerAdapter = new WeatherPagerAdapter (SupportFragmentManager);

			viewPager = (ViewPager)FindViewById (Resource.Id.viewPager);
			viewPager.Adapter = pagerAdapter;

			viewPager.CurrentItem = Settings.WeatherPage;

			updateBackground ();

			viewPager.PageSelected += (sender, e) =>
			{
				Analytics.TrackPageViewEnd (pagerAdapter.GetFragmentAtPosition (viewPagerCache), WuClient.Shared.Selected);

				Analytics.TrackPageViewStart (pagerAdapter.GetFragmentAtPosition (viewPager.CurrentItem), childPageName (viewPager.CurrentItem), WuClient.Shared.Selected);

				Settings.WeatherPage = e.Position;

				floatingButton?.Show ();

				updateBackground ();
			};


			viewPager.PageScrollStateChanged += (sender, e) =>
			{
				switch (e.State)
				{
					case ViewPager.ScrollStateDragging:

						viewPagerCache = viewPager.CurrentItem;

						break;
					case ViewPager.ScrollStateIdle:

						var fragment = pagerAdapter?.GetFragmentAtPosition (viewPagerCache) as IRecyclerViewFragment;

						fragment?.RecyclerView?.ScrollToPosition (0);

						break;
				}
			};
		}