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