This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new builder pattern and create DynamicSpringSource for Mate…
…rialSpring. Summary: This is similar to the coreanimation pattern in material-motion-swift. This is a useful pattern for animation systems that require the target object and property to be provided up-front. For example, off-thread animation systems require this. A new `build` channel is added to MotionObservable. An interaction that uses an off-thread animation system would use the `build` channel rather than the `next` channel. This `build` channel passes along: 1. a MotionBuilder<T> object 2. a T[] of config values The MotionBuilder<T> can take a T[] of config values to create some type of motion, and is created by the interaction. The T[] is transformed by constraint operators as it is passed down the `build` channel. Only specific T->T operators can transform this T[]. If a stream given to `MotionRuntime.write(stream, property)` has an active `build` channel, the MotionBuilder<T> will be given the transformed T[] and the property. The new DynamicSpringSource and DynamicSpringBuilder uses this builder pattern. DynamicSpringBuilder supports writing T values to Property<T> by using a TypeVectorizer to break a T value into multiple Float values. Each float value is animated by a separate SpringAnimation. Part of #64 Reviewers: O2 Material Motion, O6 Material Android platform reviewers, #material_motion, featherless Reviewed By: O2 Material Motion, #material_motion, featherless Subscribers: featherless Tags: #material_motion Differential Revision: http://codereview.cc/D3150
- Loading branch information
Mark Wei
committed
May 3, 2017
1 parent
8eb6b3a
commit 0bd3880
Showing
42 changed files
with
474 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
library/src/main/java/com/google/android/material/motion/MotionBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.google.android.material.motion; | ||
|
||
public abstract class MotionBuilder<T> { | ||
|
||
public abstract void start(ReactiveProperty<T> property, T[] values); | ||
|
||
public abstract void stop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
library/src/main/java/com/google/android/material/motion/Operation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
library/src/main/java/com/google/android/material/motion/SameTypedMapOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.google.android.material.motion; | ||
|
||
public abstract class SameTypedMapOperation<T> extends MapOperation<T, T> { | ||
|
||
public final void build(MotionObserver<T> observer, MotionBuilder<T> builder, T[] values) { | ||
for (int i = 0; i < values.length; i++) { | ||
values[i] = transform(values[i]); | ||
} | ||
observer.build(builder, values); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.