private void OnTransitioning(object sender, bool transitioning) { var container = Container; if (container == null) { return; } if (!transitioning) { return; } var trans = new TransitionSet(); trans.SetOrdering(TransitionOrdering.Together); trans.AddListener(new TransitionCompletion(this, container)); foreach (var t in BuildTransitions(_transition?.Element)) { trans.AddTransition(t); } TransitionManager.BeginDelayedTransition(container, trans); }
private void OnTransitioning(object sender, bool transitioning) { var container = Container; if (container == null) { return; } if (!transitioning) { return; } #pragma warning disable CA2000 // Dispose objects before losing scope var trans = new TransitionSet(); trans.SetOrdering(TransitionOrdering.Together); trans.AddListener(new TransitionCompletion(this, container)); #pragma warning restore CA2000 // Dispose objects before losing scope foreach (var t in BuildTransitions(_transition?.Element)) { trans.AddTransition(t); } TransitionManager.BeginDelayedTransition(container, trans); }
/// <summary> /// Loads the new constraint layout and adds the animation operation. /// </summary> private void PageTransition() { // Disable the See More / Hide button so we can't trigger another animation while this one is happening // It will get re-enabled in OnTransitionEnd seeMoreHideButton.Enabled = false; seeMoreModeEnabled = !seeMoreModeEnabled; if (seeMoreModeEnabled) { // Current: Results // Transition To: See More // The original x-ray view (that only appears in See More) is hidden to begin with so that // TalkBack doesn't narrate its elements xRayDisplayViewOriginal.Visibility = ViewStates.Visible; Transition transition = new AutoTransition(); transition.AddListener(this); // This listener will hide the conditionListSecondary when the transition is done (and re-enable the See More / Hide button) TransitionManager.BeginDelayedTransition(root, transition); seeMoreConstraints.ApplyTo(root); seeMoreHideButton.SetText(Resource.String.see_all_btn_hide); layoutManagerPrimary.ScrollEnabled = true; xRayDisplayView.TextDisplayMode = XRayDisplayView.DisplayMode.Small; xRayDisplayView.FilenameLabel = GetString(Resource.String.see_all_image_label_analyzed); } else { // Current: See More // Transition To: Results // We need a little bit of a custom transition here: // We want to fade in the conditionListSecondary and move it at the same time // We also want to keep the origin x-ray view visible during the transition then hide it afterwards // This transition takes care of the fade in + move for all elements TransitionSet mainTransitions = new TransitionSet(); mainTransitions.SetOrdering(TransitionSet.OrderingTogether); mainTransitions.AddTransition(new ChangeBounds()); mainTransitions.AddTransition(new Fade(Fade.In)); // This transition takes care of fading out the original x-ray view Transition fadeOut = new Fade(Fade.Out); fadeOut.AddTarget(Resource.Id.img_xray_original); // We can then run the two transition sequentially to make sure the fade out happens after everything else TransitionSet transitions = new TransitionSet(); transitions.SetOrdering(TransitionSet.OrderingSequential); transitions.AddTransition(mainTransitions); transitions.AddTransition(fadeOut); transitions.AddListener(this); // This listener will re-enable the See More / Hide button when the transition is done TransitionManager.BeginDelayedTransition(root, transitions); resultsConstraints.ApplyTo(root); seeMoreHideButton.SetText(Resource.String.results_btn_see_more); // Need to reset the scroll of conditionListPrimary to the top layoutManagerPrimary.ScrollToPositionWithOffset(0, 0); layoutManagerPrimary.ScrollEnabled = false; xRayDisplayView.TextDisplayMode = XRayDisplayView.DisplayMode.Large; xRayDisplayView.FilenameLabel = GetString(Resource.String.results_image_label); } }