Repository: incubator-weex
Updated Branches:
  refs/heads/0.12-dev a67604ced -> 1066ec6f7


* [android] fix dom#getcomponentrect data type


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1066ec6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1066ec6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1066ec6f

Branch: refs/heads/0.12-dev
Commit: 1066ec6f7e0c0ae21bcfe620169d925320559086
Parents: a67604c
Author: sospartan <[email protected]>
Authored: Thu Mar 16 16:56:28 2017 +0800
Committer: sospartan <[email protected]>
Committed: Thu Mar 16 16:58:13 2017 +0800

----------------------------------------------------------------------
 .../taobao/weex/dom/action/GetComponentRectAction.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1066ec6f/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
----------------------------------------------------------------------
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
 
b/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
index 3fcd938..aafa324 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/dom/action/GetComponentRectAction.java
@@ -221,6 +221,7 @@ import com.taobao.weex.utils.WXViewUtils;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
 /**
  * Created by sospartan on 02/03/2017.
@@ -263,7 +264,7 @@ class GetComponentRectAction implements DOMAction, 
RenderAction {
       WXComponent component = context.getComponent(mRef);
       Map<String, Object> options = new HashMap<>();
       if (component != null) {
-        Map<String, String> size = new HashMap<>();
+        Map<String, Float> size = new HashMap<>();
         Rect sizes = component.getComponentSize();
         size.put("width", getWebPxValue(sizes.width()));
         size.put("height", getWebPxValue(sizes.height()));
@@ -285,11 +286,11 @@ class GetComponentRectAction implements DOMAction, 
RenderAction {
     View container;
     if ((container = instance.getContainerView()) != null) {
       Map<String, Object> options = new HashMap<>();
-      Map<String, String> sizes = new HashMap<>();
+      Map<String, Float> sizes = new HashMap<>();
       int[] location = new int[2];
       instance.getContainerView().getLocationOnScreen(location);
-      sizes.put("left", "0");
-      sizes.put("top", "0");
+      sizes.put("left", 0f);
+      sizes.put("top", 0f);
       sizes.put("right", getWebPxValue(container.getWidth()));
       sizes.put("bottom", getWebPxValue(container.getHeight()));
       sizes.put("width", getWebPxValue(container.getWidth()));
@@ -306,8 +307,8 @@ class GetComponentRectAction implements DOMAction, 
RenderAction {
   }
 
   @NonNull
-  private String getWebPxValue(int value) {
-    return String.valueOf(WXViewUtils.getWebPxByWidth(value, 
WXSDKInstance.getViewPortWidth()));
+  private float getWebPxValue(int value) {
+    return WXViewUtils.getWebPxByWidth(value, 
WXSDKInstance.getViewPortWidth());
   }
 
 

Reply via email to