예제 #1
0
        public void removeFragment()
        {
            //			Android.Support.V4.App.Fragment canvassesFragment = null;
            //			canvassesFragment = new CanvassesFragment ();
            //
            //			Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction ();
            //			ft.Replace (Resource.Id.content_frame, canvassesFragment, "canvassesFragment");
            //			ft.Commit ();

            try
            {
                Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
                ft.Remove(this);
                ft.Show(FragmentManager.FindFragmentByTag("canvassesFragment"));
                ft.Commit();
            }

            catch (Exception ex)
            {
                //Console.WriteLine ("Ex From REEEEEEEEEPREEEEEEEEFRAG" + ex.ToString());
            }
        }
예제 #2
0
        private void RenderTrackItTabFragment(FragmentTransaction transaction)
        {
            if (_isMapView)
            {
                if (_fightitFragment != null)
                {
                    transaction.Hide(_fightitFragment);
                }

                InitMapFragment();
                transaction.Show(_mapFragment);
                SetupMapIfNeeded();
            }
            else
            {
                if (_mapFragment != null)
                {
                    transaction.Hide(_mapFragment);
                }

                if (_fightitFragment == null)
                {
                    _fightitFragment = new FightItFragment();
                    transaction.Add(Resource.Id.fragmentContainer, _fightitFragment, "fight");
                }
                else
                {
                    transaction.Show(_fightitFragment);
                }
            }

            if (_listToggleButton != null)
            {
                _listToggleButton.Text = _isMapView ? "List" : "Map";
                _listToggleButton.Visibility = ViewStates.Visible;
            }
        }
예제 #3
0
        public void OnTabSelected(SherlockActionBar.Tab tab, FragmentTransaction transaction)
        {
            DebugHelper.WriteDebugEntry("In IntroActivity OnTabSelected(): " + tab.Tag);
            _currentTabTag = (String)tab.Tag;

            switch (_currentTabTag)
            {


                case "track":
                    RenderTrackItTabFragment(transaction);
                    break;

                case "report":
                    if (_reportFragment == null)
                    {
                        _reportFragment = new ReportCrueltyFragment();
                        transaction.Add(Resource.Id.fragmentContainer, _reportFragment, "report");
                    }
                    else
                    {
                        transaction.Show(_reportFragment);
                    }

                    if (_listToggleButton != null)
                    {
                        _listToggleButton.Visibility = ViewStates.Gone;
                    }

                    break;
            }

        }
예제 #4
0
        public void OnCheckedChanged(RadioGroup group, int checkedId)
        {
            ft = SupportFragmentManager.BeginTransaction();
            TextView tvTopBar = FindViewById <TextView>(Resource.Id.txTopBar);

            hideFragment(ft);

            switch (checkedId)
            {
            case Resource.Id.rbExercise:
                if (fgExercise == null)
                {
                    fgExercise = new FragmentExercise();
                    ft.Add(Resource.Id.fragmentCanvas, fgExercise, "PAGE_EXERCISE");
                }
                else
                {
                    ft.Show(fgExercise);
                }
                tvTopBar.SetText(Resource.String.tab_menu_exercise);
                break;

            case Resource.Id.rbHealth:
                if (fgHealth == null)
                {
                    fgHealth = new FragmentHealth();
                    ft.Add(Resource.Id.fragmentCanvas, fgHealth, "PAGE_HEALTH");
                }
                else
                {
                    ft.Show(fgHealth);
                }
                tvTopBar.SetText(Resource.String.tab_menu_health);
                break;

            case Resource.Id.rbFind:
                if (fgFind == null)
                {
                    fgFind = new FragmentFind();
                    ft.Add(Resource.Id.fragmentCanvas, fgFind, "PAGE_FIND");
                }
                else
                {
                    ft.Show(fgFind);
                }
                tvTopBar.SetText(Resource.String.tab_menu_find);
                break;

            case Resource.Id.rbMe:
                if (fgMe == null)
                {
                    fgMe = new FragmentMe();
                    ft.Add(Resource.Id.fragmentCanvas, fgMe, "PAGE_ME");
                }
                else
                {
                    ft.Show(fgMe);
                }
                tvTopBar.SetText(Resource.String.tab_menu_me);
                break;
            }
            ft.Commit();
        }
예제 #5
0
        public void UpdateContent(Uri uri)
        {
            Fragment fragment;
            string   tag;

            FragmentManager     fm = SupportFragmentManager;
            FragmentTransaction tr = fm.BeginTransaction();

            if (CurrentContentFragmentTag != null)
            {
                Fragment currentFragment = fm.FindFragmentByTag(CurrentContentFragmentTag);
                if (currentFragment != null)
                {
                    tr.Hide(currentFragment);
                }
            }

            if (AboutFragment.ABOUT_URI.Equals(uri))
            {
                tag = AboutFragment.TAG;
                Fragment foundFragment = fm.FindFragmentByTag(tag);
                if (foundFragment != null)
                {
                    fragment = foundFragment;
                }
                else
                {
                    fragment = new AboutFragment();
                }
            }
            else if (SandboxFragment.SETTINGS_URI.Equals(uri))
            {
                tag = SandboxFragment.TAG;
                SandboxFragment foundFragment = (SandboxFragment)fm.FindFragmentByTag(tag);
                if (foundFragment != null)
                {
                    foundFragment.OnSettingsChangedListener = mSettingsChangedListener;
                    fragment = foundFragment;
                }
                else
                {
                    SandboxFragment settingsFragment = new SandboxFragment();
                    settingsFragment.OnSettingsChangedListener = mSettingsChangedListener;
                    fragment = settingsFragment;
                }
            }
            else if (uri != null)
            {
                tag = WebViewFragment.TAG;
                WebViewFragment webViewFragment;
                Fragment        foundFragment = fm.FindFragmentByTag(tag);
                if (foundFragment != null)
                {
                    fragment        = foundFragment;
                    webViewFragment = (WebViewFragment)fragment;
                }
                else
                {
                    webViewFragment = new WebViewFragment();
                    fragment        = webViewFragment;
                }
                webViewFragment.Url = uri.ToString();
            }
            else
            {
                return;
            }

            if (fragment.IsAdded)
            {
                tr.Show(fragment);
            }
            else
            {
                tr.Add(Resource.Id.content, fragment, tag);
            }
            tr.Commit();

            CurrentUri = uri;
            CurrentContentFragmentTag = tag;
        }