public void ReverseAnimation() { if (_stateMemory._isPortait && _stateMemory._isSmall) { _showTabHolderFragment = ShowTabHolderFragment.NewInstance(_myShow, 2); var fm = ChildFragmentManager.BeginTransaction(); fm.SetCustomAnimations(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); fm.Replace(Resource.Id.frameTabHolder, _showTabHolderFragment , "ShowTabHolderFragment"); fm.Commit(); //_showTabHolderFragment.RefreshAdapter(); ((ShowOverviewActivity)Activity).SetIsAfterAnimation(false); } else if (!_stateMemory._isPortait ) { _showDescriptionFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent); _nextUnwatchedEpisodeFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(3 * (linearLayout.Width / 4), ViewGroup.LayoutParams.MatchParent); _seasonListFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(linearLayout.Width / 4, ViewGroup.LayoutParams.MatchParent); _seasonListFrameLayout.BringToFront(); ResizeAnimationOverviewLandscapeLarge anim = new ResizeAnimationOverviewLandscapeLarge(_seasonListFrameLayout, true); anim.Duration = ANIMATION_DURATION; anim.SetParams(linearLayout.Width / 4, linearLayout.Width / 4, 0, 3 * (linearLayout.Width / 4)); _seasonListFrameLayout.StartAnimation(anim); ResizeAnimationOverviewLandscapeLarge anim2 = new ResizeAnimationOverviewLandscapeLarge(_nextUnwatchedEpisodeFrameLayout, true); anim2.Duration = ANIMATION_DURATION; anim2.SetParams(3 * (linearLayout.Width / 4), linearLayout.Width / 2, _nextUnwatchedEpisodeFrameLayout.GetX(), _nextUnwatchedEpisodeFrameLayout.GetX()); _nextUnwatchedEpisodeFrameLayout.StartAnimation(anim2); ResizeAnimationOverviewLandscapeLarge anim3 = new ResizeAnimationOverviewLandscapeLarge(_showDescriptionFrameLayout, true); anim3.Duration = ANIMATION_DURATION; anim3.SetParams(0, linearLayout.Width / 4, 0, 0); _showDescriptionFrameLayout.StartAnimation(anim3); var addingFragTransaction = ChildFragmentManager.BeginTransaction(); addingFragTransaction.SetCustomAnimations(Android.Resource.Animation.FadeIn, Android.Resource.Animation.FadeOut); //addingFragTransaction.Add(Resource.Id.frameForShowDescription, _showDescriptionFragment); addingFragTransaction.Remove(_detailsShowEpisodeTabsFragment); addingFragTransaction.Replace(_nextUnwatchedEpisodeFrameLayout.Id, _nextUnwatchedEpisodeFragment, "NextEpisodeFragment"); addingFragTransaction.Commit(); _seasonListFragment.SetHighlight(false); ((ShowOverviewActivity) Activity).SetIsAfterAnimation(false); } else if (_stateMemory._isPortait && !_stateMemory._isSmall) { _showDescriptionFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0); _seasonListFrameLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, linearLayout.Height); ResizeAnimationOverviewPortraitLarge a = new ResizeAnimationOverviewPortraitLarge(_seasonListFrameLayout, false, true); a.Duration = ANIMATION_DURATION; a.SetParams(linearLayout.Height, linearLayout.Height/ 2, 0, linearLayout.Height / 2); _seasonListFrameLayout.StartAnimation(a); ResizeAnimationOverviewPortraitLarge a3 = new ResizeAnimationOverviewPortraitLarge(_showDescriptionFrameLayout, false, true); a3.Duration = ANIMATION_DURATION; a3.SetParams(0, linearLayout.Height / 2, 0, 0); _showDescriptionFrameLayout.StartAnimation(a3); var addingFragTransaction = ChildFragmentManager.BeginTransaction(); addingFragTransaction.SetCustomAnimations(Resource.Animation.fade_in, Resource.Animation.fade_out); addingFragTransaction.Remove(_detailsShowEpisodeTabsFragment); addingFragTransaction.Replace(_nextUnwatchedEpisodeFrameLayout.Id, _nextUnwatchedEpisodeFragment , "NextEpisodeFragment"); addingFragTransaction.Commit(); _seasonListFragment.SetHighlight(false); ((ShowOverviewActivity) Activity).SetIsAfterAnimation(false); } }
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); } }