Example #1
0
 /**
  * Constructor. It is necessary to call {@link #setSpring(Spring)} to set the spring.
  *
  * @param property
  *      the property to track.
  * @param trackStrategy
  *      the tracking strategy.
  * @param followStrategy
  *      the follow strategy.
  */
 public MotionImitator(MotionProperty property, int trackStrategy, int followStrategy) : base(0, trackStrategy, followStrategy)
 {
     //this(null, property, 0, trackStrategy, followStrategy);
     this.mSpring   = null;
     this.mProperty = property;
     //Release = ReleaseInternal;
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param property
  *      the property to track.
  * @param restValue
  *      the rest value for the spring.
  * @param trackStrategy
  *      the tracking strategy.
  * @param followStrategy
  *      the follow strategy.
  */
 public MotionImitator(MotionProperty property, double restValue, int trackStrategy,
                       int followStrategy) : base(restValue, trackStrategy, followStrategy)
 {
     //super(restValue, trackStrategy, followStrategy);
     mProperty = property;
     //Release = ReleaseInternal;
 }
Example #3
0
            /**
             * @param spring
             *      the underlying {@link com.facebook.rebound.Spring}.
             * @param trackStrategy
             *      the tracking behavior
             * @param followStrategy
             *      the follow behavior
             * @param restValue
             *      the rest value
             * @param property
             *      the event fields to imitate and the view property to animate.
             * @param springListener
             *      a spring listener to attach to the spring
             * @return this builder for chaining
             */

            public Builder AddMotion(Spring spring, int trackStrategy, int followStrategy,
                                     int restValue, MotionProperty property, ISpringListener springListener)
            {
                mMotions.Add(CreateMotionFromProperties(spring, new MotionProperty[] { property },
                                                        new ISpringListener[] { springListener }, trackStrategy, followStrategy, restValue));

                return(this);
            }
Example #4
0
 public static MotionProperty ValueOf(string name)
 {
     foreach (MotionProperty enumInstance in MotionProperty.Values())
     {
         if (enumInstance.nameValue == name)
         {
             return(enumInstance);
         }
     }
     throw new System.ArgumentException(name);
 }
Example #5
0
            /**
             * Creations a new motion object.
             *
             * @param spring
             *      the spring to use
             * @param motionProperties
             *      the properties of the event to track
             * @param springListeners
             *      additional spring listeners to add
             * @param trackStrategy
             *      the tracking strategy
             * @param followStrategy
             *      the follow strategy
             * @param restValue
             *      the spring rest value
             * @return a motion object
             */

            private Motion CreateMotionFromProperties(Spring spring,
                                                      MotionProperty[] motionProperties,
                                                      ISpringListener[] springListeners,
                                                      int trackStrategy, int followStrategy,
                                                      int restValue)
            {
                MotionImitator[] motionImitators = new MotionImitator[motionProperties.Length];
                Performer[]      performers      = new Performer[motionProperties.Length];

                for (int i = 0; i < motionProperties.Length; i++)
                {
                    MotionProperty property = motionProperties[i];

                    motionImitators[i] = new MotionImitator(spring, property, restValue, trackStrategy, followStrategy);
                    performers[i]      = new Performer(mView, property.ViewProperty);
                }

                return(new Motion(spring, motionImitators, performers, springListeners));
            }
 /**
  * Constructor.
  *
  * @param property
  *      the desired property to imitate
  * @param trackStrategy
  *      the tracking strategy.
  * @param followStrategy
  *      the follow strategy.
  * @param minValue
  *      the desired minimum spring value.
  * @param maxValue
  *      the desired maximum spring value.
  */
 public InertialImitator(MotionProperty property, int trackStrategy, int followStrategy,
                         double minValue, double maxValue) : base(property, trackStrategy, followStrategy, minValue, maxValue)
 {
     //super(property, trackStrategy, followStrategy, minValue, maxValue);
 }
        /*public IntPtr Handle
         * {
         *      get
         *      {
         *              //return this.Handle;
         *      }
         * }*/

        /**
         * Constructor. Uses {@link #TRACK_ABSOLUTE} and {@link #FOLLOW_EXACT}.
         *
         * @param property
         *      the desired property to imitate
         * @param minValue
         *      the minimum value
         * @param maxValue
         *      the maximum value
         */
        public InertialImitator(MotionProperty property, double minValue, double maxValue) : base(property, minValue, maxValue)
        {
            //super(property, minValue, maxValue);
        }
Example #8
0
 /**
  * Constructor. Uses {@link #TRACK_ABSOLUTE} and {@link #FOLLOW_EXACT}.
  *
  * @param spring
  *      the spring to use.
  * @param property
  *      the property to track.
  * @param restValue
  *      the rest value for the spring.
  */
 public MotionImitator(Spring spring, MotionProperty property, double restValue) : base(spring, restValue, TRACK_ABSOLUTE, FOLLOW_EXACT)
 {
     //this(spring, property, restValue, TRACK_ABSOLUTE, FOLLOW_EXACT);
     mProperty = property;
     //Release = ReleaseInternal;
 }
Example #9
0
 /**
  * Constructor. Uses {@link #TRACK_ABSOLUTE} and {@link #FOLLOW_EXACT}.
  *
  * @param property
  *      the property to track.
  */
 public MotionImitator(MotionProperty property) : base(0, TRACK_ABSOLUTE, FOLLOW_EXACT)
 {
     this.mSpring   = null;
     this.mProperty = property;
     //Release = ReleaseInternal;
 }
Example #10
0
            /**
             * Uses the default {@link com.facebook.rebound.SpringConfig} to animate the view.
             *
             * @param property
             *      the event field to imitate and the view property to animate.
             * @param listener
             *      a listener to call
             * @return this builder for chaining
             */

            public Builder AddTranslateMotion(MotionProperty property, ISpringListener listener)
            {
                return(AddMotion(mSpringSystem.CreateSpring(), Imitator.TRACK_ABSOLUTE,
                                 Imitator.FOLLOW_EXACT, new MotionProperty[] { property },
                                 new ISpringListener[] { listener }));
            }
 /**
  * Constructor.
  *
  * @param property
  *      the property to track.
  * @param trackStrategy
  *      the tracking strategy.
  * @param followStrategy
  *      the follow strategy.
  * @param minValue
  *      the desired minimum spring value.
  * @param maxValue
  *      the desired maximum spring value.
  */
 public ConstrainedMotionImitator(MotionProperty property, int trackStrategy, int followStrategy, double minValue, double maxValue)
     : base(property, trackStrategy, followStrategy)
 {
     this.mMinValue = minValue;
     this.mMaxValue = maxValue;
 }
 /**
  * Constructor. Uses {@link #TRACK_ABSOLUTE} and {@link #FOLLOW_EXACT}.
  *
  * @param property
  *      the property to track.
  * @param minValue
  *      the desired minimum spring value.
  * @param maxValue
  *      the desired maximum spring value.
  */
 public ConstrainedMotionImitator(MotionProperty property, double minValue, double maxValue) : base(property, TRACK_ABSOLUTE, FOLLOW_EXACT)
 {
     this.mMinValue = minValue;
     this.mMaxValue = maxValue;
 }