You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/12/21 08:09:11 UTC

[GitHub] YorkShen closed pull request #1951: [WEEX][Android] WXEmbed ViewAppear DisAppear Event Twice

YorkShen closed pull request #1951: [WEEX][Android]  WXEmbed ViewAppear  DisAppear Event  Twice
URL: https://github.com/apache/incubator-weex/pull/1951
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java
index d0f15ddef6..81b4025d9b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/WXEmbed.java
@@ -310,6 +310,9 @@ public void setPriority(String priority) {
    * Load embed content, default behavior is create a nested instance.
    */
   protected void loadContent(){
+    if(mNestedInstance != null){
+      mNestedInstance.destroy();
+    }
     mNestedInstance = createInstance();
     if(mListener != null && mListener.mEventListener != null){
       if(!mListener.mEventListener.onPreCreate(this,src)){
@@ -335,7 +338,11 @@ private static final int getLevel(WXEmbed embed){
 
   private WXSDKInstance createInstance() {
     WXSDKInstance sdkInstance = getInstance().createNestedInstance(this);
-    getInstance().addOnInstanceVisibleListener(this);
+
+    boolean needsAdd = !getAttrs().containsKey("disableInstanceVisibleListener");
+    if(needsAdd){ //prevent switch off fire viewappear event twice
+        getInstance().addOnInstanceVisibleListener(this);
+    }
     sdkInstance.registerRenderListener(mListener);
     mInstanceOnScrollFireEventInterceptor.resetFirstLaterScroller();;
     sdkInstance.addInstanceOnFireEventInterceptor(mInstanceOnScrollFireEventInterceptor);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services