feat:sync lost commits
This commit is contained in:
4
doric/pom.properties
Normal file
4
doric/pom.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
name=Doric
|
||||
groupId=pub.doric
|
||||
artifactId=core
|
||||
version=0.1.0
|
2
doric/src/main/assets/bundle/.gitignore
vendored
2
doric/src/main/assets/bundle/.gitignore
vendored
@@ -1 +1 @@
|
||||
*.js
|
||||
*.js
|
1921
doric/src/main/assets/bundle/doric-lib.js
Normal file
1921
doric/src/main/assets/bundle/doric-lib.js
Normal file
File diff suppressed because it is too large
Load Diff
1474
doric/src/main/assets/bundle/doric-sandbox.js
Normal file
1474
doric/src/main/assets/bundle/doric-sandbox.js
Normal file
File diff suppressed because it is too large
Load Diff
3450
doric/src/main/assets/bundle/doric-vm.js
Normal file
3450
doric/src/main/assets/bundle/doric-vm.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -339,6 +339,11 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
||||
setRotation(prop.asNumber().toFloat());
|
||||
}
|
||||
break;
|
||||
case "padding":
|
||||
if (prop.isObject()) {
|
||||
setPadding(prop.asObject());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -409,6 +414,19 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setPadding(JSObject paddings) {
|
||||
JSValue left = paddings.getProperty("left");
|
||||
JSValue right = paddings.getProperty("right");
|
||||
JSValue top = paddings.getProperty("top");
|
||||
JSValue bottom = paddings.getProperty("bottom");
|
||||
mView.setPadding(
|
||||
left.isNumber() ? DoricUtils.dp2px(left.asNumber().toFloat()) : 0,
|
||||
top.isNumber() ? DoricUtils.dp2px(top.asNumber().toFloat()) : 0,
|
||||
right.isNumber() ? DoricUtils.dp2px(right.asNumber().toFloat()) : 0,
|
||||
bottom.isNumber() ? DoricUtils.dp2px(bottom.asNumber().toFloat()) : 0
|
||||
);
|
||||
}
|
||||
|
||||
private void blendLayoutConfig(JSObject jsObject) {
|
||||
JSValue margin = jsObject.getProperty("margin");
|
||||
JSValue widthSpec = jsObject.getProperty("widthSpec");
|
||||
|
@@ -44,6 +44,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> {
|
||||
StaggeredGridLayoutManager.VERTICAL);
|
||||
private int columnSpace = 0;
|
||||
private int rowSpace = 0;
|
||||
private Rect padding = new Rect();
|
||||
private final RecyclerView.ItemDecoration spacingItemDecoration = new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
@@ -80,11 +81,9 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> {
|
||||
switch (name) {
|
||||
case "columnSpace":
|
||||
columnSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
||||
mView.setPadding(-columnSpace / 2, mView.getPaddingTop(), -columnSpace / 2, mView.getPaddingBottom());
|
||||
break;
|
||||
case "rowSpace":
|
||||
rowSpace = DoricUtils.dp2px(prop.asNumber().toFloat());
|
||||
mView.setPadding(mView.getPaddingLeft(), -rowSpace / 2, mView.getPaddingRight(), -rowSpace / 2);
|
||||
break;
|
||||
case "columnCount":
|
||||
staggeredGridLayoutManager.setSpanCount(prop.asNumber().toInt());
|
||||
@@ -107,9 +106,26 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPadding(JSObject jsObject) {
|
||||
JSValue left = jsObject.getProperty("left");
|
||||
JSValue right = jsObject.getProperty("right");
|
||||
JSValue top = jsObject.getProperty("top");
|
||||
JSValue bottom = jsObject.getProperty("bottom");
|
||||
padding.left = left.isNumber() ? DoricUtils.dp2px(left.asNumber().toFloat()) : 0;
|
||||
padding.top = top.isNumber() ? DoricUtils.dp2px(top.asNumber().toFloat()) : 0;
|
||||
padding.right = right.isNumber() ? DoricUtils.dp2px(right.asNumber().toFloat()) : 0;
|
||||
padding.bottom = bottom.isNumber() ? DoricUtils.dp2px(bottom.asNumber().toFloat()) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blend(JSObject jsObject) {
|
||||
super.blend(jsObject);
|
||||
mView.setPadding(
|
||||
padding.left - columnSpace / 2,
|
||||
padding.top - rowSpace / 2,
|
||||
padding.right - columnSpace / 2,
|
||||
padding.bottom - rowSpace / 2);
|
||||
if (mView != null) {
|
||||
mView.post(new Runnable() {
|
||||
@Override
|
||||
|
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package pub.doric.shader.slider;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.github.pengfeizhou.jscore.JSObject;
|
||||
@@ -50,7 +51,7 @@ public class SlideItemNode extends StackNode {
|
||||
@Override
|
||||
public void blend(JSObject jsObject) {
|
||||
super.blend(jsObject);
|
||||
getNodeView().getLayoutParams().width = getLayoutParams().width;
|
||||
getNodeView().getLayoutParams().height = getLayoutParams().height;
|
||||
getNodeView().getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getNodeView().getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user