Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            firstCreate = true;
            handler     = new Handler();
            prefs       = new PreferenceManager(this);

            circlesFragment = new CirclesFragment();
            statsFragment   = new StatsFragment();

            SetContentView(Resource.Layout.Main);

            pager         = FindViewById <Android.Support.V4.View.ViewPager> (Resource.Id.mainPager);
            pager.Adapter = new StaticFragmentPagerAdapter(SupportFragmentManager, circlesFragment, statsFragment);

            background = new DynamicGradientDrawable(Resources.GetColor(Resource.Color.top_shade_1),
                                                     Resources.GetColor(Resource.Color.bottom_shade_1),
                                                     Resources.GetColor(Resource.Color.top_shade_2),
                                                     Resources.GetColor(Resource.Color.bottom_shade_2));
            pager.SetBackgroundDrawable(background);
            pager.PageScrolled  += HandlePageScrolled;
            pager.OverScrollMode = OverScrollMode.Never;
            if (prefs.FirstTimeAround)
            {
                pager.Touch += DiscardTouchEventHandler;
            }

            circlesTab              = ActionBar.NewTab().SetIcon(Resource.Drawable.ic_tab_circles);
            statsTab                = ActionBar.NewTab().SetIcon(Resource.Drawable.ic_tab_stats);
            circlesTab.TabSelected += (sender, e) => pager.SetCurrentItem(0, true);
            statsTab.TabSelected   += (sender, e) => pager.SetCurrentItem(1, true);
            ActionBar.AddTab(circlesTab);
            ActionBar.AddTab(statsTab);
            pager.PageSelected += (sender, e) => ActionBar.SetSelectedNavigationItem(e.Position);

            circlesFragment.CirclesReady += OnCirclesReady;
        }
Example #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			firstCreate = true;
			handler = new Handler ();
			prefs = new PreferenceManager (this);

			circlesFragment = new CirclesFragment ();
			statsFragment = new StatsFragment ();

			SetContentView (Resource.Layout.Main);

			pager = FindViewById<Android.Support.V4.View.ViewPager> (Resource.Id.mainPager);
			pager.Adapter = new StaticFragmentPagerAdapter (SupportFragmentManager, circlesFragment, statsFragment);

			background = new DynamicGradientDrawable (Resources.GetColor (Resource.Color.top_shade_1),
			                                          Resources.GetColor (Resource.Color.bottom_shade_1),
			                                          Resources.GetColor (Resource.Color.top_shade_2),
			                                          Resources.GetColor (Resource.Color.bottom_shade_2));
			pager.SetBackgroundDrawable (background);
			pager.PageScrolled += HandlePageScrolled;
			pager.OverScrollMode = OverScrollMode.Never;
			if (prefs.FirstTimeAround)
				pager.Touch += DiscardTouchEventHandler;

			circlesTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_circles);
			statsTab = ActionBar.NewTab ().SetIcon (Resource.Drawable.ic_tab_stats);
			circlesTab.TabSelected += (sender, e) => pager.SetCurrentItem (0, true);
			statsTab.TabSelected += (sender, e) => pager.SetCurrentItem (1, true);
			ActionBar.AddTab (circlesTab);
			ActionBar.AddTab (statsTab);
			pager.PageSelected += (sender, e) => ActionBar.SetSelectedNavigationItem (e.Position);

			circlesFragment.CirclesReady += OnCirclesReady;
		}