android: reset scroller node when reuse this node

This commit is contained in:
pengfei.zhou 2021-10-27 17:36:08 +08:00 committed by osborn
parent 481e643ff9
commit 92c22def29
2 changed files with 12 additions and 5 deletions

View File

@ -31,22 +31,22 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.3.1'
api 'com.github.penfeizhou:jsc4a:0.1.0' api 'com.github.penfeizhou:jsc4a:0.2.5'
implementation 'com.squareup.okhttp3:okhttp:3.12.1' implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation('com.github.penfeizhou.android.animation:glide-plugin:2.13.0') { implementation('com.github.penfeizhou.android.animation:glide-plugin:2.13.0') {
exclude group: 'com.github.bumptech.glide' exclude group: 'com.github.bumptech.glide'
} }
implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'jp.wasabeef:glide-transformations:4.1.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" def nav_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$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' testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'

View File

@ -52,7 +52,7 @@ public class ScrollerNode extends SuperNode<HVScrollView> implements IDoricScrol
private final Set<DoricScrollChangeListener> listeners = new HashSet<>(); private final Set<DoricScrollChangeListener> listeners = new HashSet<>();
private String onScrollFuncId; private String onScrollFuncId;
private String onScrollEndFuncId; private String onScrollEndFuncId;
private DoricJSDispatcher jsDispatcher = new DoricJSDispatcher(); private final DoricJSDispatcher jsDispatcher = new DoricJSDispatcher();
private static class MaximumScrollView extends HVScrollView { private static class MaximumScrollView extends HVScrollView {
private int maxWidth = Integer.MAX_VALUE; private int maxWidth = Integer.MAX_VALUE;
@ -263,4 +263,11 @@ public class ScrollerNode extends SuperNode<HVScrollView> implements IDoricScrol
DoricUtils.dp2px(offset.getProperty("y").asNumber().toFloat())); DoricUtils.dp2px(offset.getProperty("y").asNumber().toFloat()));
} }
} }
@Override
protected void reset() {
super.reset();
onScrollFuncId = null;
onScrollEndFuncId = null;
}
} }