protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _stateMemory = new StateMemory(); //positionInEpisodeTabList = 0; LayoutInflater.Inflate(Resource.Layout.shows_overview_activity, _BaseFrameLayout); _myShow = await PopulateSeasons(Intent.GetStringExtra("TMDBID")); SetTitle("Description for show " + _myShow.Name); if (savedInstanceState != null) { _stateMemory._isAfterAnimation = savedInstanceState.GetBoolean(KEY_ISAFTERANIMATION, false); //positionInEpisodeTabList = savedInstanceState.GetInt("position", 0); } else { _stateMemory._isAfterAnimation = false; } SetUpBeforeFragment(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View v; if (((ShowOverviewActivity) Activity).GetIsAfterAnimation()) { v = inflater.Inflate(Resource.Layout.shows_overview_fragment_after, container, false); } else { v = inflater.Inflate(Resource.Layout.shows_overview_fragment_before, container, false); } if (v.FindViewById<LinearLayout>(Resource.Id.llSmallPortrait) != null) { linearLayout = v.FindViewById<LinearLayout>(Resource.Id.llSmallPortrait); ((ShowOverviewActivity) Activity).SetIsSmall(true); ((ShowOverviewActivity) Activity).SetIsPortrait(true); _showTabHolderFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForSeasonList); if (((ShowOverviewActivity) Activity).GetIsAfterAnimation()) { _detailsShowEpisodeTabsFragment = (DetailsShowEpisodeTabsFragment)ChildFragmentManager.FindFragmentByTag("DetailsShowEpisodeTabsFragment"); if (_detailsShowEpisodeTabsFragment != null) { var mySeason = _detailsShowEpisodeTabsFragment.GetSeasonNumber(); //var position = _detailsShowEpisodeTabsFragment.GetPosition(); var fm = ChildFragmentManager.BeginTransaction(); fm.Remove(_detailsShowEpisodeTabsFragment); fm.Commit(); _detailsShowEpisodeTabsFragment = DetailsShowEpisodeTabsFragment.NewInstance(_myShow.GetTVSeasonByNumber(mySeason), _positionInEpisodeTabList); var ft = ChildFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.frameTabHolder, _detailsShowEpisodeTabsFragment, "DetailsShowEpisodeTabsFragment"); ft.Commit(); } } else { SetUpShowTabHolderFragment(); } } else if (v.FindViewById<LinearLayout>(Resource.Id.llSmallLandscape) != null) { _seasonListFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForSeasonList); _showDescriptionFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForShowDescription); _nextUnwatchedEpisodeFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForNextEpisodeInfo); SetUpSeasonListFragment(); linearLayout = v.FindViewById<LinearLayout>(Resource.Id.llSmallLandscape); ((ShowOverviewActivity)Activity).SetIsSmall(true); ((ShowOverviewActivity)Activity).SetIsPortrait(false); if (((ShowOverviewActivity)Activity).GetIsAfterAnimation()) { _nextUnwatchedEpisodeFragment = NextEpisodeFragment.NewInstance(_myShow.GetNextUnwatchedEpisode()); _detailsShowEpisodeTabsFragment = (DetailsShowEpisodeTabsFragment)ChildFragmentManager.FindFragmentByTag("DetailsShowEpisodeTabsFragment"); if (_detailsShowEpisodeTabsFragment != null) { var mySeason = _detailsShowEpisodeTabsFragment.GetSeasonNumber(); var fm = ChildFragmentManager.BeginTransaction(); fm.Remove(_detailsShowEpisodeTabsFragment); fm.Commit(); _detailsShowEpisodeTabsFragment = DetailsShowEpisodeTabsFragment.NewInstance(_myShow.GetTVSeasonByNumber(mySeason), _positionInEpisodeTabList); var ft = ChildFragmentManager.BeginTransaction(); ft.Add(Resource.Id.frameForNextEpisodeInfo, _detailsShowEpisodeTabsFragment, "DetailsShowEpisodeTabsFragment"); ft.Commit(); } //SetUpEpisodeTabViewFragment(); } else { SetUpShowDescriptionFragment(); SetUpNextUnwatchedEpisodeFragment(); } } else { _seasonListFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForSeasonList); _showDescriptionFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForShowDescription); _nextUnwatchedEpisodeFrameLayout = v.FindViewById<FrameLayout>(Resource.Id.frameForNextEpisodeInfo); SetUpSeasonListFragment(); if (v.FindViewById<LinearLayout>(Resource.Id.llLargePortrait) != null) { linearLayout = v.FindViewById<LinearLayout>(Resource.Id.llLargePortrait); ((ShowOverviewActivity) Activity).SetIsSmall(false); ((ShowOverviewActivity) Activity).SetIsPortrait(true); leftSide = v.FindViewById<LinearLayout>(Resource.Id.leftSide); if (((ShowOverviewActivity) Activity).GetIsAfterAnimation()) { _nextUnwatchedEpisodeFragment = NextEpisodeFragment.NewInstance(_myShow.GetNextUnwatchedEpisode()); SetUpEpisodeTabViewFragment(); } else { SetUpShowDescriptionFragment(); SetUpNextUnwatchedEpisodeFragment(); } } else if (v.FindViewById<LinearLayout>(Resource.Id.llLargeLandscape) != null) { if (((ShowOverviewActivity) Activity).GetIsAfterAnimation()) { linearLayout = v.FindViewById<LinearLayout>(Resource.Id.llLargeLandscape); ((ShowOverviewActivity) Activity).SetIsSmall(false); ((ShowOverviewActivity) Activity).SetIsPortrait(false); _nextUnwatchedEpisodeFragment = NextEpisodeFragment.NewInstance(_myShow.GetNextUnwatchedEpisode()); SetUpEpisodeTabViewFragment(); } else { linearLayout = v.FindViewById<LinearLayout>(Resource.Id.llLargeLandscape); ((ShowOverviewActivity) Activity).SetIsSmall(false); ((ShowOverviewActivity) Activity).SetIsPortrait(false); SetUpShowDescriptionFragment(); SetUpNextUnwatchedEpisodeFragment(); } } } _stateMemory = ((ShowOverviewActivity) Activity).GetStateMemory(); //if (savedInstanceState != null) //{ // SetUpNextUnwatchedEpisodeFragment(); // _nextUnwatchedEpisodeFragment.UpdateEpisode(_myShow.GetNextUnwatchedEpisode()); // SetUpSeasonListFragment(); // _seasonListFragment.UpdateShow(_myShow); //} return v; }