示例#1
0
        public void LayoutTransitionsHelperAddTransitionForCondition()
        {
            tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition START");

            Dictionary <TransitionCondition, TransitionList> targetTransitionList = new Dictionary <TransitionCondition, TransitionList>();

            TransitionList transitionList = new TransitionList();

            var addTransition = new LayoutTransition(TransitionCondition.Add,
                                                     AnimatableProperties.Position,
                                                     0.3f,
                                                     new TransitionComponents()
                                                     );

            transitionList.Add(addTransition);

            var layoutChangedTransition = new LayoutTransition(TransitionCondition.LayoutChanged,
                                                               AnimatableProperties.Opacity,
                                                               0.2f,
                                                               new TransitionComponents()
                                                               );

            transitionList.Add(layoutChangedTransition);


            targetTransitionList.Add(TransitionCondition.Add, transitionList);
            targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);

            /**
             * conditionNotInDictionary = false
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.LayoutChanged,
                                                              addTransition,
                                                              true);

            /**
             * conditionNotInDictionary = true
             * replaced
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.Add,
                                                              addTransition,
                                                              false);

            /**
             * conditionNotInDictionary = true
             * new entry
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.ChangeOnAdd,
                                                              addTransition,
                                                              false);

            tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition END (OK)");
        }
示例#2
0
 internal void AttachTransitionsToChildren(LayoutTransition transition)
 {
     // Iterate children, adding the transition unless a transition
     // for the same condition and property has already been
     // explicitly added.
     foreach (View view in Children)
     {
         LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
     }
 }
示例#3
0
        public void LayoutTransitionsHelperGetTransitionsListForCondition()
        {
            tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition START");

            TransitionList transitionList = new TransitionList();

            LayoutTransition addTransition = new LayoutTransition(TransitionCondition.Add,
                                                                  AnimatableProperties.Position,
                                                                  0.3f,
                                                                  new TransitionComponents()
                                                                  );

            LayoutTransition removeTransition = new LayoutTransition(TransitionCondition.Remove,
                                                                     AnimatableProperties.Position,
                                                                     0.0f,
                                                                     new TransitionComponents()
                                                                     );

            Dictionary <TransitionCondition, TransitionList> targetTransitionList = new Dictionary <TransitionCondition, TransitionList>();

            targetTransitionList.Add(TransitionCondition.Unspecified, transitionList);
            targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);

            TransitionList transitionsForCondition = new TransitionList();

            var result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
                                                                                TransitionCondition.LayoutChanged,
                                                                                transitionsForCondition);

            Assert.AreEqual(true, result, "should be equal!");

            result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
                                                                            TransitionCondition.Add,
                                                                            transitionsForCondition);
            Assert.AreEqual(false, result, "should be equal!");

            tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition END (OK)");
        }