* [android] Add WXAnimationBean.Styles.init()
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/0b906586 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/0b906586 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/0b906586 Branch: refs/heads/0.16-dev Commit: 0b9065861c36ee1d5c1a60c2f3705f7244318f25 Parents: b96d92d Author: YorkShen <shenyua...@gmail.com> Authored: Thu Aug 3 16:05:56 2017 +0800 Committer: YorkShen <shenyua...@gmail.com> Committed: Thu Aug 3 16:05:56 2017 +0800 ---------------------------------------------------------------------- .../com/taobao/weex/ui/animation/WXAnimationBean.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0b906586/android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java b/android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java index f5f0d36..f3f7be5 100644 --- a/android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java +++ b/android/sdk/src/main/java/com/taobao/weex/ui/animation/WXAnimationBean.java @@ -54,7 +54,7 @@ public class WXAnimationBean { public long delay; public long duration; public String timingFunction; - public Style styles; + public @Nullable Style styles; public boolean needLayout; public static class Style { @@ -333,6 +333,18 @@ public class WXAnimationBean { initHolders(); } + /** + * Use this method to init if you already have a list of Property + * The key is something like {@link View#TRANSLATION_X} and the value is a {@link Pair}, + * of which the first is beginning value and the second is ending value. + * @param styles a list of Property + */ + public void init(@NonNull Map<Property<View, Float>, Pair<Float, Float>> styles){ + for(Entry<Property<View, Float>, Pair<Float, Float>> entry:styles.entrySet()){ + holders.add(PropertyValuesHolder.ofFloat(entry.getKey(), entry.getValue().first, entry.getValue().second)); + } + } + private void initHolders(){ for (Map.Entry<Property<View, Float>, Float> entry : transformMap.entrySet()) { holders.add(PropertyValuesHolder.ofFloat(entry.getKey(), entry.getValue()));