android:add data type check for blending
This commit is contained in:
parent
75fbb3d527
commit
66afc4c4bb
@ -40,10 +40,19 @@ public class RefreshableNode extends SuperNode<DoricSwipeLayout> implements Pull
|
|||||||
@Override
|
@Override
|
||||||
protected void blend(DoricSwipeLayout view, String name, JSValue prop) {
|
protected void blend(DoricSwipeLayout view, String name, JSValue prop) {
|
||||||
if ("content".equals(name)) {
|
if ("content".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mContentViewId = prop.asString().value();
|
mContentViewId = prop.asString().value();
|
||||||
} else if ("header".equals(name)) {
|
} else if ("header".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mHeaderViewId = prop.asString().value();
|
mHeaderViewId = prop.asString().value();
|
||||||
} else if ("onRefresh".equals(name)) {
|
} else if ("onRefresh".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final String funcId = prop.asString().value();
|
final String funcId = prop.asString().value();
|
||||||
mView.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
|
mView.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,7 +66,7 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ImageView build() {
|
protected ImageView build() {
|
||||||
ImageView imageView = new ImageView(getContext());
|
ImageView imageView = new ImageView(getContext());
|
||||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
return imageView;
|
return imageView;
|
||||||
}
|
}
|
||||||
@ -188,6 +188,9 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
protected void blend(ImageView view, String name, JSValue prop) {
|
protected void blend(ImageView view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "imageUrl":
|
case "imageUrl":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadImageUrl(prop.asString().value());
|
loadImageUrl(prop.asString().value());
|
||||||
break;
|
break;
|
||||||
case "scaleType":
|
case "scaleType":
|
||||||
@ -208,6 +211,9 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
this.loadCallbackId = prop.asString().value();
|
this.loadCallbackId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
case "imageBase64":
|
case "imageBase64":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Pattern r = Pattern.compile("data:image/(\\S+?);base64,(\\S+)");
|
Pattern r = Pattern.compile("data:image/(\\S+?);base64,(\\S+)");
|
||||||
Matcher m = r.matcher(prop.asString().value());
|
Matcher m = r.matcher(prop.asString().value());
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
@ -225,10 +231,16 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "imagePath":
|
case "imagePath":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String localName = prop.asString().value();
|
String localName = prop.asString().value();
|
||||||
loadImageUrl("file:///android_asset/" + localName);
|
loadImageUrl("file:///android_asset/" + localName);
|
||||||
break;
|
break;
|
||||||
case "imageRes":
|
case "imageRes":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int resId = getContext().getResources().getIdentifier(
|
int resId = getContext().getResources().getIdentifier(
|
||||||
prop.asString().value().toLowerCase(),
|
prop.asString().value().toLowerCase(),
|
||||||
"drawable",
|
"drawable",
|
||||||
|
@ -62,6 +62,9 @@ public class LinearNode extends GroupNode<LinearLayout> {
|
|||||||
protected void blend(LinearLayout view, String name, JSValue prop) {
|
protected void blend(LinearLayout view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "space":
|
case "space":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ShapeDrawable shapeDrawable;
|
ShapeDrawable shapeDrawable;
|
||||||
if (view.getDividerDrawable() == null) {
|
if (view.getDividerDrawable() == null) {
|
||||||
shapeDrawable = new ShapeDrawable();
|
shapeDrawable = new ShapeDrawable();
|
||||||
@ -79,6 +82,9 @@ public class LinearNode extends GroupNode<LinearLayout> {
|
|||||||
view.setDividerDrawable(shapeDrawable);
|
view.setDividerDrawable(shapeDrawable);
|
||||||
break;
|
break;
|
||||||
case "gravity":
|
case "gravity":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setGravity(prop.asNumber().toInt());
|
view.setGravity(prop.asNumber().toInt());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -99,10 +99,19 @@ public class ScrollerNode extends SuperNode<HVScrollView> implements IDoricScrol
|
|||||||
@Override
|
@Override
|
||||||
protected void blend(HVScrollView view, String name, JSValue prop) {
|
protected void blend(HVScrollView view, String name, JSValue prop) {
|
||||||
if ("content".equals(name)) {
|
if ("content".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mChildViewId = prop.asString().value();
|
mChildViewId = prop.asString().value();
|
||||||
} else if ("onScroll".equals(name)) {
|
} else if ("onScroll".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
onScrollFuncId = prop.asString().value();
|
onScrollFuncId = prop.asString().value();
|
||||||
} else if ("onScrollEnd".equals(name)) {
|
} else if ("onScrollEnd".equals(name)) {
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
onScrollEndFuncId = prop.asString().value();
|
onScrollEndFuncId = prop.asString().value();
|
||||||
} else {
|
} else {
|
||||||
super.blend(view, name, prop);
|
super.blend(view, name, prop);
|
||||||
|
@ -52,9 +52,15 @@ public class SwitchNode extends ViewNode<SwitchCompat> {
|
|||||||
protected void blend(SwitchCompat view, String name, JSValue prop) {
|
protected void blend(SwitchCompat view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "state":
|
case "state":
|
||||||
|
if (!prop.isBoolean()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setChecked(prop.asBoolean().value());
|
view.setChecked(prop.asBoolean().value());
|
||||||
break;
|
break;
|
||||||
case "onSwitch":
|
case "onSwitch":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final String callbackId = prop.asString().value();
|
final String callbackId = prop.asString().value();
|
||||||
view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
view.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -64,12 +70,21 @@ public class SwitchNode extends ViewNode<SwitchCompat> {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "offTintColor":
|
case "offTintColor":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.offTintColor = prop.asNumber().toInt();
|
this.offTintColor = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
case "onTintColor":
|
case "onTintColor":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onTintColor = prop.asNumber().toInt();
|
this.onTintColor = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
case "thumbTintColor":
|
case "thumbTintColor":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.thumbTintColor = prop.asNumber().toInt();
|
this.thumbTintColor = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -23,7 +23,6 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.github.pengfeizhou.jscore.JSValue;
|
import com.github.pengfeizhou.jscore.JSValue;
|
||||||
|
|
||||||
import pub.doric.Doric;
|
|
||||||
import pub.doric.DoricContext;
|
import pub.doric.DoricContext;
|
||||||
import pub.doric.extension.bridge.DoricPlugin;
|
import pub.doric.extension.bridge.DoricPlugin;
|
||||||
import pub.doric.utils.DoricUtils;
|
import pub.doric.utils.DoricUtils;
|
||||||
@ -52,16 +51,27 @@ public class TextNode extends ViewNode<TextView> {
|
|||||||
protected void blend(TextView view, String name, JSValue prop) {
|
protected void blend(TextView view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "text":
|
case "text":
|
||||||
view.setLineSpacing(0, 1);
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setText(prop.asString().toString());
|
view.setText(prop.asString().toString());
|
||||||
break;
|
break;
|
||||||
case "textSize":
|
case "textSize":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setTextSize(TypedValue.COMPLEX_UNIT_DIP, prop.asNumber().toFloat());
|
view.setTextSize(TypedValue.COMPLEX_UNIT_DIP, prop.asNumber().toFloat());
|
||||||
break;
|
break;
|
||||||
case "textColor":
|
case "textColor":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setTextColor(prop.asNumber().toInt());
|
view.setTextColor(prop.asNumber().toInt());
|
||||||
break;
|
break;
|
||||||
case "textAlignment":
|
case "textAlignment":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setGravity(prop.asNumber().toInt() | Gravity.CENTER_VERTICAL);
|
view.setGravity(prop.asNumber().toInt() | Gravity.CENTER_VERTICAL);
|
||||||
break;
|
break;
|
||||||
case "maxLines":
|
case "maxLines":
|
||||||
@ -87,6 +97,9 @@ public class TextNode extends ViewNode<TextView> {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "font":
|
case "font":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String font = prop.asString().toString();
|
String font = prop.asString().toString();
|
||||||
if (font.endsWith(".ttf")) {
|
if (font.endsWith(".ttf")) {
|
||||||
Typeface iconFont = Typeface.createFromAsset(getContext().getAssets(), font);
|
Typeface iconFont = Typeface.createFromAsset(getContext().getAssets(), font);
|
||||||
@ -98,12 +111,21 @@ public class TextNode extends ViewNode<TextView> {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "maxWidth":
|
case "maxWidth":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setMaxWidth(DoricUtils.dp2px(prop.asNumber().toFloat()));
|
view.setMaxWidth(DoricUtils.dp2px(prop.asNumber().toFloat()));
|
||||||
break;
|
break;
|
||||||
case "maxHeight":
|
case "maxHeight":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setMaxHeight(DoricUtils.dp2px(prop.asNumber().toFloat()));
|
view.setMaxHeight(DoricUtils.dp2px(prop.asNumber().toFloat()));
|
||||||
break;
|
break;
|
||||||
case "lineSpacing":
|
case "lineSpacing":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
view.setLineSpacing(DoricUtils.dp2px(prop.asNumber().toFloat()), 1);
|
view.setLineSpacing(DoricUtils.dp2px(prop.asNumber().toFloat()), 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -148,6 +148,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
protected void blend(T view, String name, JSValue prop) {
|
protected void blend(T view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "width":
|
case "width":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -159,6 +162,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "height":
|
case "height":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -170,6 +176,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "x":
|
case "x":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -181,6 +190,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "y":
|
case "y":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -248,6 +260,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "onClick":
|
case "onClick":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final String functionId = prop.asString().value();
|
final String functionId = prop.asString().value();
|
||||||
view.setOnClickListener(new View.OnClickListener() {
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -264,6 +279,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "alpha":
|
case "alpha":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -310,6 +328,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "translationX":
|
case "translationX":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -321,6 +342,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "translationY":
|
case "translationY":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -332,6 +356,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "scaleX":
|
case "scaleX":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -343,6 +370,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "scaleY":
|
case "scaleY":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -354,6 +384,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "pivotX":
|
case "pivotX":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -365,6 +398,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "pivotY":
|
case "pivotY":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
@ -376,6 +412,9 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "rotation":
|
case "rotation":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
addAnimator(ObjectAnimator.ofFloat(
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
this,
|
this,
|
||||||
|
@ -113,18 +113,33 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
protected void blend(RecyclerView view, String name, JSValue prop) {
|
protected void blend(RecyclerView view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "columnSpace":
|
case "columnSpace":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
columnSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
columnSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
||||||
break;
|
break;
|
||||||
case "rowSpace":
|
case "rowSpace":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rowSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
rowSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
||||||
break;
|
break;
|
||||||
case "columnCount":
|
case "columnCount":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
staggeredGridLayoutManager.setSpanCount(prop.asNumber().toInt());
|
staggeredGridLayoutManager.setSpanCount(prop.asNumber().toInt());
|
||||||
break;
|
break;
|
||||||
case "itemCount":
|
case "itemCount":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.flowAdapter.itemCount = prop.asNumber().toInt();
|
this.flowAdapter.itemCount = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
case "renderItem":
|
case "renderItem":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String funcId = prop.asString().value();
|
String funcId = prop.asString().value();
|
||||||
if (!funcId.equals(this.flowAdapter.renderItemFuncId)) {
|
if (!funcId.equals(this.flowAdapter.renderItemFuncId)) {
|
||||||
this.flowAdapter.renderItemFuncId = funcId;
|
this.flowAdapter.renderItemFuncId = funcId;
|
||||||
@ -136,21 +151,39 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "batchCount":
|
case "batchCount":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.flowAdapter.batchCount = prop.asNumber().toInt();
|
this.flowAdapter.batchCount = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
case "onLoadMore":
|
case "onLoadMore":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onLoadMoreFuncId = prop.asString().value();
|
this.onLoadMoreFuncId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
case "loadMoreView":
|
case "loadMoreView":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loadMoreViewId = prop.asString().value();
|
this.loadMoreViewId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
case "loadMore":
|
case "loadMore":
|
||||||
|
if (!prop.isBoolean()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loadMore = prop.asBoolean().value();
|
this.loadMore = prop.asBoolean().value();
|
||||||
break;
|
break;
|
||||||
case "onScroll":
|
case "onScroll":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onScrollFuncId = prop.asString().value();
|
this.onScrollFuncId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
case "onScrollEnd":
|
case "onScrollEnd":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onScrollEndFuncId = prop.asString().value();
|
this.onScrollEndFuncId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -136,9 +136,15 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
protected void blend(RecyclerView view, String name, JSValue prop) {
|
protected void blend(RecyclerView view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "itemCount":
|
case "itemCount":
|
||||||
|
if (!prop.isNumber()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.itemCount = prop.asNumber().toInt();
|
this.itemCount = prop.asNumber().toInt();
|
||||||
break;
|
break;
|
||||||
case "renderItem":
|
case "renderItem":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String funcId = prop.asString().value();
|
String funcId = prop.asString().value();
|
||||||
if (!funcId.equals(this.renderItemFuncId)) {
|
if (!funcId.equals(this.renderItemFuncId)) {
|
||||||
this.renderItemFuncId = funcId;
|
this.renderItemFuncId = funcId;
|
||||||
@ -162,9 +168,15 @@ public class ListNode extends SuperNode<RecyclerView> implements IDoricScrollabl
|
|||||||
this.loadMore = prop.asBoolean().value();
|
this.loadMore = prop.asBoolean().value();
|
||||||
break;
|
break;
|
||||||
case "onScroll":
|
case "onScroll":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onScrollFuncId = prop.asString().value();
|
this.onScrollFuncId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
case "onScrollEnd":
|
case "onScrollEnd":
|
||||||
|
if (!prop.isString()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.onScrollEndFuncId = prop.asString().value();
|
this.onScrollEndFuncId = prop.asString().value();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user