Android:protect when subviews not synced from js
This commit is contained in:
parent
cf2b5b3fac
commit
f14017281e
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package pub.doric.shader;
|
package pub.doric.shader;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
@ -63,7 +64,9 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
String id = mChildViewIds.get(idx);
|
String id = mChildViewIds.get(idx);
|
||||||
JSObject model = getSubModel(id);
|
JSObject model = getSubModel(id);
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
DoricLog.e("configChildNode error when Group is %s and child is %s", this.getId(), id);
|
getDoricContext().getDriver().getRegistry().onLog(
|
||||||
|
Log.ERROR,
|
||||||
|
String.format("configChildNode error when Group is %s and child is %s", this.getId(), id));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String type = model.getProperty("type").asString().value();
|
String type = model.getProperty("type").asString().value();
|
||||||
@ -86,7 +89,7 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
newNode.init(this);
|
newNode.init(this);
|
||||||
newNode.blend(model.getProperty("props").asObject());
|
newNode.blend(model.getProperty("props").asObject());
|
||||||
mChildNodes.add(idx, newNode);
|
mChildNodes.add(idx, newNode);
|
||||||
mView.addView(newNode.getNodeView(), idx, newNode.getLayoutParams());
|
mView.addView(newNode.getNodeView(), Math.min(idx, mView.getChildCount()), newNode.getLayoutParams());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Find in remain nodes
|
//Find in remain nodes
|
||||||
@ -107,7 +110,7 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
mChildNodes.set(position, abandoned);
|
mChildNodes.set(position, abandoned);
|
||||||
//View swap index
|
//View swap index
|
||||||
mView.removeView(reused.getNodeView());
|
mView.removeView(reused.getNodeView());
|
||||||
mView.addView(reused.getNodeView(), idx);
|
mView.addView(reused.getNodeView(), Math.min(idx, mView.getChildCount()));
|
||||||
mView.removeView(abandoned.getNodeView());
|
mView.removeView(abandoned.getNodeView());
|
||||||
mView.addView(abandoned.getNodeView(), position);
|
mView.addView(abandoned.getNodeView(), position);
|
||||||
} else {
|
} else {
|
||||||
@ -118,7 +121,7 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
newNode.blend(model.getProperty("props").asObject());
|
newNode.blend(model.getProperty("props").asObject());
|
||||||
|
|
||||||
mChildNodes.add(idx, newNode);
|
mChildNodes.add(idx, newNode);
|
||||||
mView.addView(newNode.getNodeView(), idx, newNode.getLayoutParams());
|
mView.addView(newNode.getNodeView(), Math.min(idx, mView.getChildCount()), newNode.getLayoutParams());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +132,7 @@ public abstract class GroupNode<F extends ViewGroup> extends SuperNode<F> {
|
|||||||
newNode.init(this);
|
newNode.init(this);
|
||||||
newNode.blend(model.getProperty("props").asObject());
|
newNode.blend(model.getProperty("props").asObject());
|
||||||
mChildNodes.add(newNode);
|
mChildNodes.add(newNode);
|
||||||
mView.addView(newNode.getNodeView(), idx, newNode.getLayoutParams());
|
mView.addView(newNode.getNodeView(), Math.min(idx, mView.getChildCount()), newNode.getLayoutParams());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int size = mChildNodes.size();
|
int size = mChildNodes.size();
|
||||||
|
Reference in New Issue
Block a user