From 92c22def29102fa96ba31afb0ebaca79c9b4bced Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Wed, 27 Oct 2021 17:36:08 +0800 Subject: [PATCH] android: reset scroller node when reuse this node --- doric-android/doric/build.gradle | 8 ++++---- .../src/main/java/pub/doric/shader/ScrollerNode.java | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doric-android/doric/build.gradle b/doric-android/doric/build.gradle index d3865969..20b951cd 100644 --- a/doric-android/doric/build.gradle +++ b/doric-android/doric/build.gradle @@ -31,22 +31,22 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' - api 'com.github.penfeizhou:jsc4a:0.1.0' + implementation 'androidx.appcompat:appcompat:1.3.1' + api 'com.github.penfeizhou:jsc4a:0.2.5' implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation('com.github.penfeizhou.android.animation:glide-plugin:2.13.0') { exclude group: 'com.github.bumptech.glide' } implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'jp.wasabeef:glide-transformations:4.1.0' - implementation "com.google.android.material:material:1.1.0" + implementation "com.google.android.material:material:1.2.1" def nav_version = "2.3.0" implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-ui:$nav_version" - implementation "com.qmuiteam:qmui:1.4.4" + implementation "com.qmuiteam:qmui:1.4.5" testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/doric-android/doric/src/main/java/pub/doric/shader/ScrollerNode.java b/doric-android/doric/src/main/java/pub/doric/shader/ScrollerNode.java index 9c809fa9..b816772e 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/ScrollerNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/ScrollerNode.java @@ -52,7 +52,7 @@ public class ScrollerNode extends SuperNode implements IDoricScrol private final Set listeners = new HashSet<>(); private String onScrollFuncId; private String onScrollEndFuncId; - private DoricJSDispatcher jsDispatcher = new DoricJSDispatcher(); + private final DoricJSDispatcher jsDispatcher = new DoricJSDispatcher(); private static class MaximumScrollView extends HVScrollView { private int maxWidth = Integer.MAX_VALUE; @@ -263,4 +263,11 @@ public class ScrollerNode extends SuperNode implements IDoricScrol DoricUtils.dp2px(offset.getProperty("y").asNumber().toFloat())); } } + + @Override + protected void reset() { + super.reset(); + onScrollFuncId = null; + onScrollEndFuncId = null; + } }