Android: reset align to iOS implement
This commit is contained in:
parent
02ca1e5081
commit
a257f8e8f7
@ -265,7 +265,7 @@ public class ScrollerNode extends SuperNode<HVScrollView> implements IDoricScrol
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
public void reset() {
|
||||
super.reset();
|
||||
onScrollFuncId = null;
|
||||
onScrollEndFuncId = null;
|
||||
|
@ -150,4 +150,15 @@ public abstract class SuperNode<V extends View> extends ViewNode<V> {
|
||||
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
for (String viewId : subNodes.keySet()) {
|
||||
ViewNode<?> viewNode = getSubNodeById(viewId);
|
||||
if (viewNode != null) {
|
||||
viewNode.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,9 +144,6 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
||||
protected abstract T build();
|
||||
|
||||
public void blend(JSObject jsObject) {
|
||||
if (mSuperNode != null && mSuperNode.mReusable) {
|
||||
reset();
|
||||
}
|
||||
if (jsObject != null) {
|
||||
JSValue value = jsObject.getProperty("layoutConfig");
|
||||
if (value.isObject()) {
|
||||
|
@ -67,6 +67,7 @@ class FlowAdapter extends RecyclerView.Adapter<FlowAdapter.DoricViewHolder> {
|
||||
JSObject jsObject = jsValue.asObject();
|
||||
holder.flowLayoutItemNode.setId(jsObject.getProperty("id").asString().value());
|
||||
JSObject props = jsObject.getProperty("props").asObject();
|
||||
holder.flowLayoutItemNode.reset();
|
||||
holder.flowLayoutItemNode.blend(props);
|
||||
JSValue fullSpanValue = props.getProperty("fullSpan");
|
||||
if (fullSpanValue.isBoolean()) {
|
||||
|
@ -20,7 +20,6 @@ import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
@ -30,11 +29,8 @@ import com.github.pengfeizhou.jscore.JSObject;
|
||||
import com.github.pengfeizhou.jscore.JSValue;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@ -385,7 +381,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
public void reset() {
|
||||
super.reset();
|
||||
scrollable = true;
|
||||
loadMore = false;
|
||||
|
@ -63,6 +63,7 @@ class ListAdapter extends RecyclerView.Adapter<ListAdapter.DoricViewHolder> {
|
||||
if (jsValue != null && jsValue.isObject()) {
|
||||
JSObject jsObject = jsValue.asObject();
|
||||
holder.listItemNode.setId(jsObject.getProperty("id").asString().value());
|
||||
holder.listItemNode.reset();
|
||||
holder.listItemNode.blend(jsObject.getProperty("props").asObject());
|
||||
}
|
||||
if (this.listNode.loadMore
|
||||
|
@ -26,7 +26,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.github.pengfeizhou.jscore.JSArray;
|
||||
import com.github.pengfeizhou.jscore.JSDecoder;
|
||||
import com.github.pengfeizhou.jscore.JSNumber;
|
||||
import com.github.pengfeizhou.jscore.JSONBuilder;
|
||||
@ -34,7 +33,6 @@ import com.github.pengfeizhou.jscore.JSObject;
|
||||
import com.github.pengfeizhou.jscore.JSValue;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -350,7 +348,7 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
public void reset() {
|
||||
super.reset();
|
||||
scrollable = true;
|
||||
loadMore = false;
|
||||
|
@ -254,7 +254,7 @@ public class NestedSliderNode extends GroupNode<ViewPager> implements ViewPager.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
public void reset() {
|
||||
super.reset();
|
||||
onPageSlidedFuncId = null;
|
||||
((CustomViewPager) mView).setScrollable(true);
|
||||
|
@ -65,6 +65,7 @@ class SlideAdapter extends RecyclerView.Adapter<SlideAdapter.DoricViewHolder> {
|
||||
if (jsValue != null && jsValue.isObject()) {
|
||||
JSObject jsObject = jsValue.asObject();
|
||||
holder.slideItemNode.setId(jsObject.getProperty("id").asString().value());
|
||||
holder.slideItemNode.reset();
|
||||
holder.slideItemNode.blend(jsObject.getProperty("props").asObject());
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public class SliderNode extends SuperNode<RecyclerView> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reset() {
|
||||
public void reset() {
|
||||
super.reset();
|
||||
scrollable = true;
|
||||
onPageSlidedFuncId = null;
|
||||
|
Reference in New Issue
Block a user