Repository: incubator-weex
Updated Branches:
  refs/heads/master 2e654f6ae -> c6d99036d


[WEEX-419][android] weeks bugfix for weex AccessibilityNodeInfoCompat&rax 
stopPropagation event listener


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

Branch: refs/heads/master
Commit: c6d99036deb85772f4c8d853c4c13e84be855a0b
Parents: 2e654f6
Author: jianbai.gbj <[email protected]>
Authored: Wed May 30 20:27:40 2018 +0800
Committer: jianbai.gbj <[email protected]>
Committed: Wed May 30 20:27:40 2018 +0800

----------------------------------------------------------------------
 .../java/com/taobao/weex/common/Constants.java  |  1 +
 .../taobao/weex/ui/component/WXComponent.java   |  6 ++--
 .../taobao/weex/ui/view/gesture/WXGesture.java  | 33 ++++++++++++++++++--
 3 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6d99036/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java 
b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
index aff5fd3..1dc9019 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/Constants.java
@@ -339,6 +339,7 @@ public class Constants {
     }
 
     String STOP_PROPAGATION = "stopPropagation";
+    String STOP_PROPAGATION_RAX = "stoppropagation";
     String ONMESSAGE = "message";
     String NATIVE_BACK = "nativeback";
   }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6d99036/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
----------------------------------------------------------------------
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
index a450cb0..632f716 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXComponent.java
@@ -1199,10 +1199,10 @@ public abstract class WXComponent<T extends View> 
extends WXBasicComponent imple
       AccessibilityDelegateCompat delegate = new AccessibilityDelegateCompat() 
{
         @Override
         public void onInitializeAccessibilityNodeInfo(View host, 
AccessibilityNodeInfoCompat info) {
-          super.onInitializeAccessibilityNodeInfo(host, info);
           try {
+            super.onInitializeAccessibilityNodeInfo(host, info);
             info.setRoleDescription(finalRole);
-          } catch (Exception e) {
+          } catch (Throwable e) {
             WXLogUtils.e("SetRole failed!");
           }
         }
@@ -1268,7 +1268,7 @@ public abstract class WXComponent<T extends View> extends 
WXBasicComponent imple
         }
       }
     }
-    if(Constants.Event.STOP_PROPAGATION.equals(type)){
+    if(WXGesture.isStopPropagation(type)){
       return  true;
     }
     return false;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c6d99036/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
----------------------------------------------------------------------
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java 
b/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
index 53a5ac9..a27090b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java
@@ -35,6 +35,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.taobao.weex.bridge.EventResult;
 import com.taobao.weex.common.Constants;
+import com.taobao.weex.dom.WXEvent;
 import com.taobao.weex.ui.component.Scrollable;
 import com.taobao.weex.ui.component.WXComponent;
 import com.taobao.weex.ui.view.gesture.WXGestureType.GestureInfo;
@@ -50,6 +51,7 @@ import java.util.List;
 import java.util.Map;
 
 import static com.taobao.weex.common.Constants.Event.STOP_PROPAGATION;
+import static com.taobao.weex.common.Constants.Event.STOP_PROPAGATION_RAX;
 
 public class WXGesture extends GestureDetector.SimpleOnGestureListener 
implements OnTouchListener {
 
@@ -127,10 +129,30 @@ public class WXGesture extends 
GestureDetector.SimpleOnGestureListener implement
 
 
   /**
+   * stoppropagation
+   * */
+  public static boolean isStopPropagation(String type){
+    return  Constants.Event.STOP_PROPAGATION.equals(type) || 
Constants.Event.STOP_PROPAGATION_RAX.equals(type);
+  }
+
+  public static boolean hasStopPropagation(WXComponent component){
+    WXEvent event = component.getEvents();
+    if(event == null){
+      return false;
+    }
+    for(String type : event){
+      if(isStopPropagation(type)){
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * shouldBubbleEvent default true
    * */
   private boolean shouldBubbleTouchEvent(MotionEvent event){
-    if(component.containsEvent(STOP_PROPAGATION)){
+    if(hasStopPropagation(component)){
       if(shouldBubbleInterval > 0 && shouldBubbleCallRemainTimes > 0){
         shouldBubbleCallRemainTimes--;
         return  shouldBubbleResult;
@@ -145,7 +167,12 @@ public class WXGesture extends 
GestureDetector.SimpleOnGestureListener implement
       }else{
         eventMap.put("action", MOVE);
       }
-      EventResult result = component.fireEventWait(STOP_PROPAGATION, eventMap);
+
+      String name = STOP_PROPAGATION;
+      if(!component.getEvents().contains(STOP_PROPAGATION)){
+         name = STOP_PROPAGATION_RAX;
+      }
+      EventResult result = component.fireEventWait(name, eventMap);
       if(result.isSuccess() && result.getResult() != null){
         boolean stopPropagation = WXUtils.getBoolean(result.getResult(), 
!shouldBubbleResult);
         shouldBubbleResult = !stopPropagation;
@@ -196,7 +223,7 @@ public class WXGesture extends 
GestureDetector.SimpleOnGestureListener implement
           result |= handlePanMotionEvent(event);
           break;
       }
-      if(component.containsEvent(STOP_PROPAGATION)){
+      if(hasStopPropagation(component)){
         ViewGroup parent = (ViewGroup) v.getParent();
         boolean requestDisallowInterceptTouchEvent = false;
         if(parent != null){

Reply via email to