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,14 +236,16 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
padding.top - rowSpace / 2,
padding.right - columnSpace / 2,
padding.bottom - rowSpace / 2);
if (mView != null) {
mView.post(new Runnable() {
@Override
public void run() {
flowAdapter.itemCount = itemCount;
flowAdapter.notifyDataSetChanged();
}
});
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) {
mView.post(new Runnable() {
@Override
public void run() {
flowAdapter.itemCount = itemCount;
flowAdapter.notifyDataSetChanged();
}
});
}
}
}

View File

@ -168,16 +168,19 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
@Override
public void blend(JSObject jsObject) {
super.blend(jsObject);
if (mView != null) {
mView.post(new Runnable() {
@SuppressLint("NotifyDataSetChanged")
@Override
public void run() {
listAdapter.itemCount = itemCount;
listAdapter.notifyDataSetChanged();
}
});
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) {
mView.post(new Runnable() {
@SuppressLint("NotifyDataSetChanged")
@Override
public void run() {
listAdapter.itemCount = itemCount;
listAdapter.notifyDataSetChanged();
}
});
}
}
}
@Override

View File

@ -162,24 +162,24 @@ public class SliderNode extends SuperNode<RecyclerView> {
}
slideAdapter.loop = loop;
if (mView != null) {
mView.post(new Runnable() {
@Override
public void run() {
slideAdapter.itemCount = itemCount;
slideAdapter.notifyDataSetChanged();
if (needToScroll) {
mView.post(new Runnable() {
@Override
public void run() {
mView.scrollToPosition(1);
}
});
if (jsObject.propertySet().size() > 1 || !jsObject.propertySet().contains("subviews")) {
if (mView != null) {
mView.post(new Runnable() {
@Override
public void run() {
slideAdapter.itemCount = itemCount;
slideAdapter.notifyDataSetChanged();
if (needToScroll) {
mView.post(new Runnable() {
@Override
public void run() {
mView.scrollToPosition(1);
}
});
}
}
}
});
});
}
}
}