You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/03/02 01:48:20 UTC

[2/2] incubator-weex git commit: * [android] update modify return value from String to float (#2724)

* [android] update modify return value from String to float (#2724)

* * [android] update modify return value from String to float

* * [android] update modify value f


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

Branch: refs/heads/0.11-dev
Commit: 33a6c1e8d8508506f947ab678184b6137bce6a39
Parents: 1c315e8
Author: xkli <56...@qq.com>
Authored: Wed Mar 1 14:08:24 2017 +0800
Committer: sospartan zheng <so...@apache.org>
Committed: Wed Mar 1 14:08:24 2017 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/dom/WXDomModule.java    | 10 +++++-----
 .../java/com/taobao/weex/ui/WXRenderStatement.java    | 14 +++++++-------
 2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/33a6c1e8/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
index 9444fa4..ae097fc 100755
--- a/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
+++ b/android/sdk/src/main/java/com/taobao/weex/dom/WXDomModule.java
@@ -660,11 +660,11 @@ public final class WXDomModule extends WXModule {
     } else if ("viewport".equalsIgnoreCase(ref)) {
       if (mWXSDKInstance.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];
         mWXSDKInstance.getContainerView().getLocationOnScreen(location);
-        sizes.put("left", "0");
-        sizes.put("top", "0");
+        sizes.put("left", 0f);
+        sizes.put("top", 0f);
         sizes.put("right", getWebPxValue(mWXSDKInstance.getContainerView().getWidth()));
         sizes.put("bottom", getWebPxValue(mWXSDKInstance.getContainerView().getHeight()));
         sizes.put("width", getWebPxValue(mWXSDKInstance.getContainerView().getWidth()));
@@ -692,7 +692,7 @@ public final class WXDomModule extends WXModule {
   }
 
   @NonNull
-  private String getWebPxValue(int value) {
-    return String.valueOf(WXViewUtils.getWebPxByWidth(value,mWXSDKInstance.getViewPortWidth()));
+  private float getWebPxValue(int value) {
+    return WXViewUtils.getWebPxByWidth(value,mWXSDKInstance.getViewPortWidth());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/33a6c1e8/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java
index 0d3eb4e..ee8d2bb 100755
--- a/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/WXRenderStatement.java
@@ -538,14 +538,14 @@ class WXRenderStatement {
     WXComponent component = mRegistry.get(ref);
     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", String.valueOf(WXViewUtils.getWebPxByWidth(sizes.width(),mWXSDKInstance.getViewPortWidth())));
-      size.put("height", String.valueOf(WXViewUtils.getWebPxByWidth(sizes.height(),mWXSDKInstance.getViewPortWidth())));
-      size.put("bottom",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.bottom,mWXSDKInstance.getViewPortWidth())));
-      size.put("left",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.left,mWXSDKInstance.getViewPortWidth())));
-      size.put("right",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.right,mWXSDKInstance.getViewPortWidth())));
-      size.put("top",String.valueOf(WXViewUtils.getWebPxByWidth(sizes.top,mWXSDKInstance.getViewPortWidth())));
+      size.put("width", WXViewUtils.getWebPxByWidth(sizes.width(),mWXSDKInstance.getViewPortWidth()));
+      size.put("height", WXViewUtils.getWebPxByWidth(sizes.height(),mWXSDKInstance.getViewPortWidth()));
+      size.put("bottom",WXViewUtils.getWebPxByWidth(sizes.bottom,mWXSDKInstance.getViewPortWidth()));
+      size.put("left",WXViewUtils.getWebPxByWidth(sizes.left,mWXSDKInstance.getViewPortWidth()));
+      size.put("right",WXViewUtils.getWebPxByWidth(sizes.right,mWXSDKInstance.getViewPortWidth()));
+      size.put("top",WXViewUtils.getWebPxByWidth(sizes.top,mWXSDKInstance.getViewPortWidth()));
       options.put("size", size);
       options.put("result", true);
     } else {