public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     try
     {
         if (Math.Abs(e1.GetY() - e2.GetY()) > SWIPE_MAX_OFF_PATH)
         {
             return false;
         }
         if (e1.GetX() - e2.GetX() > SWIPE_MIN_DISTANCE
                 && Math.Abs(velocityX) > SWIPE_THRESHOLD_VELOCITY)
         {
             NextButton.CallOnClick();
         }
         else if (e2.GetX() - e1.GetX() > SWIPE_MIN_DISTANCE
                 && Math.Abs(velocityX) > SWIPE_THRESHOLD_VELOCITY)
         {
             splash.DoSplashSwipe(Splash.SwipeDirection.Backward);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Crashlytics.Crashlytics.LogException(Java.Lang.Throwable.FromException(e));
     }
     return base.OnFling(e1, e2, velocityX, velocityY);
 }
 public override void OnBackPressed()
 {
     if (_backButton.Enabled)
     {
         _backButton.CallOnClick();
     }
     else
     {
         base.OnBackPressed();
     }
 }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View view = inflater.Inflate(Resource.Layout.PopularActivity, container, false);


			Scope = "Local";
			Type = "Timed";

			TopTimedGlobalPostFeedFragment = new PostFeedFragment();
			TopTimedGlobalPostFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedGlobalPostFeedFragment.Master = this;
			TopTimedGlobalPostFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimedFeed;
			TopTimedGlobalPostFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimedLocalFeedFragment = new PostFeedFragment();
			TopTimedLocalFeedFragment.EmptyTableString = Strings.no_active_posts;
			TopTimedLocalFeedFragment.Master = this;
			TopTimedLocalFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimedFeed;
			TopTimedLocalFeedFragment.NewPageContainerID = Resource.Id.fragment_container_page;

			TopTimersGlobalUserFeedFragment = new UserFeedFragment();
			TopTimersGlobalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersGlobalUserFeedFragment.Master = this;
			TopTimersGlobalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularGlobalTimersFeed;

			TopTimersLocalUserFeedFragment = new UserFeedFragment();
			TopTimersLocalUserFeedFragment.EmptyTableString = Strings.no_users_found;
			TopTimersLocalUserFeedFragment.Master = this;
			TopTimersLocalUserFeedFragment.Target = FeedTypeEnum.FeedType.PopularLocalTimersFeed;

			View toolbarLayout = view.FindViewById(Resource.Id.toolbarLayout);
			((TextView)toolbarLayout.FindViewById(Resource.Id.toolbar_titleCenter)).Text = "Popular";


			timersButton = (Button)view.FindViewById(Resource.Id.timers);
			timersButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControl);
				timedButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControlSelected);
				timersButton.SetTextColor(Android.Graphics.Color.White);
				Type = "Timers";
				ShowCorrectPage();
			};

			timedButton = (Button)view.FindViewById(Resource.Id.timed);
			timedButton.Click += delegate
			{
				timedButton.SetBackgroundResource(Resource.Drawable.LeftSegmentedControlSelected);
				timedButton.SetTextColor(Android.Graphics.Color.White);
				timersButton.SetBackgroundResource(Resource.Drawable.RightSegmentedControl);
				timersButton.SetTextColor(Android.Graphics.Color.ParseColor("#338a9e"));
				Type = "Timed";
				ShowCorrectPage();
			};


			localButton = (ImageButton)view.FindViewById(Resource.Id.local);
			localButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.localselected);
				globalButton.SetImageResource(Resource.Drawable.global);
				Scope = "Local";
				ShowCorrectPage();
			};

			globalButton = (ImageButton)view.FindViewById(Resource.Id.global);
			globalButton.Click += delegate
			{
				localButton.SetImageResource(Resource.Drawable.local);
				globalButton.SetImageResource(Resource.Drawable.globalselected);
				Scope = "Global";
				ShowCorrectPage();
			};

			timedButton.CallOnClick();
			localButton.CallOnClick();

			return view;

		}