public static DetailsShowEpisodeTabsFragment NewInstance(TVSeason season, int EpisodePosition) { DetailsShowEpisodeTabsFragment frag = new DetailsShowEpisodeTabsFragment(); Bundle args = new Bundle(); string seasonSerialized = JsonConvert.SerializeObject(season); args.PutString("seasonSerialized", seasonSerialized); args.PutInt("position", EpisodePosition); frag.Arguments = args; return frag; }
/// <summary> /// /// </summary> private void SetUpSlidingTabFragment() { _episodeTabsFragment = (DetailsShowEpisodeTabsFragment)SupportFragmentManager.FindFragmentByTag("EpisodeTabsFragment"); if (_episodeTabsFragment == null) { //_episodeTabsFragment = new DetailsShowEpisodeTabsFragment(_selectedSeason, _myShow); FragmentTransaction ft = SupportFragmentManager.BeginTransaction(); ft.Add(Resource.Id.frameForTabLayout, _episodeTabsFragment, "EpisodeTabsFragment"); ft.Commit(); } else { Console.WriteLine("Tab Layout Frag Created Itself"); } }
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; }
private void SetUpEpisodeTabViewFragment() { _detailsShowEpisodeTabsFragment = (DetailsShowEpisodeTabsFragment)ChildFragmentManager.FindFragmentByTag("DetailsShowEpisodeTabsFragment"); if (_detailsShowEpisodeTabsFragment == null) { _detailsShowEpisodeTabsFragment = DetailsShowEpisodeTabsFragment.NewInstance(_myShow.GetTVSeasonByNumber(1), 0); var fm = ChildFragmentManager.BeginTransaction(); fm.Add(Resource.Id.frameForNextEpisodeInfo, _detailsShowEpisodeTabsFragment, "DetailsShowEpisodeTabsFragment"); fm.Commit(); } }
public void UpdateSeasonInEpisodeViewer(int seasonNumber) { _detailsShowEpisodeTabsFragment = (DetailsShowEpisodeTabsFragment) ChildFragmentManager.FindFragmentByTag("DetailsShowEpisodeTabsFragment"); if (_detailsShowEpisodeTabsFragment != null) { _detailsShowEpisodeTabsFragment.UpdateSeason(_myShow.GetTVSeasonByNumber(seasonNumber)); } }
public void LandscapeSlideAnimation(int seasonNumber) { _detailsShowEpisodeTabsFragment = DetailsShowEpisodeTabsFragment.NewInstance(_myShow.GetTVSeasonByNumber(seasonNumber), 0); if (_stateMemory._isPortait && _stateMemory._isSmall) { var fm = ChildFragmentManager.BeginTransaction(); fm.SetCustomAnimations(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); fm.Replace(Resource.Id.frameTabHolder, _detailsShowEpisodeTabsFragment , "DetailsShowEpisodeTabsFragment"); fm.Commit(); ((ShowOverviewActivity)Activity).SetIsAfterAnimation(true); } if ((!_stateMemory._isPortait )) { _showDescriptionFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(linearLayout.Width / 4, ViewGroup.LayoutParams.MatchParent); _nextUnwatchedEpisodeFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(linearLayout.Width / 2, ViewGroup.LayoutParams.MatchParent); _seasonListFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(linearLayout.Width / 4, ViewGroup.LayoutParams.MatchParent); Console.WriteLine("Clicked on seasonNumber " + seasonNumber); ResizeAnimationOverviewLandscapeLarge anim = new ResizeAnimationOverviewLandscapeLarge(_seasonListFrameLayout, true); anim.Duration = ANIMATION_DURATION; anim.SetParams(linearLayout.Width / 4, linearLayout.Width / 4, _seasonListFrameLayout.GetX(), 0); _seasonListFrameLayout.StartAnimation(anim); ResizeAnimationOverviewLandscapeLarge anim2 = new ResizeAnimationOverviewLandscapeLarge(_nextUnwatchedEpisodeFrameLayout, true); anim2.Duration = ANIMATION_DURATION; anim2.SetParams(linearLayout.Width / 2, 3 * (linearLayout.Width / 4), _nextUnwatchedEpisodeFrameLayout.GetX(), _nextUnwatchedEpisodeFrameLayout.GetX()); _nextUnwatchedEpisodeFrameLayout.StartAnimation(anim2); ResizeAnimationOverviewLandscapeLarge anim3 = new ResizeAnimationOverviewLandscapeLarge(_showDescriptionFrameLayout, true); anim3.Duration = ANIMATION_DURATION; anim3.SetParams(linearLayout.Width / 4, 0, 0, 0); _showDescriptionFrameLayout.StartAnimation(anim3); var removingFragTransaction = ChildFragmentManager.BeginTransaction(); removingFragTransaction.SetCustomAnimations(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut); //removingFragTransaction.Remove(_showDescriptionFragment); removingFragTransaction.Remove(_nextUnwatchedEpisodeFragment); removingFragTransaction.Add(_nextUnwatchedEpisodeFrameLayout.Id, _detailsShowEpisodeTabsFragment, "DetailsShowEpisodeTabsFragment"); removingFragTransaction.Commit(); _seasonListFragment.SetHighlight(true); //TODO add in episode animation ((ShowOverviewActivity) Activity).SetIsAfterAnimation(true); } else if (_stateMemory._isPortait && !_stateMemory._isSmall) { _showDescriptionFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, linearLayout.Height/2); _seasonListFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, linearLayout.Height / 2); ResizeAnimationOverviewPortraitLarge a = new ResizeAnimationOverviewPortraitLarge(_seasonListFrameLayout, true); a.Duration = ANIMATION_DURATION; a.SetParams(linearLayout.Height / 2, linearLayout.Height, linearLayout.Height / 2, 0); _seasonListFrameLayout.StartAnimation(a); ResizeAnimationOverviewPortraitLarge a3 = new ResizeAnimationOverviewPortraitLarge(_showDescriptionFrameLayout, false); a3.Duration = ANIMATION_DURATION; a3.SetParams(linearLayout.Height / 2, 1, 0, 0); _showDescriptionFrameLayout.StartAnimation(a3); var removingFragTransaction = ChildFragmentManager.BeginTransaction(); removingFragTransaction.SetCustomAnimations(Resource.Animation.fade_in, Resource.Animation.fade_out); removingFragTransaction.Remove(_nextUnwatchedEpisodeFragment); removingFragTransaction.Replace(_nextUnwatchedEpisodeFragment.Id, _detailsShowEpisodeTabsFragment, "DetailsShowEpisodeTabsFragment"); removingFragTransaction.Commit(); _seasonListFragment.SetHighlight(true); ((ShowOverviewActivity)Activity).SetIsAfterAnimation(true); } }