Android: fix listItem cannot be animated

This commit is contained in:
pengfei.zhou 2021-12-03 17:33:07 +08:00 committed by osborn
parent 094a0936b9
commit c3093d9ff2
3 changed files with 39 additions and 34 deletions

View File

@ -236,6 +236,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
padding.top - rowSpace / 2, padding.top - rowSpace / 2,
padding.right - columnSpace / 2, padding.right - columnSpace / 2,
padding.bottom - rowSpace / 2); padding.bottom - rowSpace / 2);
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) { if (mView != null) {
mView.post(new Runnable() { mView.post(new Runnable() {
@Override @Override
@ -246,6 +247,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
}); });
} }
} }
}
@Override @Override
protected void blendSubNode(JSObject subProperties) { protected void blendSubNode(JSObject subProperties) {

View File

@ -168,6 +168,7 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
@Override @Override
public void blend(JSObject jsObject) { public void blend(JSObject jsObject) {
super.blend(jsObject); super.blend(jsObject);
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) { if (mView != null) {
mView.post(new Runnable() { mView.post(new Runnable() {
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@ -180,6 +181,8 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
} }
} }
}
@Override @Override
protected void blend(RecyclerView view, String name, final JSValue prop) { protected void blend(RecyclerView view, String name, final JSValue prop) {
switch (name) { switch (name) {

View File

@ -162,14 +162,13 @@ public class SliderNode extends SuperNode<RecyclerView> {
} }
slideAdapter.loop = loop; slideAdapter.loop = loop;
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) { if (mView != null) {
mView.post(new Runnable() { mView.post(new Runnable() {
@Override @Override
public void run() { public void run() {
slideAdapter.itemCount = itemCount; slideAdapter.itemCount = itemCount;
slideAdapter.notifyDataSetChanged(); slideAdapter.notifyDataSetChanged();
if (needToScroll) { if (needToScroll) {
mView.post(new Runnable() { mView.post(new Runnable() {
@Override @Override
@ -182,6 +181,7 @@ public class SliderNode extends SuperNode<RecyclerView> {
}); });
} }
} }
}
@Override @Override
protected void blend(RecyclerView view, String name, JSValue prop) { protected void blend(RecyclerView view, String name, JSValue prop) {