Esempio n. 1
0
 public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
 {
     if (this.fragment != null)
     {
         ft.Detach(this.fragment);
     }
 }
Esempio n. 2
0
        public void LoadListFragment()
        {
            FragmentTransaction fragmentTx = FragmentManager.BeginTransaction();

            fragmentTx.Detach(pageFragment);
            fragmentTx.Attach(filmsFragment);
            fragmentTx.Commit();
        }
Esempio n. 3
0
        private void LoadAllFragments()
        {
            FragmentTransaction fragmentTx = FragmentManager.BeginTransaction();

            fragmentTx.Add(Resource.Id.fragmentFrameLayout, filmsFragment);
            fragmentTx.Add(Resource.Id.fragmentFrameLayout, pageFragment);
            fragmentTx.Detach(pageFragment);
            fragmentTx.Commit();
        }
Esempio n. 4
0
        public void LoadMovieFragment()
        {
            FragmentTransaction fragmentTx = FragmentManager.BeginTransaction();

            fragmentTx.Detach(filmsFragment);
            fragmentTx.Attach(pageFragment);
            fragmentTx.AddToBackStack(null);
            fragmentTx.Commit();
        }
Esempio n. 5
0
        public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            Log.Debug(this.GetType().Name, "The tab {0} has been selected.", tab.Text);

            if (this._fragment != null)
            {
                ft.Detach(this._fragment);
            }
        }
Esempio n. 6
0
 public void RefreshFrag()
 {
     if (FragmentManager != null)
     {
         FragmentTransaction a = FragmentManager.BeginTransaction();
         a.Detach(this);
         a.Attach(this);
         a.CommitAllowingStateLoss();
     }
 }
Esempio n. 7
0
        private void RemoveFragmentIfShowing(FragmentTransaction ft, int contentId)
        {
            var frag = SupportFragmentManager.FindFragmentById(contentId);

            if (frag == null)
            {
                return;
            }

            ft.Detach(frag);
            _currentFragments.Remove(contentId);
        }
            public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
            {
                var fragment = _content as Fragment;

                if (fragment != null)
                {
                    ft.Detach(fragment);
                    return;
                }
                var view = _content as View;

                if (view == null)
                {
                    return;
                }
                var viewGroup = view.Parent as ViewGroup;

                if (viewGroup != null)
                {
                    viewGroup.RemoveView(view);
                }
            }
Esempio n. 9
0
        public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            var fragment = GetFragmentForPosition(tab.Position);

            ft.Detach(fragment);
        }
        protected virtual void PopFragment(FragmentManager fragmentManager, FragmentTransaction fragmentTransaction, MvxFragmentPresentationAttribute fragmentAttribute, string fragmentName, bool removeIsNeeded = false, bool forward = false)
        {
            fragmentAttribute = fragmentAttribute ?? DeqeueFragmentAttributeIfExist(fragmentName);

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

                if (fragmentAttribute.TransitionStyle != int.MinValue)
                {
                    fragmentTransaction.SetTransitionStyle(fragmentAttribute.TransitionStyle);
                }
            }

            if ((FragmentsBackStack.LastOrDefault(x => x.Key == fragmentName)?.ViewModel as IBaseViewModel)?.VmNavigationType == NavigationType.PresentModal)
            {
                lock (this)
                {
                    _presentedModalFragments--;
                }
            }

            var oldFragment = fragmentManager.FindFragmentByTag(fragmentName);

            if (oldFragment != null)
            {
                if (!oldFragment.IsDetached)
                {
                    if (removeIsNeeded)
                    {
                        RemoveFragmentFromBackStack(fragmentName);

                        fragmentTransaction.Remove(oldFragment);
                    }
                    else
                    {
                        fragmentTransaction.Detach(oldFragment);
                    }
                }
                else if (removeIsNeeded)
                {
                    RemoveFragmentFromBackStack(fragmentName);

                    fragmentTransaction.Remove(oldFragment);
                }

                if (!forward)
                {
                    OnFragmentPopped(fragmentTransaction, oldFragment, null);
                }
            }
        }