From c37f5171eadd1b11edf04feb0e9b462cfcb2bec5 Mon Sep 17 00:00:00 2001 From: fanmingyi Date: Tue, 5 Sep 2023 14:26:53 +0800 Subject: [PATCH 1/4] fix: When calling the setVisibility function,it does not necessarily trigger a callback to the onVisibilityAggregated method.Therefore, it is necessary to handle this specific situation on your own. --- .../libpag/src/main/java/org/libpag/PAGView.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/android/libpag/src/main/java/org/libpag/PAGView.java b/android/libpag/src/main/java/org/libpag/PAGView.java index 1d303aac8d..3f29e2fd1d 100644 --- a/android/libpag/src/main/java/org/libpag/PAGView.java +++ b/android/libpag/src/main/java/org/libpag/PAGView.java @@ -29,6 +29,8 @@ import android.util.AttributeSet; import android.view.TextureView; import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; import org.extra.tools.Lifecycle; import org.extra.tools.LifecycleListener; @@ -633,6 +635,20 @@ public void onAnimationEnd(PAGAnimator animator) { } } + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + //When calling the setVisibility function, + //it does not necessarily trigger a callback to the onVisibilityAggregated method. + //Therefore, it is necessary to handle this specific situation on your own. + ViewParent mParent = getParent(); + if (mParent != null && getWindowVisibility() == VISIBLE && + ((!(mParent instanceof ViewGroup)) || ((ViewGroup) mParent).isShown())) { + }else { + checkVisible(); + } + } + public void onAnimationCancel(PAGAnimator animator) { ArrayList arrayList; synchronized (PAGView.this) { From eef3d27172232ecf5c86f810de06698e6f69b6cd Mon Sep 17 00:00:00 2001 From: fanmingyi Date: Wed, 20 Sep 2023 17:28:38 +0800 Subject: [PATCH 2/4] feat:improve PAGView code. --- android/libpag/src/main/java/org/libpag/PAGView.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/android/libpag/src/main/java/org/libpag/PAGView.java b/android/libpag/src/main/java/org/libpag/PAGView.java index 3f29e2fd1d..b334a6cd70 100644 --- a/android/libpag/src/main/java/org/libpag/PAGView.java +++ b/android/libpag/src/main/java/org/libpag/PAGView.java @@ -641,12 +641,7 @@ public void setVisibility(int visibility) { //When calling the setVisibility function, //it does not necessarily trigger a callback to the onVisibilityAggregated method. //Therefore, it is necessary to handle this specific situation on your own. - ViewParent mParent = getParent(); - if (mParent != null && getWindowVisibility() == VISIBLE && - ((!(mParent instanceof ViewGroup)) || ((ViewGroup) mParent).isShown())) { - }else { - checkVisible(); - } + checkVisible(); } public void onAnimationCancel(PAGAnimator animator) { From ae885349731279266c1116c5fc9180bd93a8df90 Mon Sep 17 00:00:00 2001 From: fanmingyi Date: Thu, 21 Sep 2023 10:05:27 +0800 Subject: [PATCH 3/4] feat:remove PAGView redudant code --- android/libpag/src/main/java/org/libpag/PAGView.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/android/libpag/src/main/java/org/libpag/PAGView.java b/android/libpag/src/main/java/org/libpag/PAGView.java index b334a6cd70..7e7e4ef963 100644 --- a/android/libpag/src/main/java/org/libpag/PAGView.java +++ b/android/libpag/src/main/java/org/libpag/PAGView.java @@ -29,12 +29,8 @@ import android.util.AttributeSet; import android.view.TextureView; import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; - import org.extra.tools.Lifecycle; import org.extra.tools.LifecycleListener; - import java.util.ArrayList; From a868c96572b779dc54db4f40a64e4628fe5a6a42 Mon Sep 17 00:00:00 2001 From: fanmingyi Date: Thu, 21 Sep 2023 10:12:29 +0800 Subject: [PATCH 4/4] feat:improve PAGView code style. --- android/libpag/src/main/java/org/libpag/PAGView.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/libpag/src/main/java/org/libpag/PAGView.java b/android/libpag/src/main/java/org/libpag/PAGView.java index 7e7e4ef963..6b2db668d2 100644 --- a/android/libpag/src/main/java/org/libpag/PAGView.java +++ b/android/libpag/src/main/java/org/libpag/PAGView.java @@ -634,9 +634,9 @@ public void onAnimationEnd(PAGAnimator animator) { @Override public void setVisibility(int visibility) { super.setVisibility(visibility); - //When calling the setVisibility function, - //it does not necessarily trigger a callback to the onVisibilityAggregated method. - //Therefore, it is necessary to handle this specific situation on your own. + // When calling the setVisibility function, + // it does not necessarily trigger a callback to the onVisibilityAggregated method. + // Therefore, it is necessary to handle this specific situation on your own. checkVisible(); }