Repository: incubator-weex Updated Branches: refs/heads/master da1f70e57 -> 84a8b17d4
[WEEX-140][android]layout animation supported more property Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/84a8b17d Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/84a8b17d Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/84a8b17d Branch: refs/heads/master Commit: 84a8b17d435c1f868d2a3c679a10142cf8e74fe9 Parents: da1f70e Author: jianbai.gbj <jianbai....@alibaba-inc.com> Authored: Thu Nov 23 14:46:53 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Fri Nov 24 12:00:47 2017 +0800 ---------------------------------------------------------------------- .../weex/dom/transition/WXTransition.java | 84 +++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/84a8b17d/android/sdk/src/main/java/com/taobao/weex/dom/transition/WXTransition.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/transition/WXTransition.java b/android/sdk/src/main/java/com/taobao/weex/dom/transition/WXTransition.java index 41fcd12..b77db98 100644 --- a/android/sdk/src/main/java/com/taobao/weex/dom/transition/WXTransition.java +++ b/android/sdk/src/main/java/com/taobao/weex/dom/transition/WXTransition.java @@ -92,6 +92,14 @@ public class WXTransition { LAYOUT_PROPERTIES.add(Constants.Name.MARGIN_BOTTOM); LAYOUT_PROPERTIES.add(Constants.Name.MARGIN_LEFT); LAYOUT_PROPERTIES.add(Constants.Name.MARGIN_RIGHT); + LAYOUT_PROPERTIES.add(Constants.Name.LEFT); + LAYOUT_PROPERTIES.add(Constants.Name.RIGHT); + LAYOUT_PROPERTIES.add(Constants.Name.TOP); + LAYOUT_PROPERTIES.add(Constants.Name.BOTTOM); + LAYOUT_PROPERTIES.add(Constants.Name.PADDING_LEFT); + LAYOUT_PROPERTIES.add(Constants.Name.PADDING_RIGHT); + LAYOUT_PROPERTIES.add(Constants.Name.PADDING_TOP); + LAYOUT_PROPERTIES.add(Constants.Name.PADDING_BOTTOM); } /** @@ -396,12 +404,12 @@ public class WXTransition { switch (property){ case Constants.Name.WIDTH:{ holder = PropertyValuesHolder.ofFloat(Constants.Name.WIDTH, domObject.getLayoutWidth(), - WXViewUtils.getRealPxByWidth(WXUtils.getFloat(value), domObject.getViewPortWidth())); + WXViewUtils.getRealPxByWidth(WXUtils.getFloat(value, 0.0f), domObject.getViewPortWidth())); } break; case Constants.Name.HEIGHT:{ holder = PropertyValuesHolder.ofFloat(Constants.Name.HEIGHT, domObject.getLayoutHeight(), - WXViewUtils.getRealPxByWidth(WXUtils.getFloat(value), domObject.getViewPortWidth())); + WXViewUtils.getRealPxByWidth(WXUtils.getFloat(value, 0.0f), domObject.getViewPortWidth())); } break; case Constants.Name.MARGIN_TOP:{ @@ -424,6 +432,46 @@ public class WXTransition { WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); } break; + case Constants.Name.LEFT:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.LEFT, domObject.getPositionLeft(), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.RIGHT:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.RIGHT, domObject.getPositionRight(), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.BOTTOM:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.BOTTOM, domObject.getPositionBottom(), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.TOP:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.TOP, domObject.getPositionTop(), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.PADDING_TOP:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.PADDING_TOP, domObject.getPadding().get(Spacing.TOP), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.PADDING_BOTTOM:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.PADDING_BOTTOM, domObject.getPadding().get(Spacing.BOTTOM), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.PADDING_LEFT:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.TOP, domObject.getPadding().get(Spacing.LEFT), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; + case Constants.Name.PADDING_RIGHT:{ + holder = PropertyValuesHolder.ofFloat(Constants.Name.TOP, domObject.getPadding().get(Spacing.RIGHT), + WXViewUtils.getRealPxByWidth(WXUtils.getFloatByViewport(value, domObject.getViewPortWidth()), domObject.getViewPortWidth())); + } + break; default: break; } @@ -466,6 +514,38 @@ public class WXTransition { domObject.setMargin(Spacing.BOTTOM, (Float) animation.getAnimatedValue(property)); } break; + case Constants.Name.LEFT:{ + domObject.setPositionLeft((Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.RIGHT:{ + domObject.setPositionRight((Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.BOTTOM:{ + domObject.setPositionBottom((Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.TOP:{ + domObject.setPositionTop((Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.PADDING_TOP:{ + domObject.setPadding(Spacing.TOP, (Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.PADDING_BOTTOM:{ + domObject.setPadding(Spacing.BOTTOM, (Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.PADDING_LEFT:{ + domObject.setPadding(Spacing.LEFT, (Float) animation.getAnimatedValue(property)); + } + break; + case Constants.Name.PADDING_RIGHT:{ + domObject.setPadding(Spacing.RIGHT, (Float) animation.getAnimatedValue(property)); + } + break; default: break; }