Android: optimize code

This commit is contained in:
pengfei.zhou 2021-07-27 17:52:06 +08:00 committed by osborn
parent ba099b6f7e
commit 1fdc84745c
2 changed files with 3 additions and 2 deletions

View File

@ -207,7 +207,7 @@ public class NestedSliderNode extends GroupNode<ViewPager> implements ViewPager.
} }
} else { } else {
//Insert //Insert
ViewNode newNode = ViewNode.create(getDoricContext(), type); ViewNode<?> newNode = ViewNode.create(getDoricContext(), type);
newNode.setId(id); newNode.setId(id);
newNode.init(this); newNode.init(this);
newNode.blend(model.getProperty("props").asObject()); newNode.blend(model.getProperty("props").asObject());
@ -217,7 +217,7 @@ public class NestedSliderNode extends GroupNode<ViewPager> implements ViewPager.
} }
int size = mChildNodes.size(); int size = mChildNodes.size();
for (int idx = mChildViewIds.size(); idx < size; idx++) { for (int idx = mChildViewIds.size(); idx < size; idx++) {
ViewNode viewNode = mChildNodes.remove(mChildViewIds.size()); ViewNode<?> viewNode = mChildNodes.remove(mChildViewIds.size());
slideItems.remove(viewNode.getNodeView()); slideItems.remove(viewNode.getNodeView());
} }
mView.getAdapter().notifyDataSetChanged(); mView.getAdapter().notifyDataSetChanged();

View File

@ -60,6 +60,7 @@ class StickDemo extends Panel {
}), }),
(new NestedSlider).also(v => { (new NestedSlider).also(v => {
v.scrollable = false
this.sliderView = v; this.sliderView = v;
v.onPageSlided = (idx) => { v.onPageSlided = (idx) => {
this.refreshTabs(idx) this.refreshTabs(idx)