protected void Show(MvxFragment fragment, bool backStack) { if (!fragment.HasRegionAttribute()) { throw new InvalidOperationException("Fragment has no region attribute."); } int regionResourceId = fragment.GetRegionId(); if (!_validRegionIds.Contains(regionResourceId)) { throw new InvalidOperationException("Id specified in resource attribute is invalid."); } if (regionResourceId == Resource.Id.PopupRegion) { // show popup transparency var transparency = FindViewById(Resource.Id.PopupTransparency); transparency.Visibility = ViewStates.Visible; } // load fragment into view var ft = SupportFragmentManager.BeginTransaction(); ft.Replace(regionResourceId, fragment); if (backStack) { // TODO: // The back button will return to this. However, // setting this may mess up the custom // OnBackPressed() behavior ft.AddToBackStack(null); } ft.Commit(); }
private void CloseFragment(MvxFragment fragment) { if (fragment.GetRegionId() == Resource.Id.PopupRegion) { _transparentPopupView.Visibility = ViewStates.Gone; } var ft = SupportFragmentManager.BeginTransaction(); ft.Remove(fragment); ft.Commit(); }