You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mi...@apache.org on 2017/08/16 03:49:19 UTC

[11/13] incubator-weex git commit: Revert: + [android] return contentSize on getComponentRect when target component implemented ContentMeasurable @notdanger

Revert: + [android] return contentSize on getComponentRect when target component implemented ContentMeasurable @notdanger


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

Branch: refs/heads/0.16-dev
Commit: 238288782c20cbe420bb0f0192a7b09d56d275fb
Parents: d336ad2
Author: misakuo <mi...@apache.org>
Authored: Tue Aug 15 17:09:11 2017 +0800
Committer: misakuo <mi...@apache.org>
Committed: Tue Aug 15 17:09:11 2017 +0800

----------------------------------------------------------------------
 .../weex/dom/action/GetComponentRectAction.java | 12 --------
 .../weex/ui/component/ContentMeasurable.java    | 29 --------------------
 .../taobao/weex/ui/component/WXScroller.java    | 16 +----------
 .../ui/component/list/BasicListComponent.java   | 18 +-----------
 4 files changed, 2 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23828878/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 d622248..cf8e224 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
@@ -28,7 +28,6 @@ import com.taobao.weex.bridge.JSCallback;
 import com.taobao.weex.bridge.SimpleJSCallback;
 import com.taobao.weex.dom.RenderAction;
 import com.taobao.weex.dom.RenderActionContext;
-import com.taobao.weex.ui.component.ContentMeasurable;
 import com.taobao.weex.ui.component.WXComponent;
 import com.taobao.weex.utils.WXViewUtils;
 
@@ -75,17 +74,6 @@ class GetComponentRectAction implements RenderAction {
         size.put("top", getWebPxValue(sizes.top,viewPort));
         options.put("size", size);
         options.put("result", true);
-
-        if (component instanceof ContentMeasurable) {
-          Rect contentFrame = ((ContentMeasurable) component).getContentFrame();
-          if (contentFrame != null) {
-            Map<String, Float> contentSize = new HashMap<>(2);
-            contentSize.put("width", getWebPxValue(contentFrame.width(), viewPort));
-            contentSize.put("height", getWebPxValue(contentFrame.height(), viewPort));
-            options.put("contentSize", contentSize);
-          }
-        }
-
       } else {
         options.put("errMsg", "Component does not exist");
       }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23828878/android/sdk/src/main/java/com/taobao/weex/ui/component/ContentMeasurable.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/ContentMeasurable.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/ContentMeasurable.java
deleted file mode 100644
index b804d5b..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/ContentMeasurable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.taobao.weex.ui.component;
-
-import android.graphics.Rect;
-
-/**
- * Created by moxun on 2017/7/31.
- */
-
-public interface ContentMeasurable {
-  Rect getContentFrame();
-}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23828878/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
index 49037ca..627776f 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXScroller.java
@@ -69,7 +69,7 @@ import java.util.Map.Entry;
  */
 @Component(lazyload = false)
 
-public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewListener,Scrollable,ContentMeasurable {
+public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewListener,Scrollable {
 
   public static final String DIRECTION = "direction";
   protected int mOrientation = Constants.Orientation.VERTICAL;
@@ -719,18 +719,4 @@ public class WXScroller extends WXVContainer<ViewGroup> implements WXScrollViewL
   public void resetLoadmore() {
     mForceLoadmoreNextTime = true;
   }
-
-
-  @Override
-  public Rect getContentFrame() {
-    View innerView = getInnerView();
-    if (innerView != null) {
-      if (innerView instanceof WXScrollView) {
-        return ((WXScrollView) innerView).getContentFrame();
-      } else if (innerView instanceof WXHorizontalScrollView) {
-        return ((WXHorizontalScrollView) innerView).getContentFrame();
-      }
-    }
-    return null;
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23828878/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
index 9f3b2cc..c959351 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/list/BasicListComponent.java
@@ -23,7 +23,6 @@ import android.content.Context;
 import android.graphics.Color;
 import android.graphics.Point;
 import android.graphics.PointF;
-import android.graphics.Rect;
 import android.os.Build;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
@@ -52,7 +51,6 @@ import com.taobao.weex.dom.ImmutableDomObject;
 import com.taobao.weex.dom.WXAttr;
 import com.taobao.weex.dom.WXDomObject;
 import com.taobao.weex.ui.component.AppearanceHelper;
-import com.taobao.weex.ui.component.ContentMeasurable;
 import com.taobao.weex.ui.component.Scrollable;
 import com.taobao.weex.ui.component.WXBaseRefresh;
 import com.taobao.weex.ui.component.WXComponent;
@@ -87,7 +85,7 @@ import java.util.regex.Pattern;
  */
 
 public abstract class BasicListComponent<T extends ViewGroup & ListComponentView> extends WXVContainer<T> implements
-    IRecyclerAdapterListener<ListBaseViewHolder>, IOnLoadMoreListener, Scrollable, ContentMeasurable {
+    IRecyclerAdapterListener<ListBaseViewHolder>, IOnLoadMoreListener, Scrollable {
   public static final String TRANSFORM = "transform";
   public static final String LOADMOREOFFSET = "loadmoreoffset";
   private String TAG = "BasicListComponent";
@@ -1333,18 +1331,4 @@ public abstract class BasicListComponent<T extends ViewGroup & ListComponentView
 
     return false;
   }
-
-  @Override
-  public Rect getContentFrame() {
-    T wrapper = getHostView();
-    if (wrapper != null) {
-      RecyclerView recyclerView = wrapper.getInnerView();
-      if (recyclerView != null) {
-        int contentWidth = recyclerView.getMeasuredWidth() + recyclerView.computeHorizontalScrollRange();
-        int contentHeight = recyclerView.getMeasuredHeight() + recyclerView.computeVerticalScrollRange();
-        return new Rect(0, 0, contentWidth, contentHeight);
-      }
-    }
-    return null;
-  }
 }