Exemple #1
0
 protected virtual void OnBeforeFragmentChanging(FragmentTransaction ft, Fragment fragment, MvxFragmentPresentationAttribute attribute)
 {
     if (attribute.SharedElements != null)
     {
         foreach (var item in attribute.SharedElements)
         {
             string name = item.Key;
             if (string.IsNullOrEmpty(name))
             {
                 name = ViewCompat.GetTransitionName(item.Value);
             }
             ft.AddSharedElement(item.Value, name);
         }
     }
     if (!attribute.EnterAnimation.Equals(int.MinValue) && !attribute.ExitAnimation.Equals(int.MinValue))
     {
         if (!attribute.PopEnterAnimation.Equals(int.MinValue) && !attribute.PopExitAnimation.Equals(int.MinValue))
         {
             ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation, attribute.PopEnterAnimation, attribute.PopExitAnimation);
         }
         else
         {
             ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation);
         }
     }
     if (attribute.TransitionStyle != int.MinValue)
     {
         ft.SetTransitionStyle(attribute.TransitionStyle);
     }
 }
        protected virtual void OnBeforeFragmentChanging(FragmentTransaction ft, MvxFragmentPresentationAttribute attribute)
        {
            if (attribute.SharedElements != null)
            {
                foreach (var item in attribute.SharedElements)
                {
                    ft.AddSharedElement(item.Value, item.Key);
                }
            }

            if (!attribute.EnterAnimation.Equals(int.MinValue) && !attribute.ExitAnimation.Equals(int.MinValue))
            {
                if (!attribute.PopEnterAnimation.Equals(int.MinValue) && !attribute.PopExitAnimation.Equals(int.MinValue))
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation, attribute.PopEnterAnimation, attribute.PopExitAnimation);
                }
                else
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation);
                }
            }

            if (attribute.TransitionStyle != int.MinValue)
            {
                ft.SetTransitionStyle(attribute.TransitionStyle);
            }
        }
 protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
 {
     if (isPush)
     {
         transaction.SetCustomAnimations(global::Android.Resource.Animation.SlideInLeft, global::Android.Resource.Animation.SlideInLeft, 0, 0);
     }
     else
     {
         transaction.SetCustomAnimations(0, global::Android.Resource.Animation.SlideOutRight, 0, 0);
     }
 }
Exemple #4
0
 protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
 {
     if (isPush)
     {
         transaction.SetCustomAnimations(Resource.Animation.enter_right, Resource.Animation.exit_left,
                                         Resource.Animation.enter_left, Resource.Animation.exit_right);
     }
     else
     {
         transaction.SetCustomAnimations(Resource.Animation.enter_left, Resource.Animation.exit_right,
                                         Resource.Animation.enter_right, Resource.Animation.exit_left);
     }
 }
Exemple #5
0
        private FragmentTransaction obtainFragmentTransaction(int index)
        {
            FragmentTransaction ft = fragmentactivity.SupportFragmentManager.BeginTransaction();

            if (index > currentTab)
            {
                ft.SetCustomAnimations(Resource.Animation.slide_left_in, Resource.Animation.slide_left_out);
            }
            else
            {
                ft.SetCustomAnimations(Resource.Animation.slide_right_in, Resource.Animation.slide_right_out);
            }
            return(ft);
        }
Exemple #6
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new HomeFragment());
                ft.Commit();

                return(true);


            case Resource.Id.navigation_notifications:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new NotificationFragment());
                ft.Commit();

                return(true);
            }
            return(false);
        }
        public void OnTabSelected(Android.Support.V7.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
        {
            switch (tab.Text)
            {
            case "Cauta produs":
            {
                if ((CautaMagazinFragment != null) && (CautaProdusFragment != null))
                {
                    FragmentTransaction transact = FragmentManager.BeginTransaction();
                    transact.SetCustomAnimations(
                        Resource.Animation.ScaleToMax,
                        Resource.Animation.ScaleToZero);
                    transact.Hide(CautaMagazinFragment);
                    transact.Show(CautaProdusFragment);
                    transact.AddToBackStack(null);
                    transact.Commit();
                }
            } break;

            case "Cauta magazin":
            {
                FragmentTransaction transact = FragmentManager.BeginTransaction();
                transact.SetCustomAnimations(
                    Resource.Animation.ScaleToMax,
                    Resource.Animation.ScaleToZero);
                transact.Hide(CautaProdusFragment);
                transact.Show(CautaMagazinFragment);
                transact.AddToBackStack(null);
                transact.Commit();
            } break;
            }
        }
Exemple #8
0
        /**
         * This method animates the image fragment into the background by both
         * scaling and rotating the fragment's view, as well as adding a
         * translucent dark hover view to inform the user that it is inactive.
         */
        public void SlideBack()
        {
            View movingFragmentView = mImageFragment.View;

            PropertyValuesHolder rotateX = PropertyValuesHolder.OfFloat("rotationX", 40f);
            PropertyValuesHolder scaleX  = PropertyValuesHolder.OfFloat("scaleX", 0.8f);
            PropertyValuesHolder scaleY  = PropertyValuesHolder.OfFloat("scaleY", 0.8f);
            ObjectAnimator       movingFragmentAnimator = ObjectAnimator.
                                                          OfPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY);

            ObjectAnimator darkHoverViewAnimator = ObjectAnimator.
                                                   OfFloat(mDarkHoverView, "alpha", 0.0f, 0.5f);

            ObjectAnimator movingFragmentRotator = ObjectAnimator.
                                                   OfFloat(movingFragmentView, "rotationX", 0);

            movingFragmentRotator.StartDelay = Resources.GetInteger(Resource.Integer.half_slide_up_down_duration);

            AnimatorSet s = new AnimatorSet();

            s.PlayTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator);
            s.AnimationEnd += delegate
            {
                FragmentTransaction transaction = FragmentManager.BeginTransaction();
                transaction.SetCustomAnimations(Resource.Animator.slide_fragment_in, 0, 0, Resource.Animator.slide_fragment_out);
                transaction.Add(Resource.Id.move_to_back_container, mTextFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };
            s.Start();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            FloatingActionButton fabReport = FindViewById <FloatingActionButton>(Resource.Id.fabReport);

            fabReport.Click += FabReportOnClick;

            Android.Content.Res.ColorStateList csl = new Android.Content.Res.ColorStateList(new int[][] { new int[0] }, new int[] { Android.Graphics.Color.ParseColor("#c62828") });
            fabReport.BackgroundTintList = csl;

            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.SetOnNavigationItemSelectedListener(this);

            ft = FragmentManager.BeginTransaction();
            ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
            ft.AddToBackStack(null);
            ft.Add(Resource.Id.FrameLayout, new MapsFragment());
            ft.Commit();
        }
        protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
        {
            if (transaction != null)
            {
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.abc_slide_in_bottom, 0, 0, 0);
                }
                else
                {
                    transaction.SetCustomAnimations(0, Resource.Animation.abc_slide_out_bottom, 0, 0);
                }

                base.SetupPageTransition(transaction, isPush);
            }
        }
Exemple #11
0
 public static void SetupTransition(FragmentTransaction transaction, IPageAnimation animation, bool isPush, bool animated)
 {
     if (animation.Type != AnimationType.Empty && animation.Duration != AnimationDuration.Zero)
     {
         var animationsId = GetAnimationsId(animation, isPush);
         transaction.SetCustomAnimations(animationsId.EnterAnimationId, animationsId.ExitAnimationId);
     }
 }
Exemple #12
0
        public void replaceFragments(Fragment fragment, int idContainer, String fragmentTag, FragmentManager fragmentManager)
        {
            FragmentTransaction transaction = fragmentManager.BeginTransaction();

            transaction.SetCustomAnimations(Resource.Animator.slide_in_up, Resource.Animator.slide_in_down);
            transaction.Replace(idContainer, fragment, fragmentTag);
            transaction.AddToBackStack(null);
            transaction.Commit();
        }
Exemple #13
0
        public void removeFragment(Fragment myFrag, FragmentManager fragmentManager)
        {
            FragmentTransaction transaction = fragmentManager.BeginTransaction();

            transaction.SetCustomAnimations(Resource.Animator.slide_from_out_bottom, Resource.Animator.slide_in_bottom);
            transaction.Remove(myFrag);
            transaction.Commit();
            fragmentManager.PopBackStack();
        }
        protected virtual void OnBeforeFragmentChanging(FragmentTransaction ft, Fragment fragment, MvxFragmentPresentationAttribute attribute, MvxViewModelRequest request)
        {
            if (CurrentActivity is IMvxAndroidSharedElements sharedElementsActivity)
            {
                var elements = new List <string>();

                foreach (KeyValuePair <string, View> item in sharedElementsActivity.FetchSharedElementsToAnimate(attribute, request))
                {
                    var transitionName = item.Value.GetTransitionNameSupport();
                    if (!string.IsNullOrEmpty(transitionName))
                    {
                        ft.AddSharedElement(item.Value, transitionName);
                        elements.Add($"{item.Key}:{transitionName}");
                    }
                    else
                    {
                        MvxLog.Instance.Warn("A XML transitionName is required in order to transition a control when navigating.");
                    }
                }

                if (elements.Count > 0)
                {
                    fragment.Arguments.PutString(SharedElementsBundleKey, string.Join("|", elements));
                }
            }

            if (!attribute.EnterAnimation.Equals(int.MinValue) && !attribute.ExitAnimation.Equals(int.MinValue))
            {
                if (!attribute.PopEnterAnimation.Equals(int.MinValue) && !attribute.PopExitAnimation.Equals(int.MinValue))
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation, attribute.PopEnterAnimation, attribute.PopExitAnimation);
                }
                else
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation);
                }
            }

            if (attribute.TransitionStyle != int.MinValue)
            {
                ft.SetTransitionStyle(attribute.TransitionStyle);
            }
        }
 private void LoadNotificationFragment()
 {
     using (FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction())
     {
         fragmentTransaction.Replace(Resource.Id.MusicNotificationPlaceholder, notificationFragment);
         fragmentTransaction.SetCustomAnimations(Resource.Animation.fade_in, Resource.Animation.fade_out);
         fragmentTransaction.DisallowAddToBackStack();
         fragmentTransaction.Commit();
     }
 }
Exemple #16
0
        private void ReplaceFragment(string name, BaseFragment fragment)
        {
            _transaction = _fragmentManager.BeginTransaction();

            _transaction
            .SetCustomAnimations(Android.Resource.Animator.FadeIn, Android.Resource.Animator.FadeOut);

            _transaction
            .Replace(Resource.Id.Container, fragment)
            .AddToBackStack(name);

            _transaction.Commit();
        }
 private void StartMusicController()
 {
     // я голоден... ; хД
     using (FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction())
     {
         fragmentTransaction.Replace(Resource.Id.MusicNotificationPlaceholder, musicFragment);
         fragmentTransaction.SetCustomAnimations(Resource.Animation.fade_in, Resource.Animation.fade_out);
         fragmentTransaction.DisallowAddToBackStack();
         fragmentTransaction.Commit();
     }
     isMusicWidgetPresent = true;
     StartFloatingNotificationService();
 }
        protected virtual void SetAnimationsOnTransaction(FragmentTransaction fragmentTransaction,
                                                          MvxFragmentPresentationAttribute attribute)
        {
            if (fragmentTransaction == null)
            {
                return;
            }

            if (attribute == null)
            {
                return;
            }

            if (attribute.EnterAnimation != int.MinValue &&
                attribute.ExitAnimation != int.MinValue)
            {
                if (attribute.PopEnterAnimation != int.MinValue &&
                    attribute.PopExitAnimation != int.MinValue)
                {
                    fragmentTransaction.SetCustomAnimations(
                        attribute.EnterAnimation,
                        attribute.ExitAnimation,
                        attribute.PopEnterAnimation,
                        attribute.PopExitAnimation);
                }
                else
                {
                    fragmentTransaction.SetCustomAnimations(
                        attribute.EnterAnimation,
                        attribute.ExitAnimation);
                }
            }

            if (attribute.TransitionStyle != int.MinValue)
            {
                fragmentTransaction.SetTransitionStyle(attribute.TransitionStyle);
            }
        }
Exemple #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.SetOnNavigationItemSelectedListener(this);


            ft = FragmentManager.BeginTransaction();
            ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
            ft.AddToBackStack(null);
            ft.Add(Resource.Id.FrameLayout, new HomeFragment());
            ft.Commit();
        }
        private void HandleListClick()
        {
            ProductsList.OnProductClickEvent += (Products.Model.Products.ProductEntity product) => {
                ProductsDetail = new ProductsDetailFragment();

                FragmentTransaction transaction = FragmentManager.BeginTransaction();

                transaction.SetCustomAnimations(Resource.Animation.enter_from_right, Resource.Animation.exit_to_left);
                transaction.Replace(Resource.Id.productsFragmentContainer, ProductsDetail);
                transaction.AddToBackStack(product.Name);

                transaction.Commit();

                FragmentManager.ExecutePendingTransactions();

                ProductsDetail.ShowProduct(product);
            };
        }
        void AddFragmentToStack()
        {
            mStackLevel++;

            // Instantiate a new fragment.
            Fragment newFragment = CountingFragment.NewInstance(mStackLevel);

            // Add the fragment to the activity, pushing this transaction
            // on to the back stack.
            FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction();

            ft.SetCustomAnimations(R.Anims.fragment_slide_left_enter,
                                   R.Anims.fragment_slide_left_exit,
                                   R.Anims.fragment_slide_right_enter,
                                   R.Anims.fragment_slide_right_exit);
            ft.Replace(R.Ids.simple_fragment, newFragment);
            ft.AddToBackStack(null);
            ft.Commit();
        }
Exemple #22
0
        public void FlipCard()
        {
            if (Showingback)
            {
                FragmentManager.PopBackStack();

                Showingback = false;
            }
            else
            {
                FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out,
                                          Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out);
                trans.Replace(Resource.Id.frameLayout1, new CardBackFragment());
                trans.AddToBackStack(null);
                trans.Commit();
                Showingback = true;
            }
        }
 public void ShowView <TViewModel>(TViewModel crossViewModel) where TViewModel : CrossViewModel
 {
     RemoveView();
     //RemoveAllViews();
     SubCrossViewModel = crossViewModel;
     if (crossViewModel.CrossView == null)
     {
         throw new Exception($"CrossView is null");
     }
     else if (crossViewModel.CrossView is Fragment fragment)
     {
         FragmentTransaction ft = ((AppCompatActivity)CrossCurrentActivity.Current.Activity).SupportFragmentManager.BeginTransaction();
         ft.SetCustomAnimations(Resource.Animation.fade_in_fast, Resource.Animation.fade_out_fast, Resource.Animation.fade_in_fast, Resource.Animation.fade_out_fast);
         ft.Add(this.Id, fragment);
         ft.Commit();
     }
     else
     {
         throw new Exception($"No case for crossview of that type");
     }
 }
        void AddShowHideListener(int buttonId, Fragment fragment)
        {
            Button button = (Button)FindViewById(buttonId);

            button.Click += (o, a) =>
            {
                FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction();
                ft.SetCustomAnimations(global::Android.R.Anim.Fade_in,
                                       global::Android.R.Anim.Fade_out);
                if (fragment.IsHidden())
                {
                    ft.Show(fragment);
                    button.SetText("Hide");
                }
                else
                {
                    ft.Hide(fragment);
                    button.SetText("Show");
                }
                ft.Commit();
            };
        }
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.navigation_qr:

                FragmentTransaction transaction          = FragmentManager.BeginTransaction();
                QRFragment          receivedConfirmation = new QRFragment();
                receivedConfirmation.Show(transaction, "QRDialog");

                return(true);

            case Resource.Id.navigation_rewards:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new RewardsFragment());
                ft.Commit();

                return(true);

            case Resource.Id.navigation_locate:

                FragmentManager.BeginTransaction().Remove(FragmentManager.FindFragmentById(Resource.Id.FrameLayout)).Commit();
                ft = FragmentManager.BeginTransaction();
                ft.SetCustomAnimations(Resource.Animator.enter_from_left, Resource.Animator.exit_to_right);
                ft.AddToBackStack(null);
                ft.Add(Resource.Id.FrameLayout, new MapsFragment());
                ft.Commit();

                return(true);
            }

            return(false);
        }
Exemple #26
0
 protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
 {
     base.SetupPageTransition(transaction, isPush);
     transaction.SetCustomAnimations(isPush ? Resource.Drawable.abc_slide_in_right : Resource.Drawable.abc_slide_in_left, isPush ? Resource.Drawable.abc_slide_out_left : Resource.Drawable.abc_slide_out_right);
 }
Exemple #27
0
        protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
        {
            switch (_transitionType)
            {
            case TransitionType.None:
                return;

            case TransitionType.Default:
                return;

            case TransitionType.Fade:
                transaction.SetCustomAnimations(Resource.Animation.fade_in, Resource.Animation.fade_out,
                                                Resource.Animation.fade_out, Resource.Animation.fade_in);
                break;

            case TransitionType.Flip:
                transaction.SetCustomAnimations(Resource.Animation.flip_in, Resource.Animation.flip_out,
                                                Resource.Animation.flip_out, Resource.Animation.flip_in);
                break;

            case TransitionType.Scale:
                transaction.SetCustomAnimations(Resource.Animation.scale_in, Resource.Animation.scale_out,
                                                Resource.Animation.scale_out, Resource.Animation.scale_in);
                break;

            case TransitionType.SlideFromLeft:
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_left, Resource.Animation.exit_right,
                                                    Resource.Animation.enter_right, Resource.Animation.exit_left);
                }
                else
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_right, Resource.Animation.exit_left,
                                                    Resource.Animation.enter_left, Resource.Animation.exit_right);
                }
                break;

            case TransitionType.SlideFromRight:
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_right, Resource.Animation.exit_left,
                                                    Resource.Animation.enter_left, Resource.Animation.exit_right);
                }
                else
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_left, Resource.Animation.exit_right,
                                                    Resource.Animation.enter_right, Resource.Animation.exit_left);
                }
                break;

            case TransitionType.SlideFromTop:
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_top, Resource.Animation.exit_bottom,
                                                    Resource.Animation.enter_bottom, Resource.Animation.exit_top);
                }
                else
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_bottom, Resource.Animation.exit_top,
                                                    Resource.Animation.enter_top, Resource.Animation.exit_bottom);
                }
                break;

            case TransitionType.SlideFromBottom:
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_bottom, Resource.Animation.exit_top,
                                                    Resource.Animation.enter_top, Resource.Animation.exit_bottom);
                }
                else
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_top, Resource.Animation.exit_bottom,
                                                    Resource.Animation.enter_bottom, Resource.Animation.exit_top);
                }
                break;

            default:
                return;
            }
        }
Exemple #28
0
 protected override void SetupPageTransition(FragmentTransaction transaction, bool isPush)
 {
     transaction.SetCustomAnimations(Resource.Animation.flip_in, Resource.Animation.flip_out,
                                     Resource.Animation.flip_out, Resource.Animation.flip_in);
 }
 protected override void SetupPageTransition(FragmentTransaction transaction)
 {
     transaction.SetCustomAnimations(Resource.Animation.scale_in, Resource.Animation.scale_out);
 }
Exemple #30
0
        /// <summary>
        /// Method for flipping status card fragments
        /// </summary>
        public void FlipCard()
        {
            if (sIsFixed)
            {
                // Check whether the puzzle is fixed
                if (mShowingBack)
                {
                    // Pop back to the last fragment on the stack (the front side fragment)
                    FragmentManager.PopBackStack();
                    mShowingBack = false;

                    // Set a timer to delay the execution til the flip is triggered
                    Timer delayedTimer = new Timer
                    {
                        Interval = 1,
                        Enabled  = true
                    };
                    delayedTimer.Start();

                    delayedTimer.Elapsed += (object sender, ElapsedEventArgs e) =>
                    {
                        delayedTimer.Stop();
                        RunOnUiThread(() =>
                        {
                            // Execute on UI thread
                            if (mStatus != "Paused")
                            {
                                StatusCardFrontFragment.StatusVisibility(true);
                            }
                            StatusCardFrontFragment.StatusControl(mLvl, mCurrentMode, mStatus);
                            StatusCardFrontFragment.SwapsControl(mSwaps);
                            StatusCardFrontFragment.TimeControl(mTime);
                        });
                        // Dispose time since it will no longer be used.
                        delayedTimer.Dispose();
                    };
                }
                else
                {
                    // The front is showing, therefore flip to back
                    FragmentTransaction transaction = FragmentManager.BeginTransaction();

                    // Set the custom animations
                    transaction.SetCustomAnimations(Resource.Animation.card_flip_right_in, Resource.Animation.card_flip_right_out,
                                                    Resource.Animation.card_flip_left_in, Resource.Animation.card_flip_left_out);

                    // Replace the fragment
                    transaction.Replace(Resource.Id.container, new StatusCardBackFragment());
                    transaction.AddToBackStack(null);
                    transaction.Commit();
                    mShowingBack = true;

                    // Set a timer to delay the execution til the flip is triggered
                    Timer delayedTimer = new Timer
                    {
                        Interval = 1,
                        Enabled  = true
                    };
                    delayedTimer.Start();

                    delayedTimer.Elapsed += (object sender, ElapsedEventArgs e) =>
                    {
                        delayedTimer.Stop();
                        RunOnUiThread(() =>
                        {
                            // Execute on UI thread
                            StatusCardBackFragment.LvlControl(sCurrentLvl, mTimeInSeconds, mSwaps, mMode);
                        });
                        // Dispose time since it will no longer be used.
                        delayedTimer.Dispose();
                    };
                }
            }
        }