mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 17:54:48 +00:00
Back to JNI storage
Summary: @public This reverts the Yoga/Java storage experiment. I will follow up with any learnings. Reviewed By: pasqualeanatriello Differential Revision: D9168405 fbshipit-source-id: fb227fb9353bd4c4e3bebbe9b04eec1132e532e8
This commit is contained in:
parent
73d5746122
commit
151ec411aa
@ -1,7 +0,0 @@
|
|||||||
load("//ReactNative:DEFS.bzl", "rn_android_library")
|
|
||||||
|
|
||||||
rn_android_library(
|
|
||||||
name = "stubs",
|
|
||||||
srcs = glob(["stubs/src/**/*.java"]),
|
|
||||||
visibility = ["PUBLIC"],
|
|
||||||
)
|
|
@ -305,7 +305,6 @@ dependencies {
|
|||||||
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
|
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
|
||||||
compile 'com.squareup.okio:okio:1.14.0'
|
compile 'com.squareup.okio:okio:1.14.0'
|
||||||
compile 'org.webkit:android-jsc:r174650'
|
compile 'org.webkit:android-jsc:r174650'
|
||||||
compileOnly project(':ReactAndroid:stubs')
|
|
||||||
|
|
||||||
testCompile "junit:junit:${JUNIT_VERSION}"
|
testCompile "junit:junit:${JUNIT_VERSION}"
|
||||||
testCompile "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
|
testCompile "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
load("//ReactNative:DEFS.bzl", "react_native_dep", "rn_android_library", "JAVA_STUBS_TARGET")
|
load("//ReactNative:DEFS.bzl", "react_native_dep", "rn_android_library")
|
||||||
|
|
||||||
rn_android_library(
|
rn_android_library(
|
||||||
name = "yoga",
|
name = "yoga",
|
||||||
@ -10,7 +10,4 @@ rn_android_library(
|
|||||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||||
],
|
],
|
||||||
provided_deps = [
|
|
||||||
JAVA_STUBS_TARGET,
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
@ -21,74 +21,132 @@ public class YogaNode implements Cloneable {
|
|||||||
SoLoader.loadLibrary("yoga");
|
SoLoader.loadLibrary("yoga");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int BYTE_BUFFER = 1;
|
/**
|
||||||
public static final int HYBRID = 2;
|
* Get native instance count. Useful for testing only.
|
||||||
public static final int UNSAFE = 3;
|
*/
|
||||||
|
|
||||||
/** Get native instance count. Useful for testing only. */
|
|
||||||
static native int jni_YGNodeGetInstanceCount();
|
static native int jni_YGNodeGetInstanceCount();
|
||||||
|
|
||||||
private YogaNodeProperties mDelegate;
|
|
||||||
private YogaNode mOwner;
|
private YogaNode mOwner;
|
||||||
@Nullable private List<YogaNode> mChildren;
|
@Nullable private List<YogaNode> mChildren;
|
||||||
private YogaMeasureFunction mMeasureFunction;
|
private YogaMeasureFunction mMeasureFunction;
|
||||||
private YogaBaselineFunction mBaselineFunction;
|
private YogaBaselineFunction mBaselineFunction;
|
||||||
|
private long mNativePointer;
|
||||||
private Object mData;
|
private Object mData;
|
||||||
|
|
||||||
|
/* Those flags needs be in sync with YGJNI.cpp */
|
||||||
|
private static final int MARGIN = 1;
|
||||||
|
private static final int PADDING = 2;
|
||||||
|
private static final int BORDER = 4;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
private int mEdgeSetFlag = 0;
|
||||||
|
|
||||||
|
private boolean mHasSetPosition = false;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
private float mWidth = YogaConstants.UNDEFINED;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mHeight = YogaConstants.UNDEFINED;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mTop = YogaConstants.UNDEFINED;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mLeft = YogaConstants.UNDEFINED;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mMarginLeft = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mMarginTop = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mMarginRight = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mMarginBottom = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mPaddingLeft = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mPaddingTop = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mPaddingRight = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mPaddingBottom = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mBorderLeft = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mBorderTop = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mBorderRight = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private float mBorderBottom = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private int mLayoutDirection = 0;
|
||||||
|
@DoNotStrip
|
||||||
|
private boolean mHasNewLayout = true;
|
||||||
|
@DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false;
|
||||||
|
|
||||||
|
private native long jni_YGNodeNew();
|
||||||
public YogaNode() {
|
public YogaNode() {
|
||||||
mDelegate = new YogaNodePropertiesJNI(this);
|
mNativePointer = jni_YGNodeNew();
|
||||||
|
if (mNativePointer == 0) {
|
||||||
|
throw new IllegalStateException("Failed to allocate native memory");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native long jni_YGNodeNewWithConfig(long configPointer);
|
||||||
public YogaNode(YogaConfig config) {
|
public YogaNode(YogaConfig config) {
|
||||||
mDelegate = new YogaNodePropertiesJNI(this, config);
|
mNativePointer = jni_YGNodeNewWithConfig(config.mNativePointer);
|
||||||
}
|
if (mNativePointer == 0) {
|
||||||
|
throw new IllegalStateException("Failed to allocate native memory");
|
||||||
public YogaNode(int storageType) {
|
|
||||||
switch (storageType) {
|
|
||||||
case BYTE_BUFFER:
|
|
||||||
mDelegate = new YogaNodePropertiesByteBuffer(this);
|
|
||||||
break;
|
|
||||||
case HYBRID:
|
|
||||||
mDelegate = new YogaNodePropertiesHybrid(this);
|
|
||||||
break;
|
|
||||||
case UNSAFE:
|
|
||||||
mDelegate = new YogaNodePropertiesUnsafe(this);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mDelegate = new YogaNodePropertiesJNI(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public YogaNode(int storageType, YogaConfig config) {
|
@Override
|
||||||
switch (storageType) {
|
protected void finalize() throws Throwable {
|
||||||
case BYTE_BUFFER:
|
try {
|
||||||
mDelegate = new YogaNodePropertiesByteBuffer(this, config);
|
freeNatives();
|
||||||
break;
|
} finally {
|
||||||
case HYBRID:
|
super.finalize();
|
||||||
mDelegate = new YogaNodePropertiesHybrid(this, config);
|
|
||||||
break;
|
|
||||||
case UNSAFE:
|
|
||||||
mDelegate = new YogaNodePropertiesUnsafe(this, config);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mDelegate = new YogaNodePropertiesJNI(this, config);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getNativePointer() {
|
private static native void jni_YGNodeFree(long nativePointer);
|
||||||
return mDelegate.getNativePointer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* frees the native underlying YGNode. Useful for testing. */
|
/* frees the native underlying YGNode. Useful for testing. */
|
||||||
public void freeNatives() {
|
public void freeNatives() {
|
||||||
mDelegate.freeNatives();
|
if (mNativePointer > 0) {
|
||||||
|
long nativePointer = mNativePointer;
|
||||||
|
mNativePointer = 0;
|
||||||
|
jni_YGNodeFree(nativePointer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeReset(long nativePointer);
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
mEdgeSetFlag = 0;
|
||||||
|
mHasSetPosition = false;
|
||||||
|
mHasNewLayout = true;
|
||||||
|
|
||||||
|
mWidth = YogaConstants.UNDEFINED;
|
||||||
|
mHeight = YogaConstants.UNDEFINED;
|
||||||
|
mTop = YogaConstants.UNDEFINED;
|
||||||
|
mLeft = YogaConstants.UNDEFINED;
|
||||||
|
mMarginLeft = 0;
|
||||||
|
mMarginTop = 0;
|
||||||
|
mMarginRight = 0;
|
||||||
|
mMarginBottom = 0;
|
||||||
|
mPaddingLeft = 0;
|
||||||
|
mPaddingTop = 0;
|
||||||
|
mPaddingRight = 0;
|
||||||
|
mPaddingBottom = 0;
|
||||||
|
mBorderLeft = 0;
|
||||||
|
mBorderTop = 0;
|
||||||
|
mBorderRight = 0;
|
||||||
|
mBorderBottom = 0;
|
||||||
|
mLayoutDirection = 0;
|
||||||
|
|
||||||
mMeasureFunction = null;
|
mMeasureFunction = null;
|
||||||
mBaselineFunction = null;
|
mBaselineFunction = null;
|
||||||
mData = null;
|
mData = null;
|
||||||
mDelegate.reset();
|
mDoesLegacyStretchFlagAffectsLayout = false;
|
||||||
|
|
||||||
|
jni_YGNodeReset(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChildCount() {
|
public int getChildCount() {
|
||||||
@ -113,7 +171,7 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
mChildren.add(i, child);
|
mChildren.add(i, child);
|
||||||
child.mOwner = this;
|
child.mOwner = this;
|
||||||
jni_YGNodeInsertChild(getNativePointer(), child.getNativePointer(), i);
|
jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index);
|
private native void jni_YGNodeInsertSharedChild(long nativePointer, long childPointer, int index);
|
||||||
@ -124,24 +182,27 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
mChildren.add(i, child);
|
mChildren.add(i, child);
|
||||||
child.mOwner = null;
|
child.mOwner = null;
|
||||||
jni_YGNodeInsertSharedChild(getNativePointer(), child.getNativePointer(), i);
|
jni_YGNodeInsertSharedChild(mNativePointer, child.mNativePointer, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer);
|
private native void jni_YGNodeSetOwner(long nativePointer, long newOwnerNativePointer);
|
||||||
|
|
||||||
|
private native long jni_YGNodeClone(long nativePointer, Object newNode);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public YogaNode clone() {
|
public YogaNode clone() {
|
||||||
try {
|
try {
|
||||||
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
||||||
|
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode);
|
||||||
|
|
||||||
if (mChildren != null) {
|
if (mChildren != null) {
|
||||||
for (YogaNode child : mChildren) {
|
for (YogaNode child : mChildren) {
|
||||||
child.jni_YGNodeSetOwner(child.getNativePointer(), 0);
|
child.jni_YGNodeSetOwner(child.mNativePointer, 0);
|
||||||
child.mOwner = null;
|
child.mOwner = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clonedYogaNode.mDelegate = mDelegate.clone(clonedYogaNode);
|
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||||
clonedYogaNode.mOwner = null;
|
clonedYogaNode.mOwner = null;
|
||||||
clonedYogaNode.mChildren =
|
clonedYogaNode.mChildren =
|
||||||
mChildren != null ? (List<YogaNode>) ((ArrayList) mChildren).clone() : null;
|
mChildren != null ? (List<YogaNode>) ((ArrayList) mChildren).clone() : null;
|
||||||
@ -160,8 +221,9 @@ public class YogaNode implements Cloneable {
|
|||||||
public YogaNode cloneWithNewChildren() {
|
public YogaNode cloneWithNewChildren() {
|
||||||
try {
|
try {
|
||||||
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
YogaNode clonedYogaNode = (YogaNode) super.clone();
|
||||||
clonedYogaNode.mDelegate = mDelegate.clone(clonedYogaNode);
|
long clonedNativePointer = jni_YGNodeClone(mNativePointer, clonedYogaNode);
|
||||||
clonedYogaNode.mOwner = null;
|
clonedYogaNode.mOwner = null;
|
||||||
|
clonedYogaNode.mNativePointer = clonedNativePointer;
|
||||||
clonedYogaNode.clearChildren();
|
clonedYogaNode.clearChildren();
|
||||||
return clonedYogaNode;
|
return clonedYogaNode;
|
||||||
} catch (CloneNotSupportedException ex) {
|
} catch (CloneNotSupportedException ex) {
|
||||||
@ -174,7 +236,7 @@ public class YogaNode implements Cloneable {
|
|||||||
|
|
||||||
private void clearChildren() {
|
private void clearChildren() {
|
||||||
mChildren = null;
|
mChildren = null;
|
||||||
jni_YGNodeClearChildren(getNativePointer());
|
jni_YGNodeClearChildren(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
||||||
@ -185,7 +247,7 @@ public class YogaNode implements Cloneable {
|
|||||||
}
|
}
|
||||||
final YogaNode child = mChildren.remove(i);
|
final YogaNode child = mChildren.remove(i);
|
||||||
child.mOwner = null;
|
child.mOwner = null;
|
||||||
jni_YGNodeRemoveChild(getNativePointer(), child.getNativePointer());
|
jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,329 +275,455 @@ public class YogaNode implements Cloneable {
|
|||||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||||
|
|
||||||
public void calculateLayout(float width, float height) {
|
public void calculateLayout(float width, float height) {
|
||||||
boolean hasNewLayout = jni_YGNodeCalculateLayout(getNativePointer(), width, height);
|
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||||
mDelegate.onAfterCalculateLayout(hasNewLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNewLayout() {
|
public boolean hasNewLayout() {
|
||||||
return mDelegate.hasNewLayout();
|
return mHasNewLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeMarkDirty(long nativePointer);
|
private native void jni_YGNodeMarkDirty(long nativePointer);
|
||||||
public void dirty() {
|
public void dirty() {
|
||||||
jni_YGNodeMarkDirty(getNativePointer());
|
jni_YGNodeMarkDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
|
private native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
|
||||||
|
|
||||||
public void dirtyAllDescendants() {
|
public void dirtyAllDescendants() {
|
||||||
jni_YGNodeMarkDirtyAndPropogateToDescendants(getNativePointer());
|
jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return mDelegate.isDirty();
|
return jni_YGNodeIsDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||||
public void copyStyle(YogaNode srcNode) {
|
public void copyStyle(YogaNode srcNode) {
|
||||||
jni_YGNodeCopyStyle(getNativePointer(), srcNode.getNativePointer());
|
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markLayoutSeen() {
|
public void markLayoutSeen() {
|
||||||
mDelegate.markLayoutSeen();
|
mHasNewLayout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||||
public YogaDirection getStyleDirection() {
|
public YogaDirection getStyleDirection() {
|
||||||
return mDelegate.getStyleDirection();
|
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
||||||
public void setDirection(YogaDirection direction) {
|
public void setDirection(YogaDirection direction) {
|
||||||
mDelegate.setDirection(direction);
|
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
||||||
public YogaFlexDirection getFlexDirection() {
|
public YogaFlexDirection getFlexDirection() {
|
||||||
return mDelegate.getFlexDirection();
|
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||||
mDelegate.setFlexDirection(flexDirection);
|
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
||||||
public YogaJustify getJustifyContent() {
|
public YogaJustify getJustifyContent() {
|
||||||
return mDelegate.getJustifyContent();
|
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
public void setJustifyContent(YogaJustify justifyContent) {
|
||||||
mDelegate.setJustifyContent(justifyContent);
|
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
||||||
public YogaAlign getAlignItems() {
|
public YogaAlign getAlignItems() {
|
||||||
return mDelegate.getAlignItems();
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
public void setAlignItems(YogaAlign alignItems) {
|
||||||
mDelegate.setAlignItems(alignItems);
|
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
||||||
public YogaAlign getAlignSelf() {
|
public YogaAlign getAlignSelf() {
|
||||||
return mDelegate.getAlignSelf();
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
public void setAlignSelf(YogaAlign alignSelf) {
|
||||||
mDelegate.setAlignSelf(alignSelf);
|
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
||||||
public YogaAlign getAlignContent() {
|
public YogaAlign getAlignContent() {
|
||||||
return mDelegate.getAlignContent();
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
public void setAlignContent(YogaAlign alignContent) {
|
||||||
mDelegate.setAlignContent(alignContent);
|
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
||||||
public YogaPositionType getPositionType() {
|
public YogaPositionType getPositionType() {
|
||||||
return mDelegate.getPositionType();
|
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
public void setPositionType(YogaPositionType positionType) {
|
||||||
mDelegate.setPositionType(positionType);
|
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
public void setWrap(YogaWrap flexWrap) {
|
||||||
mDelegate.setWrap(flexWrap);
|
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
||||||
public YogaOverflow getOverflow() {
|
public YogaOverflow getOverflow() {
|
||||||
return mDelegate.getOverflow();
|
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
public void setOverflow(YogaOverflow overflow) {
|
||||||
mDelegate.setOverflow(overflow);
|
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
||||||
public YogaDisplay getDisplay() {
|
public YogaDisplay getDisplay() {
|
||||||
return mDelegate.getDisplay();
|
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
||||||
public void setDisplay(YogaDisplay display) {
|
public void setDisplay(YogaDisplay display) {
|
||||||
mDelegate.setDisplay(display);
|
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
||||||
public void setFlex(float flex) {
|
public void setFlex(float flex) {
|
||||||
mDelegate.setFlex(flex);
|
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
||||||
public float getFlexGrow() {
|
public float getFlexGrow() {
|
||||||
return mDelegate.getFlexGrow();
|
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||||
public void setFlexGrow(float flexGrow) {
|
public void setFlexGrow(float flexGrow) {
|
||||||
mDelegate.setFlexGrow(flexGrow);
|
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
||||||
public float getFlexShrink() {
|
public float getFlexShrink() {
|
||||||
return mDelegate.getFlexShrink();
|
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||||
public void setFlexShrink(float flexShrink) {
|
public void setFlexShrink(float flexShrink) {
|
||||||
mDelegate.setFlexShrink(flexShrink);
|
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||||
public YogaValue getFlexBasis() {
|
public YogaValue getFlexBasis() {
|
||||||
return mDelegate.getFlexBasis();
|
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||||
public void setFlexBasis(float flexBasis) {
|
public void setFlexBasis(float flexBasis) {
|
||||||
mDelegate.setFlexBasis(flexBasis);
|
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
||||||
public void setFlexBasisPercent(float percent) {
|
public void setFlexBasisPercent(float percent) {
|
||||||
mDelegate.setFlexBasisPercent(percent);
|
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
||||||
public void setFlexBasisAuto() {
|
public void setFlexBasisAuto() {
|
||||||
mDelegate.setFlexBasisAuto();
|
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
public YogaValue getMargin(YogaEdge edge) {
|
||||||
return mDelegate.getMargin(edge);
|
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
||||||
|
return YogaValue.UNDEFINED;
|
||||||
|
}
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
public void setMargin(YogaEdge edge, float margin) {
|
||||||
mDelegate.setMargin(edge, margin);
|
mEdgeSetFlag |= MARGIN;
|
||||||
|
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
public void setMarginPercent(YogaEdge edge, float percent) {
|
||||||
mDelegate.setMarginPercent(edge, percent);
|
mEdgeSetFlag |= MARGIN;
|
||||||
|
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
public void setMarginAuto(YogaEdge edge) {
|
||||||
mDelegate.setMarginAuto(edge);
|
mEdgeSetFlag |= MARGIN;
|
||||||
|
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
||||||
public YogaValue getPadding(YogaEdge edge) {
|
public YogaValue getPadding(YogaEdge edge) {
|
||||||
return mDelegate.getPadding(edge);
|
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
||||||
|
return YogaValue.UNDEFINED;
|
||||||
|
}
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
public void setPadding(YogaEdge edge, float padding) {
|
||||||
mDelegate.setPadding(edge, padding);
|
mEdgeSetFlag |= PADDING;
|
||||||
|
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
public void setPaddingPercent(YogaEdge edge, float percent) {
|
||||||
mDelegate.setPaddingPercent(edge, percent);
|
mEdgeSetFlag |= PADDING;
|
||||||
|
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
||||||
public float getBorder(YogaEdge edge) {
|
public float getBorder(YogaEdge edge) {
|
||||||
return mDelegate.getBorder(edge);
|
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
||||||
|
return YogaConstants.UNDEFINED;
|
||||||
|
}
|
||||||
|
return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
public void setBorder(YogaEdge edge, float border) {
|
||||||
mDelegate.setBorder(edge, border);
|
mEdgeSetFlag |= BORDER;
|
||||||
|
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||||
public YogaValue getPosition(YogaEdge edge) {
|
public YogaValue getPosition(YogaEdge edge) {
|
||||||
return mDelegate.getPosition(edge);
|
if (!mHasSetPosition) {
|
||||||
|
return YogaValue.UNDEFINED;
|
||||||
|
}
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
public void setPosition(YogaEdge edge, float position) {
|
||||||
mDelegate.setPosition(edge, position);
|
mHasSetPosition = true;
|
||||||
|
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
public void setPositionPercent(YogaEdge edge, float percent) {
|
||||||
mDelegate.setPositionPercent(edge, percent);
|
mHasSetPosition = true;
|
||||||
|
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
||||||
public YogaValue getWidth() {
|
public YogaValue getWidth() {
|
||||||
return mDelegate.getWidth();
|
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
||||||
public void setWidth(float width) {
|
public void setWidth(float width) {
|
||||||
mDelegate.setWidth(width);
|
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
||||||
public void setWidthPercent(float percent) {
|
public void setWidthPercent(float percent) {
|
||||||
mDelegate.setWidthPercent(percent);
|
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
||||||
public void setWidthAuto() {
|
public void setWidthAuto() {
|
||||||
mDelegate.setWidthAuto();
|
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
||||||
public YogaValue getHeight() {
|
public YogaValue getHeight() {
|
||||||
return mDelegate.getHeight();
|
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
||||||
public void setHeight(float height) {
|
public void setHeight(float height) {
|
||||||
mDelegate.setHeight(height);
|
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
||||||
public void setHeightPercent(float percent) {
|
public void setHeightPercent(float percent) {
|
||||||
mDelegate.setHeightPercent(percent);
|
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
||||||
public void setHeightAuto() {
|
public void setHeightAuto() {
|
||||||
mDelegate.setHeightAuto();
|
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
||||||
public YogaValue getMinWidth() {
|
public YogaValue getMinWidth() {
|
||||||
return mDelegate.getMinWidth();
|
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||||
public void setMinWidth(float minWidth) {
|
public void setMinWidth(float minWidth) {
|
||||||
mDelegate.setMinWidth(minWidth);
|
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
||||||
public void setMinWidthPercent(float percent) {
|
public void setMinWidthPercent(float percent) {
|
||||||
mDelegate.setMinWidthPercent(percent);
|
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||||
public YogaValue getMinHeight() {
|
public YogaValue getMinHeight() {
|
||||||
return mDelegate.getMinHeight();
|
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||||
public void setMinHeight(float minHeight) {
|
public void setMinHeight(float minHeight) {
|
||||||
mDelegate.setMinHeight(minHeight);
|
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
||||||
public void setMinHeightPercent(float percent) {
|
public void setMinHeightPercent(float percent) {
|
||||||
mDelegate.setMinHeightPercent(percent);
|
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||||
public YogaValue getMaxWidth() {
|
public YogaValue getMaxWidth() {
|
||||||
return mDelegate.getMaxWidth();
|
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||||
public void setMaxWidth(float maxWidth) {
|
public void setMaxWidth(float maxWidth) {
|
||||||
mDelegate.setMaxWidth(maxWidth);
|
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
||||||
public void setMaxWidthPercent(float percent) {
|
public void setMaxWidthPercent(float percent) {
|
||||||
mDelegate.setMaxWidthPercent(percent);
|
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||||
public YogaValue getMaxHeight() {
|
public YogaValue getMaxHeight() {
|
||||||
return mDelegate.getMaxHeight();
|
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||||
public void setMaxHeight(float maxheight) {
|
public void setMaxHeight(float maxheight) {
|
||||||
mDelegate.setMaxHeight(maxheight);
|
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
||||||
public void setMaxHeightPercent(float percent) {
|
public void setMaxHeightPercent(float percent) {
|
||||||
mDelegate.setMaxHeightPercent(percent);
|
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
||||||
public float getAspectRatio() {
|
public float getAspectRatio() {
|
||||||
return mDelegate.getAspectRatio();
|
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
||||||
public void setAspectRatio(float aspectRatio) {
|
public void setAspectRatio(float aspectRatio) {
|
||||||
mDelegate.setAspectRatio(aspectRatio);
|
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutX() {
|
public float getLayoutX() {
|
||||||
return mDelegate.getLayoutX();
|
return mLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutY() {
|
public float getLayoutY() {
|
||||||
return mDelegate.getLayoutY();
|
return mTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutWidth() {
|
public float getLayoutWidth() {
|
||||||
return mDelegate.getLayoutWidth();
|
return mWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutHeight() {
|
public float getLayoutHeight() {
|
||||||
return mDelegate.getLayoutHeight();
|
return mHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
||||||
return mDelegate.getDoesLegacyStretchFlagAffectsLayout();
|
return mDoesLegacyStretchFlagAffectsLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutMargin(YogaEdge edge) {
|
public float getLayoutMargin(YogaEdge edge) {
|
||||||
return mDelegate.getLayoutMargin(edge);
|
switch (edge) {
|
||||||
|
case LEFT:
|
||||||
|
return mMarginLeft;
|
||||||
|
case TOP:
|
||||||
|
return mMarginTop;
|
||||||
|
case RIGHT:
|
||||||
|
return mMarginRight;
|
||||||
|
case BOTTOM:
|
||||||
|
return mMarginBottom;
|
||||||
|
case START:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mMarginRight : mMarginLeft;
|
||||||
|
case END:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mMarginLeft : mMarginRight;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutPadding(YogaEdge edge) {
|
public float getLayoutPadding(YogaEdge edge) {
|
||||||
return mDelegate.getLayoutPadding(edge);
|
switch (edge) {
|
||||||
|
case LEFT:
|
||||||
|
return mPaddingLeft;
|
||||||
|
case TOP:
|
||||||
|
return mPaddingTop;
|
||||||
|
case RIGHT:
|
||||||
|
return mPaddingRight;
|
||||||
|
case BOTTOM:
|
||||||
|
return mPaddingBottom;
|
||||||
|
case START:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mPaddingRight : mPaddingLeft;
|
||||||
|
case END:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mPaddingLeft : mPaddingRight;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLayoutBorder(YogaEdge edge) {
|
public float getLayoutBorder(YogaEdge edge) {
|
||||||
return mDelegate.getLayoutBorder(edge);
|
switch (edge) {
|
||||||
|
case LEFT:
|
||||||
|
return mBorderLeft;
|
||||||
|
case TOP:
|
||||||
|
return mBorderTop;
|
||||||
|
case RIGHT:
|
||||||
|
return mBorderRight;
|
||||||
|
case BOTTOM:
|
||||||
|
return mBorderBottom;
|
||||||
|
case START:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mBorderRight : mBorderLeft;
|
||||||
|
case END:
|
||||||
|
return getLayoutDirection() == YogaDirection.RTL ? mBorderLeft : mBorderRight;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public YogaDirection getLayoutDirection() {
|
public YogaDirection getLayoutDirection() {
|
||||||
return mDelegate.getLayoutDirection();
|
return YogaDirection.fromInt(mLayoutDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||||
mMeasureFunction = measureFunction;
|
mMeasureFunction = measureFunction;
|
||||||
jni_YGNodeSetHasMeasureFunc(getNativePointer(), measureFunction != null);
|
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation Note: Why this method needs to stay final
|
// Implementation Note: Why this method needs to stay final
|
||||||
@ -560,7 +748,7 @@ public class YogaNode implements Cloneable {
|
|||||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||||
mBaselineFunction = baselineFunction;
|
mBaselineFunction = baselineFunction;
|
||||||
jni_YGNodeSetHasBaselineFunc(getNativePointer(), baselineFunction != null);
|
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
@ -587,7 +775,7 @@ public class YogaNode implements Cloneable {
|
|||||||
* layout of the tree rooted at this node.
|
* layout of the tree rooted at this node.
|
||||||
*/
|
*/
|
||||||
public void print() {
|
public void print() {
|
||||||
jni_YGNodePrint(getNativePointer());
|
jni_YGNodePrint(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -605,6 +793,6 @@ public class YogaNode implements Cloneable {
|
|||||||
mChildren.remove(childIndex);
|
mChildren.remove(childIndex);
|
||||||
mChildren.add(childIndex, newNode);
|
mChildren.add(childIndex, newNode);
|
||||||
newNode.mOwner = this;
|
newNode.mOwner = this;
|
||||||
return newNode.getNativePointer();
|
return newNode.mNativePointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
/* package */ final class YogaNodeMemoryLayout {
|
|
||||||
|
|
||||||
private static final int FLOAT_SIZE = 4;
|
|
||||||
private static final int INT_SIZE = 4;
|
|
||||||
private static final int VALUE_SIZE = FLOAT_SIZE + INT_SIZE;
|
|
||||||
private static final byte FALSE = 0;
|
|
||||||
private static final byte TRUE = 1;
|
|
||||||
private static final int AUTO = YogaUnit.AUTO.intValue();
|
|
||||||
private static final int POINT = YogaUnit.POINT.intValue();
|
|
||||||
private static final int PERCENT = YogaUnit.PERCENT.intValue();
|
|
||||||
private static final int UNDEFINED = YogaUnit.UNDEFINED.intValue();
|
|
||||||
|
|
||||||
// TODO(davidaurelio) code-gen these values
|
|
||||||
static final int styleDirection = 0;
|
|
||||||
static final int styleFlexDirection = 4;
|
|
||||||
static final int styleJustifyContent = 8;
|
|
||||||
static final int styleAlignContent = 12;
|
|
||||||
static final int styleAlignItems = 16;
|
|
||||||
static final int styleAlignSelf = 20;
|
|
||||||
static final int stylePositionType = 24;
|
|
||||||
static final int styleFlexWrap = 28;
|
|
||||||
static final int styleOverflow = 32;
|
|
||||||
static final int styleDisplay = 36;
|
|
||||||
static final int styleFlex = 40;
|
|
||||||
static final int styleFlexGrow = 48;
|
|
||||||
static final int styleFlexShrink = 56;
|
|
||||||
static final int styleFlexBasis = 64;
|
|
||||||
static final int styleMargin = 72;
|
|
||||||
static final int stylePosition = 144;
|
|
||||||
static final int stylePadding = 216;
|
|
||||||
static final int styleBorder = 288;
|
|
||||||
static final int styleDimensions = 360;
|
|
||||||
static final int styleMinDimensions = 376;
|
|
||||||
static final int styleMaxDimensions = 392;
|
|
||||||
static final int styleAspectRatio = 408;
|
|
||||||
|
|
||||||
static final int styleWidth = styleDimensions;
|
|
||||||
static final int styleHeight = styleDimensions + VALUE_SIZE;
|
|
||||||
static final int styleMinWidth = styleMinDimensions;
|
|
||||||
static final int styleMinHeight = styleMinDimensions + VALUE_SIZE;
|
|
||||||
static final int styleMaxWidth = styleMaxDimensions;
|
|
||||||
static final int styleMaxHeight = styleMaxDimensions + VALUE_SIZE;
|
|
||||||
|
|
||||||
static final int layoutPosition = 0;
|
|
||||||
static final int layoutDimensions = 16;
|
|
||||||
static final int layoutMargin = 24;
|
|
||||||
static final int layoutBorder = 48;
|
|
||||||
static final int layoutPadding = 72;
|
|
||||||
static final int layoutDirection = 96;
|
|
||||||
static final int layoutComputedFlexBasisGeneration = 100;
|
|
||||||
static final int layoutComputedFlexBasis = 104;
|
|
||||||
static final int layoutHadOverflow = 112;
|
|
||||||
static final int layoutGenerationCount = 116;
|
|
||||||
static final int layoutLastOwnerDirection = 120;
|
|
||||||
static final int layoutNextCachedMeasurementsIndex = 124;
|
|
||||||
static final int layoutCachedMeasurements = 128;
|
|
||||||
static final int layoutMeasuredDimensions = 512;
|
|
||||||
static final int layoutCachedLayout = 520;
|
|
||||||
static final int layoutDidUseLegacyFlag = 544;
|
|
||||||
static final int layoutDoesLegacyStretchFlagAffectsLayout = 545;
|
|
||||||
|
|
||||||
static final int layoutX = layoutPosition;
|
|
||||||
static final int layoutY = layoutPosition + FLOAT_SIZE;
|
|
||||||
static final int layoutWidth = layoutDimensions;
|
|
||||||
static final int layoutHeight = layoutDimensions + FLOAT_SIZE;
|
|
||||||
|
|
||||||
static int stylePositionOffset(YogaEdge edge) {
|
|
||||||
return stylePosition + edge.intValue() * VALUE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int styleMarginOffset(YogaEdge edge) {
|
|
||||||
return styleMargin + edge.intValue() * VALUE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int layoutMarginOffset(YogaEdge edge) {
|
|
||||||
return layoutMargin + edge.intValue() * FLOAT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int stylePaddingOffset(YogaEdge edge) {
|
|
||||||
return stylePadding + edge.intValue() * VALUE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int layoutPaddingOffset(YogaEdge edge) {
|
|
||||||
return layoutPadding + edge.intValue() * FLOAT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int styleBorderOffset(YogaEdge edge) {
|
|
||||||
return styleBorder + edge.intValue() * VALUE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int layoutBorderOffset(YogaEdge edge) {
|
|
||||||
return layoutBorder + edge.intValue() * FLOAT_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void putOptional(ByteBuffer buffer, int offset, float value) {
|
|
||||||
buffer.putFloat(offset, value);
|
|
||||||
buffer.put(
|
|
||||||
offset + FLOAT_SIZE, YogaConstants.isUndefined(value) ? TRUE : FALSE); // bool isUndefined_
|
|
||||||
}
|
|
||||||
|
|
||||||
static float getOptional(ByteBuffer buffer, int offset) {
|
|
||||||
return getBoolean(buffer, offset + FLOAT_SIZE)
|
|
||||||
? YogaConstants.UNDEFINED
|
|
||||||
: buffer.getFloat(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void putValue(ByteBuffer buffer, int offset, float value, int unit) {
|
|
||||||
if (YogaConstants.isUndefined(value)) {
|
|
||||||
value = YogaConstants.UNDEFINED;
|
|
||||||
unit = UNDEFINED;
|
|
||||||
}
|
|
||||||
buffer.putFloat(offset, value);
|
|
||||||
buffer.putInt(offset + FLOAT_SIZE, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void putAutoValue(ByteBuffer buffer, int offset) {
|
|
||||||
putValue(buffer, offset, 0, AUTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void putPointValue(ByteBuffer buffer, int offset, float value) {
|
|
||||||
putValue(buffer, offset, value, POINT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void putPercentValue(ByteBuffer buffer, int offset, float value) {
|
|
||||||
putValue(buffer, offset, value, PERCENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static YogaValue getValue(ByteBuffer buffer, int offset) {
|
|
||||||
float value = buffer.getFloat(offset);
|
|
||||||
int unit = buffer.getInt(offset + FLOAT_SIZE);
|
|
||||||
return new YogaValue(value, YogaUnit.fromInt(unit));
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean getBoolean(ByteBuffer buffer, int offset) {
|
|
||||||
return buffer.get(offset) != 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,169 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
public interface YogaNodeProperties {
|
|
||||||
|
|
||||||
YogaNodeProperties clone(YogaNode node);
|
|
||||||
|
|
||||||
long getNativePointer();
|
|
||||||
|
|
||||||
void onAfterCalculateLayout(boolean hasNewLayout);
|
|
||||||
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
boolean hasNewLayout();
|
|
||||||
|
|
||||||
boolean isDirty();
|
|
||||||
|
|
||||||
void markLayoutSeen();
|
|
||||||
|
|
||||||
YogaDirection getStyleDirection();
|
|
||||||
|
|
||||||
void setDirection(YogaDirection direction);
|
|
||||||
|
|
||||||
YogaFlexDirection getFlexDirection();
|
|
||||||
|
|
||||||
void setFlexDirection(YogaFlexDirection flexDirection);
|
|
||||||
|
|
||||||
YogaJustify getJustifyContent();
|
|
||||||
|
|
||||||
void setJustifyContent(YogaJustify justifyContent);
|
|
||||||
|
|
||||||
YogaAlign getAlignItems();
|
|
||||||
|
|
||||||
void setAlignItems(YogaAlign alignItems);
|
|
||||||
|
|
||||||
YogaAlign getAlignSelf();
|
|
||||||
|
|
||||||
void setAlignSelf(YogaAlign alignSelf);
|
|
||||||
|
|
||||||
YogaAlign getAlignContent();
|
|
||||||
|
|
||||||
void setAlignContent(YogaAlign alignContent);
|
|
||||||
|
|
||||||
YogaPositionType getPositionType();
|
|
||||||
|
|
||||||
void setPositionType(YogaPositionType positionType);
|
|
||||||
|
|
||||||
void setWrap(YogaWrap flexWrap);
|
|
||||||
|
|
||||||
YogaOverflow getOverflow();
|
|
||||||
|
|
||||||
void setOverflow(YogaOverflow overflow);
|
|
||||||
|
|
||||||
YogaDisplay getDisplay();
|
|
||||||
|
|
||||||
void setDisplay(YogaDisplay display);
|
|
||||||
|
|
||||||
void setFlex(float flex);
|
|
||||||
|
|
||||||
float getFlexGrow();
|
|
||||||
|
|
||||||
void setFlexGrow(float flexGrow);
|
|
||||||
|
|
||||||
float getFlexShrink();
|
|
||||||
|
|
||||||
void setFlexShrink(float flexShrink);
|
|
||||||
|
|
||||||
YogaValue getFlexBasis();
|
|
||||||
|
|
||||||
void setFlexBasis(float flexBasis);
|
|
||||||
|
|
||||||
void setFlexBasisPercent(float percent);
|
|
||||||
|
|
||||||
void setFlexBasisAuto();
|
|
||||||
|
|
||||||
YogaValue getMargin(YogaEdge edge);
|
|
||||||
|
|
||||||
void setMargin(YogaEdge edge, float margin);
|
|
||||||
|
|
||||||
void setMarginPercent(YogaEdge edge, float percent);
|
|
||||||
|
|
||||||
void setMarginAuto(YogaEdge edge);
|
|
||||||
|
|
||||||
YogaValue getPadding(YogaEdge edge);
|
|
||||||
|
|
||||||
void setPadding(YogaEdge edge, float padding);
|
|
||||||
|
|
||||||
void setPaddingPercent(YogaEdge edge, float percent);
|
|
||||||
|
|
||||||
float getBorder(YogaEdge edge);
|
|
||||||
|
|
||||||
void setBorder(YogaEdge edge, float border);
|
|
||||||
|
|
||||||
YogaValue getPosition(YogaEdge edge);
|
|
||||||
|
|
||||||
void setPosition(YogaEdge edge, float position);
|
|
||||||
|
|
||||||
void setPositionPercent(YogaEdge edge, float percent);
|
|
||||||
|
|
||||||
YogaValue getWidth();
|
|
||||||
|
|
||||||
void setWidth(float width);
|
|
||||||
|
|
||||||
void setWidthPercent(float percent);
|
|
||||||
|
|
||||||
void setWidthAuto();
|
|
||||||
|
|
||||||
YogaValue getHeight();
|
|
||||||
|
|
||||||
void setHeight(float height);
|
|
||||||
|
|
||||||
void setHeightPercent(float percent);
|
|
||||||
|
|
||||||
void setHeightAuto();
|
|
||||||
|
|
||||||
YogaValue getMinWidth();
|
|
||||||
|
|
||||||
void setMinWidth(float minWidth);
|
|
||||||
|
|
||||||
void setMinWidthPercent(float percent);
|
|
||||||
|
|
||||||
YogaValue getMinHeight();
|
|
||||||
|
|
||||||
void setMinHeight(float minHeight);
|
|
||||||
|
|
||||||
void setMinHeightPercent(float percent);
|
|
||||||
|
|
||||||
YogaValue getMaxWidth();
|
|
||||||
|
|
||||||
void setMaxWidth(float maxWidth);
|
|
||||||
|
|
||||||
void setMaxWidthPercent(float percent);
|
|
||||||
|
|
||||||
YogaValue getMaxHeight();
|
|
||||||
|
|
||||||
void setMaxHeight(float maxheight);
|
|
||||||
|
|
||||||
void setMaxHeightPercent(float percent);
|
|
||||||
|
|
||||||
float getAspectRatio();
|
|
||||||
|
|
||||||
void setAspectRatio(float aspectRatio);
|
|
||||||
|
|
||||||
float getLayoutX();
|
|
||||||
|
|
||||||
float getLayoutY();
|
|
||||||
|
|
||||||
float getLayoutWidth();
|
|
||||||
|
|
||||||
float getLayoutHeight();
|
|
||||||
|
|
||||||
boolean getDoesLegacyStretchFlagAffectsLayout();
|
|
||||||
|
|
||||||
float getLayoutMargin(YogaEdge edge);
|
|
||||||
|
|
||||||
float getLayoutPadding(YogaEdge edge);
|
|
||||||
|
|
||||||
float getLayoutBorder(YogaEdge edge);
|
|
||||||
|
|
||||||
YogaDirection getLayoutDirection();
|
|
||||||
|
|
||||||
void freeNatives();
|
|
||||||
}
|
|
@ -1,515 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
|
||||||
import com.facebook.soloader.SoLoader;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
public class YogaNodePropertiesByteBuffer implements YogaNodeProperties, Cloneable {
|
|
||||||
|
|
||||||
static {
|
|
||||||
SoLoader.loadLibrary("yoga");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int RTL = YogaDirection.RTL.intValue();
|
|
||||||
private final ByteBuffer mStyleBuffer;
|
|
||||||
private final ByteBuffer mLayoutBuffer;
|
|
||||||
private final long mNativePointer;
|
|
||||||
private boolean mHasBorderSet = false;
|
|
||||||
private boolean mHasNewLayout = true;
|
|
||||||
private boolean isFreed = false;
|
|
||||||
|
|
||||||
private static native ByteBuffer jni_getStyleBuffer(long nativePointer);
|
|
||||||
|
|
||||||
private static native ByteBuffer jni_getLayoutBuffer(long nativePointer);
|
|
||||||
|
|
||||||
private static native long jni_YGNodeNewNoProps(YogaNode node);
|
|
||||||
|
|
||||||
public YogaNodePropertiesByteBuffer(YogaNode node) {
|
|
||||||
this(jni_YGNodeNewNoProps(node));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native long jni_YGNodeNewNoPropsWithConfig(YogaNode node, long configPointer);
|
|
||||||
|
|
||||||
public YogaNodePropertiesByteBuffer(YogaNode node, YogaConfig config) {
|
|
||||||
this(jni_YGNodeNewNoPropsWithConfig(node, config.mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaNodePropertiesByteBuffer(long nativePointer) {
|
|
||||||
mNativePointer = nativePointer;
|
|
||||||
mStyleBuffer = jni_getStyleBuffer(nativePointer).order(ByteOrder.LITTLE_ENDIAN);
|
|
||||||
mLayoutBuffer = jni_getLayoutBuffer(nativePointer).order(ByteOrder.LITTLE_ENDIAN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void finalize() throws Throwable {
|
|
||||||
try {
|
|
||||||
freeNatives();
|
|
||||||
} finally {
|
|
||||||
super.finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native long jni_YGNodeCloneNoProps(long nativePointer, YogaNode newNode);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaNodeProperties clone(YogaNode node) {
|
|
||||||
long clonedNativePointer = jni_YGNodeCloneNoProps(getNativePointer(), node);
|
|
||||||
YogaNodePropertiesByteBuffer clone = new YogaNodePropertiesByteBuffer(clonedNativePointer);
|
|
||||||
clone.mHasBorderSet = mHasBorderSet;
|
|
||||||
clone.mHasNewLayout = mHasNewLayout;
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNativePointer() {
|
|
||||||
return mNativePointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAfterCalculateLayout(boolean hasNewLayout) {
|
|
||||||
mHasNewLayout = hasNewLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGNodeReset(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
mHasBorderSet = false;
|
|
||||||
mHasNewLayout = true;
|
|
||||||
jni_YGNodeReset(getNativePointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNewLayout() {
|
|
||||||
return mHasNewLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native boolean jni_YGNodeIsDirty(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDirty() {
|
|
||||||
return jni_YGNodeIsDirty(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markLayoutSeen() {
|
|
||||||
mHasNewLayout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getStyleDirection() {
|
|
||||||
return YogaDirection.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleDirection));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPosition(YogaEdge edge) {
|
|
||||||
return YogaNodeMemoryLayout.getValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePositionOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
|
||||||
return YogaNodeMemoryLayout.getValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPadding(YogaEdge edge) {
|
|
||||||
return YogaNodeMemoryLayout.getValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePaddingOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getBorder(YogaEdge edge) {
|
|
||||||
return mHasBorderSet
|
|
||||||
? mStyleBuffer.getFloat(YogaNodeMemoryLayout.styleBorderOffset(edge))
|
|
||||||
: YogaConstants.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDirection(YogaDirection direction) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleDirection, direction.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaFlexDirection getFlexDirection() {
|
|
||||||
return YogaFlexDirection.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleFlexDirection));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleFlexDirection, flexDirection.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaJustify getJustifyContent() {
|
|
||||||
return YogaJustify.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleJustifyContent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleJustifyContent, justifyContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignItems() {
|
|
||||||
return YogaAlign.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleAlignItems));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignItems, alignItems.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignSelf() {
|
|
||||||
return YogaAlign.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleAlignSelf));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignSelf, alignSelf.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignContent() {
|
|
||||||
return YogaAlign.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleAlignContent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignContent, alignContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaPositionType getPositionType() {
|
|
||||||
return YogaPositionType.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.stylePositionType));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.stylePositionType, positionType.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleFlexWrap, flexWrap.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaOverflow getOverflow() {
|
|
||||||
return YogaOverflow.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleOverflow));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleOverflow, overflow.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDisplay getDisplay() {
|
|
||||||
return YogaDisplay.fromInt(mStyleBuffer.getInt(YogaNodeMemoryLayout.styleDisplay));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(YogaDisplay display) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleDisplay, display.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(mStyleBuffer, YogaNodeMemoryLayout.styleFlex, flex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexGrow() {
|
|
||||||
return mStyleBuffer.getFloat(YogaNodeMemoryLayout.styleFlexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(mStyleBuffer, YogaNodeMemoryLayout.styleFlexGrow, flexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexShrink() {
|
|
||||||
return mStyleBuffer.getFloat(YogaNodeMemoryLayout.styleFlexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexShrink, flexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getFlexBasis() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis, flexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge), margin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePaddingOffset(edge), padding);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePaddingOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
|
||||||
mHasBorderSet = true;
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleBorderOffset(edge), border);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePositionOffset(edge), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePositionOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getWidth() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getHeight() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinWidth() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinWidth, minWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinHeight() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMinHeight, minHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMinHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxWidth() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxWidth, maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxHeight() {
|
|
||||||
return YogaNodeMemoryLayout.getValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxHeight) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMaxHeight, maxHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMaxHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getAspectRatio() {
|
|
||||||
return YogaNodeMemoryLayout.getOptional(mStyleBuffer, YogaNodeMemoryLayout.styleAspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAspectRatio(float aspectRatio) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleAspectRatio, aspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutX() {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutX);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutY() {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutWidth() {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutHeight() {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
|
||||||
return YogaNodeMemoryLayout.getBoolean(
|
|
||||||
mLayoutBuffer, YogaNodeMemoryLayout.layoutDoesLegacyStretchFlagAffectsLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutMargin(YogaEdge edge) {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutMarginOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutPadding(YogaEdge edge) {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutPaddingOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutBorder(YogaEdge edge) {
|
|
||||||
return mLayoutBuffer.getFloat(YogaNodeMemoryLayout.layoutBorderOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getLayoutDirection() {
|
|
||||||
return YogaDirection.fromInt(getLayoutDirectionInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGNodeFree(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void freeNatives() {
|
|
||||||
if (!isFreed) {
|
|
||||||
isFreed = true;
|
|
||||||
jni_YGNodeFree(mNativePointer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getLayoutDirectionInt() {
|
|
||||||
return mLayoutBuffer.getInt(YogaNodeMemoryLayout.layoutDirection);
|
|
||||||
}
|
|
||||||
|
|
||||||
private YogaEdge layoutEdge(YogaEdge edge) {
|
|
||||||
int layoutDirection = getLayoutDirectionInt();
|
|
||||||
switch (edge) {
|
|
||||||
case LEFT:
|
|
||||||
return layoutDirection == RTL ? YogaEdge.END : YogaEdge.START;
|
|
||||||
case RIGHT:
|
|
||||||
return layoutDirection == RTL ? YogaEdge.START : YogaEdge.END;
|
|
||||||
case TOP:
|
|
||||||
case BOTTOM:
|
|
||||||
case START:
|
|
||||||
case END:
|
|
||||||
return edge;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Cannot get layout properties of multi-edge shorthands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,261 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
|
||||||
import com.facebook.soloader.SoLoader;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ByteOrder;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
public class YogaNodePropertiesHybrid extends YogaNodePropertiesJNI {
|
|
||||||
|
|
||||||
static {
|
|
||||||
SoLoader.loadLibrary("yoga");
|
|
||||||
}
|
|
||||||
|
|
||||||
private ByteBuffer mStyleBuffer;
|
|
||||||
|
|
||||||
private static native ByteBuffer jni_getStyleBuffer(long nativePointer);
|
|
||||||
|
|
||||||
public YogaNodePropertiesHybrid(YogaNode node) {
|
|
||||||
super(node);
|
|
||||||
mStyleBuffer = jni_getStyleBuffer(getNativePointer()).order(ByteOrder.LITTLE_ENDIAN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaNodePropertiesHybrid(YogaNode node, YogaConfig config) {
|
|
||||||
super(node, config);
|
|
||||||
mStyleBuffer = jni_getStyleBuffer(getNativePointer()).order(ByteOrder.LITTLE_ENDIAN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDirection(YogaDirection direction) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleDirection, direction.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleFlexDirection, flexDirection.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleJustifyContent, justifyContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignItems, alignItems.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignSelf, alignSelf.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleAlignContent, alignContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.stylePositionType, positionType.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleFlexWrap, flexWrap.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleOverflow, overflow.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(YogaDisplay display) {
|
|
||||||
mStyleBuffer.putInt(YogaNodeMemoryLayout.styleDisplay, display.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(mStyleBuffer, YogaNodeMemoryLayout.styleFlex, flex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(mStyleBuffer, YogaNodeMemoryLayout.styleFlexGrow, flexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexShrink, flexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis, flexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleFlexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge), margin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleMarginOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
|
||||||
mEdgeSetFlag |= PADDING;
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePaddingOffset(edge), padding);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
|
||||||
mEdgeSetFlag |= PADDING;
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePaddingOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
|
||||||
mEdgeSetFlag |= BORDER;
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleBorderOffset(edge), border);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
|
||||||
mHasSetPosition = true;
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePositionOffset(edge), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
|
||||||
mHasSetPosition = true;
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.stylePositionOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightAuto() {
|
|
||||||
YogaNodeMemoryLayout.putAutoValue(mStyleBuffer, YogaNodeMemoryLayout.styleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinWidth, minWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleMinWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMinHeight, minHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMinHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxWidth, maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidthPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(mStyleBuffer, YogaNodeMemoryLayout.styleMaxWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxHeight) {
|
|
||||||
YogaNodeMemoryLayout.putPointValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMaxHeight, maxHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeightPercent(float percent) {
|
|
||||||
YogaNodeMemoryLayout.putPercentValue(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleMaxHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAspectRatio(float aspectRatio) {
|
|
||||||
YogaNodeMemoryLayout.putOptional(
|
|
||||||
mStyleBuffer, YogaNodeMemoryLayout.styleAspectRatio, aspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaNodeProperties clone(YogaNode node) {
|
|
||||||
YogaNodePropertiesHybrid clone = (YogaNodePropertiesHybrid) super.clone(node);
|
|
||||||
clone.mStyleBuffer =
|
|
||||||
jni_getStyleBuffer(clone.getNativePointer()).order(ByteOrder.LITTLE_ENDIAN);
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,704 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
|
||||||
import com.facebook.soloader.SoLoader;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
public class YogaNodePropertiesJNI implements Cloneable, YogaNodeProperties {
|
|
||||||
|
|
||||||
static {
|
|
||||||
SoLoader.loadLibrary("yoga");
|
|
||||||
}
|
|
||||||
|
|
||||||
private long mNativePointer;
|
|
||||||
|
|
||||||
/* Those flags needs be in sync with YGJNI.cpp */
|
|
||||||
protected static final int MARGIN = 1;
|
|
||||||
protected static final int PADDING = 2;
|
|
||||||
protected static final int BORDER = 4;
|
|
||||||
|
|
||||||
@DoNotStrip protected int mEdgeSetFlag = 0;
|
|
||||||
|
|
||||||
protected boolean mHasSetPosition = false;
|
|
||||||
|
|
||||||
@DoNotStrip private float mWidth = YogaConstants.UNDEFINED;
|
|
||||||
@DoNotStrip private float mHeight = YogaConstants.UNDEFINED;
|
|
||||||
@DoNotStrip private float mTop = YogaConstants.UNDEFINED;
|
|
||||||
@DoNotStrip private float mLeft = YogaConstants.UNDEFINED;
|
|
||||||
@DoNotStrip private float mMarginLeft = 0;
|
|
||||||
@DoNotStrip private float mMarginTop = 0;
|
|
||||||
@DoNotStrip private float mMarginRight = 0;
|
|
||||||
@DoNotStrip private float mMarginBottom = 0;
|
|
||||||
@DoNotStrip private float mPaddingLeft = 0;
|
|
||||||
@DoNotStrip private float mPaddingTop = 0;
|
|
||||||
@DoNotStrip private float mPaddingRight = 0;
|
|
||||||
@DoNotStrip private float mPaddingBottom = 0;
|
|
||||||
@DoNotStrip private float mBorderLeft = 0;
|
|
||||||
@DoNotStrip private float mBorderTop = 0;
|
|
||||||
@DoNotStrip private float mBorderRight = 0;
|
|
||||||
@DoNotStrip private float mBorderBottom = 0;
|
|
||||||
@DoNotStrip private int mLayoutDirection = 0;
|
|
||||||
@DoNotStrip private boolean mHasNewLayout = true;
|
|
||||||
@DoNotStrip private boolean mDoesLegacyStretchFlagAffectsLayout = false;
|
|
||||||
|
|
||||||
private native long jni_YGNodeNew(YogaNode node);
|
|
||||||
|
|
||||||
public YogaNodePropertiesJNI(YogaNode node) {
|
|
||||||
mNativePointer = jni_YGNodeNew(node);
|
|
||||||
if (mNativePointer == 0) {
|
|
||||||
throw new IllegalStateException("Failed to allocate native memory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private native long jni_YGNodeNewWithConfig(YogaNode node, long configPointer);
|
|
||||||
|
|
||||||
public YogaNodePropertiesJNI(YogaNode node, YogaConfig config) {
|
|
||||||
mNativePointer = jni_YGNodeNewWithConfig(node, config.mNativePointer);
|
|
||||||
if (mNativePointer == 0) {
|
|
||||||
throw new IllegalStateException("Failed to allocate native memory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGNodeFree(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void freeNatives() {
|
|
||||||
long nativePointer = mNativePointer;
|
|
||||||
mNativePointer = 0;
|
|
||||||
jni_YGNodeFree(nativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void finalize() throws Throwable {
|
|
||||||
try {
|
|
||||||
freeNatives();
|
|
||||||
} finally {
|
|
||||||
super.finalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native long jni_YGNodeClone(
|
|
||||||
long nativePointer, YogaNode newNode, YogaNodePropertiesJNI newProps);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaNodeProperties clone(YogaNode node) {
|
|
||||||
try {
|
|
||||||
YogaNodePropertiesJNI clonedProperties = (YogaNodePropertiesJNI) clone();
|
|
||||||
clonedProperties.mNativePointer = jni_YGNodeClone(getNativePointer(), node, clonedProperties);
|
|
||||||
return clonedProperties;
|
|
||||||
} catch (CloneNotSupportedException ex) {
|
|
||||||
// This class implements Cloneable, this should not happen
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNativePointer() {
|
|
||||||
return mNativePointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGTransferLayoutOutputsRecursive(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAfterCalculateLayout(boolean hasNewLayoutIgnoredSetByNative) {
|
|
||||||
jni_YGTransferLayoutOutputsRecursive(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeReset(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
mHasSetPosition = false;
|
|
||||||
mEdgeSetFlag = 0;
|
|
||||||
mHasNewLayout = true;
|
|
||||||
mDoesLegacyStretchFlagAffectsLayout = false;
|
|
||||||
|
|
||||||
mWidth = YogaConstants.UNDEFINED;
|
|
||||||
mHeight = YogaConstants.UNDEFINED;
|
|
||||||
mTop = YogaConstants.UNDEFINED;
|
|
||||||
mLeft = YogaConstants.UNDEFINED;
|
|
||||||
mMarginLeft = 0;
|
|
||||||
mMarginTop = 0;
|
|
||||||
mMarginRight = 0;
|
|
||||||
mMarginBottom = 0;
|
|
||||||
mPaddingLeft = 0;
|
|
||||||
mPaddingTop = 0;
|
|
||||||
mPaddingRight = 0;
|
|
||||||
mPaddingBottom = 0;
|
|
||||||
mBorderLeft = 0;
|
|
||||||
mBorderTop = 0;
|
|
||||||
mBorderRight = 0;
|
|
||||||
mBorderBottom = 0;
|
|
||||||
mLayoutDirection = 0;
|
|
||||||
jni_YGNodeReset(getNativePointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNewLayout() {
|
|
||||||
return mHasNewLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDirty() {
|
|
||||||
return jni_YGNodeIsDirty(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markLayoutSeen() {
|
|
||||||
mHasNewLayout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getStyleDirection() {
|
|
||||||
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDirection(YogaDirection direction) {
|
|
||||||
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaFlexDirection getFlexDirection() {
|
|
||||||
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
|
||||||
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaJustify getJustifyContent() {
|
|
||||||
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
|
||||||
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignItems() {
|
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
|
||||||
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignSelf() {
|
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
|
||||||
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignContent() {
|
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
|
||||||
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaPositionType getPositionType() {
|
|
||||||
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
|
||||||
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
|
||||||
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaOverflow getOverflow() {
|
|
||||||
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
|
||||||
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDisplay getDisplay() {
|
|
||||||
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(YogaDisplay display) {
|
|
||||||
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
|
||||||
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexGrow() {
|
|
||||||
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
|
||||||
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexShrink() {
|
|
||||||
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
|
||||||
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getFlexBasis() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
|
||||||
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisAuto() {
|
|
||||||
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
|
||||||
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
|
||||||
return YogaValue.UNDEFINED;
|
|
||||||
}
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
|
||||||
mEdgeSetFlag |= MARGIN;
|
|
||||||
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPadding(YogaEdge edge) {
|
|
||||||
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
|
||||||
return YogaValue.UNDEFINED;
|
|
||||||
}
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
|
||||||
mEdgeSetFlag |= PADDING;
|
|
||||||
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
|
||||||
mEdgeSetFlag |= PADDING;
|
|
||||||
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getBorder(YogaEdge edge) {
|
|
||||||
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
|
||||||
return YogaConstants.UNDEFINED;
|
|
||||||
}
|
|
||||||
return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
|
||||||
mEdgeSetFlag |= BORDER;
|
|
||||||
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPosition(YogaEdge edge) {
|
|
||||||
if (!mHasSetPosition) {
|
|
||||||
return YogaValue.UNDEFINED;
|
|
||||||
}
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
|
||||||
mHasSetPosition = true;
|
|
||||||
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPositionPercent(
|
|
||||||
long nativePointer, int edge, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
|
||||||
mHasSetPosition = true;
|
|
||||||
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getWidth() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
|
||||||
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthAuto() {
|
|
||||||
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getHeight() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
|
||||||
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightAuto() {
|
|
||||||
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinWidth() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
|
||||||
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidthPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinHeight() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
|
||||||
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeightPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxWidth() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
|
||||||
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidthPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxHeight() {
|
|
||||||
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxheight) {
|
|
||||||
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeightPercent(float percent) {
|
|
||||||
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getAspectRatio() {
|
|
||||||
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAspectRatio(float aspectRatio) {
|
|
||||||
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutX() {
|
|
||||||
return mLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutY() {
|
|
||||||
return mTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutWidth() {
|
|
||||||
return mWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutHeight() {
|
|
||||||
return mHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
|
||||||
return mDoesLegacyStretchFlagAffectsLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutMargin(YogaEdge edge) {
|
|
||||||
switch (edge) {
|
|
||||||
case LEFT:
|
|
||||||
return mMarginLeft;
|
|
||||||
case TOP:
|
|
||||||
return mMarginTop;
|
|
||||||
case RIGHT:
|
|
||||||
return mMarginRight;
|
|
||||||
case BOTTOM:
|
|
||||||
return mMarginBottom;
|
|
||||||
case START:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginRight : mMarginLeft;
|
|
||||||
case END:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mMarginLeft : mMarginRight;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Cannot get layout margins of multi-edge shorthands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutPadding(YogaEdge edge) {
|
|
||||||
switch (edge) {
|
|
||||||
case LEFT:
|
|
||||||
return mPaddingLeft;
|
|
||||||
case TOP:
|
|
||||||
return mPaddingTop;
|
|
||||||
case RIGHT:
|
|
||||||
return mPaddingRight;
|
|
||||||
case BOTTOM:
|
|
||||||
return mPaddingBottom;
|
|
||||||
case START:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingRight : mPaddingLeft;
|
|
||||||
case END:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mPaddingLeft : mPaddingRight;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Cannot get layout paddings of multi-edge shorthands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutBorder(YogaEdge edge) {
|
|
||||||
switch (edge) {
|
|
||||||
case LEFT:
|
|
||||||
return mBorderLeft;
|
|
||||||
case TOP:
|
|
||||||
return mBorderTop;
|
|
||||||
case RIGHT:
|
|
||||||
return mBorderRight;
|
|
||||||
case BOTTOM:
|
|
||||||
return mBorderBottom;
|
|
||||||
case START:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderRight : mBorderLeft;
|
|
||||||
case END:
|
|
||||||
return getLayoutDirection() == YogaDirection.RTL ? mBorderLeft : mBorderRight;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Cannot get layout border of multi-edge shorthands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getLayoutDirection() {
|
|
||||||
return YogaDirection.fromInt(mLayoutDirection);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,580 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
|
||||||
import com.facebook.soloader.SoLoader;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import sun.misc.Unsafe;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
public class YogaNodePropertiesUnsafe implements YogaNodeProperties {
|
|
||||||
|
|
||||||
private static final int TRUE_BITS = 0x01000001;
|
|
||||||
private static final int FLOAT_SIZE = 4;
|
|
||||||
private static final int AUTO = YogaUnit.AUTO.intValue();
|
|
||||||
private static final int POINT = YogaUnit.POINT.intValue();
|
|
||||||
private static final int PERCENT = YogaUnit.PERCENT.intValue();
|
|
||||||
private static final int UNDEFINED = YogaUnit.UNDEFINED.intValue();
|
|
||||||
private static final int RTL = YogaDirection.RTL.intValue();
|
|
||||||
private static final Unsafe UNSAFE;
|
|
||||||
|
|
||||||
private final long mNativePointer;
|
|
||||||
private final long mStyleNativePointer;
|
|
||||||
private final long mLayoutNativePointer;
|
|
||||||
private boolean mHasBorderSet = false;
|
|
||||||
private boolean mHasNewLayout = true;
|
|
||||||
private boolean mIsFreed = false;
|
|
||||||
|
|
||||||
static {
|
|
||||||
SoLoader.loadLibrary("yoga");
|
|
||||||
Field instanceField = null;
|
|
||||||
try {
|
|
||||||
instanceField = Unsafe.class.getDeclaredField("theUnsafe");
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
instanceField.setAccessible(true);
|
|
||||||
try {
|
|
||||||
UNSAFE = (Unsafe) instanceField.get(null);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native long jni_YGNodeNewNoProps(YogaNode node);
|
|
||||||
private static native long jni_YGNodeNewNoPropsWithConfig(YogaNode node, long configPointer);
|
|
||||||
private static native long jni_YGNodeStylePointer(long nativePointer);
|
|
||||||
private static native long jni_YGNodeLayoutPointer(long nativePointer);
|
|
||||||
|
|
||||||
public YogaNodePropertiesUnsafe(YogaNode node) {
|
|
||||||
this(jni_YGNodeNewNoProps(node));
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaNodePropertiesUnsafe(YogaNode node, YogaConfig config) {
|
|
||||||
this(jni_YGNodeNewNoPropsWithConfig(node, config.mNativePointer));
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaNodePropertiesUnsafe(long nativePointer) {
|
|
||||||
mNativePointer = nativePointer;
|
|
||||||
mStyleNativePointer = jni_YGNodeStylePointer(nativePointer);
|
|
||||||
mLayoutNativePointer = jni_YGNodeLayoutPointer(nativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native long jni_YGNodeCloneNoProps(long nativePointer, YogaNode newNode);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaNodeProperties clone(YogaNode node) {
|
|
||||||
long clonedNativePointer = jni_YGNodeCloneNoProps(getNativePointer(), node);
|
|
||||||
YogaNodePropertiesUnsafe clone =
|
|
||||||
new YogaNodePropertiesUnsafe(clonedNativePointer);
|
|
||||||
clone.mHasBorderSet = mHasBorderSet;
|
|
||||||
clone.mHasNewLayout = mHasNewLayout;
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getNativePointer() {
|
|
||||||
return mNativePointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAfterCalculateLayout(boolean hasNewLayout) {
|
|
||||||
mHasNewLayout = hasNewLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGNodeReset(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reset() {
|
|
||||||
mHasNewLayout = true;
|
|
||||||
jni_YGNodeReset(getNativePointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNewLayout() {
|
|
||||||
return mHasNewLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native boolean jni_YGNodeIsDirty(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDirty() {
|
|
||||||
return jni_YGNodeIsDirty(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markLayoutSeen() {
|
|
||||||
mHasNewLayout = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getStyleDirection() {
|
|
||||||
return YogaDirection.fromInt(getStyleInt(YogaNodeMemoryLayout.styleDirection));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDirection(YogaDirection direction) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleDirection, direction.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaFlexDirection getFlexDirection() {
|
|
||||||
return YogaFlexDirection.fromInt(getStyleInt(YogaNodeMemoryLayout.styleFlexDirection));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleFlexDirection, flexDirection.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaJustify getJustifyContent() {
|
|
||||||
return YogaJustify.fromInt(getStyleInt(YogaNodeMemoryLayout.styleJustifyContent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleJustifyContent, justifyContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignItems() {
|
|
||||||
return YogaAlign.fromInt(getStyleInt(YogaNodeMemoryLayout.styleAlignItems));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleAlignItems, alignItems.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignSelf() {
|
|
||||||
return YogaAlign.fromInt(getStyleInt(YogaNodeMemoryLayout.styleAlignSelf));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleAlignSelf, alignSelf.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignContent() {
|
|
||||||
return YogaAlign.fromInt(getStyleInt(YogaNodeMemoryLayout.styleAlignContent));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleAlignContent, alignContent.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaPositionType getPositionType() {
|
|
||||||
return YogaPositionType.fromInt(getStyleInt(YogaNodeMemoryLayout.stylePositionType));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.stylePositionType, positionType.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleFlexWrap, flexWrap.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaOverflow getOverflow() {
|
|
||||||
return YogaOverflow.fromInt(getStyleInt(YogaNodeMemoryLayout.styleOverflow));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleOverflow, overflow.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDisplay getDisplay() {
|
|
||||||
return YogaDisplay.fromInt(getStyleInt(YogaNodeMemoryLayout.styleDisplay));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDisplay(YogaDisplay display) {
|
|
||||||
putStyleInt(YogaNodeMemoryLayout.styleDisplay, display.intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
|
||||||
putStyleOptional(YogaNodeMemoryLayout.styleFlex, flex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexGrow() {
|
|
||||||
return getStyleFloat(YogaNodeMemoryLayout.styleFlexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
|
||||||
putStyleOptional(YogaNodeMemoryLayout.styleFlexGrow, flexGrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getFlexShrink() {
|
|
||||||
return getStyleFloat(YogaNodeMemoryLayout.styleFlexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
|
||||||
putStyleOptional(YogaNodeMemoryLayout.styleFlexShrink, flexShrink);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getFlexBasis() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleFlexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleFlexBasis, flexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleFlexBasis, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlexBasisAuto() {
|
|
||||||
putStyleAuto(YogaNodeMemoryLayout.styleFlexBasis);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleMarginOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleMarginOffset(edge), margin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleMarginOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
|
||||||
putStyleAuto(YogaNodeMemoryLayout.styleMarginOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPadding(YogaEdge edge) {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.stylePaddingOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.stylePaddingOffset(edge), padding);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.stylePaddingOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getBorder(YogaEdge edge) {
|
|
||||||
return mHasBorderSet
|
|
||||||
? getStyleFloat(YogaNodeMemoryLayout.styleBorderOffset(edge))
|
|
||||||
: YogaConstants.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
|
||||||
mHasBorderSet = true;
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleBorderOffset(edge), border);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getPosition(YogaEdge edge) {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.stylePositionOffset(edge));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.stylePositionOffset(edge), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.stylePositionOffset(edge), percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getWidth() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleWidth, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWidthAuto() {
|
|
||||||
putStyleAuto(YogaNodeMemoryLayout.styleWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getHeight() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleHeight, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeightAuto() {
|
|
||||||
putStyleAuto(YogaNodeMemoryLayout.styleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinWidth() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleMinWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleMinWidth, minWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinWidthPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleMinWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMinHeight() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleMinHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleMinHeight, minHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMinHeightPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleMinHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxWidth() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleMaxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleMaxWidth, maxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxWidthPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleMaxWidth, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaValue getMaxHeight() {
|
|
||||||
return getStyleValue(YogaNodeMemoryLayout.styleMaxHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxHeight) {
|
|
||||||
putStylePoints(YogaNodeMemoryLayout.styleMaxHeight, maxHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxHeightPercent(float percent) {
|
|
||||||
putStylePercent(YogaNodeMemoryLayout.styleMaxHeight, percent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getAspectRatio() {
|
|
||||||
return getStyleOptional(YogaNodeMemoryLayout.styleAspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAspectRatio(float aspectRatio) {
|
|
||||||
putStyleOptional(YogaNodeMemoryLayout.styleAspectRatio, aspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutX() {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutX);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutY() {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutWidth() {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutHeight() {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getDoesLegacyStretchFlagAffectsLayout() {
|
|
||||||
return getBool(mLayoutNativePointer + YogaNodeMemoryLayout.layoutDoesLegacyStretchFlagAffectsLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutMargin(YogaEdge edge) {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutMarginOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutPadding(YogaEdge edge) {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutPaddingOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutBorder(YogaEdge edge) {
|
|
||||||
return getLayoutFloat(YogaNodeMemoryLayout.layoutBorderOffset(layoutEdge(edge)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getLayoutDirection() {
|
|
||||||
return YogaDirection.fromInt(getLayoutDirectionInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static native void jni_YGNodeFree(long nativePointer);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void freeNatives() {
|
|
||||||
if (!mIsFreed) {
|
|
||||||
mIsFreed = true;
|
|
||||||
jni_YGNodeFree(mNativePointer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getLayoutDirectionInt() {
|
|
||||||
return UNSAFE.getInt(null, mLayoutNativePointer + YogaNodeMemoryLayout.layoutDirection);
|
|
||||||
}
|
|
||||||
|
|
||||||
private YogaEdge layoutEdge(YogaEdge edge) {
|
|
||||||
int layoutDirection = getLayoutDirectionInt();
|
|
||||||
switch (edge) {
|
|
||||||
case LEFT:
|
|
||||||
return layoutDirection == RTL ? YogaEdge.END : YogaEdge.START;
|
|
||||||
case RIGHT:
|
|
||||||
return layoutDirection == RTL ? YogaEdge.START : YogaEdge.END;
|
|
||||||
case TOP:
|
|
||||||
case BOTTOM:
|
|
||||||
case START:
|
|
||||||
case END:
|
|
||||||
return edge;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Cannot get layout properties of multi-edge shorthands");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getStyleInt(int offset) {
|
|
||||||
return UNSAFE.getInt(null, mStyleNativePointer + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStyleInt(int offset, int value) {
|
|
||||||
UNSAFE.putInt(null, mStyleNativePointer + offset, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getStyleFloat(int offset) {
|
|
||||||
return getFloat(mStyleNativePointer + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStyleFloat(int offset, float value) {
|
|
||||||
putFloat(mStyleNativePointer + offset, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStylePoints(int offset, float value) {
|
|
||||||
putStyleValue(offset, value, POINT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStylePercent(int offset, float value) {
|
|
||||||
putStyleValue(offset, value, PERCENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStyleAuto(int offset) {
|
|
||||||
putStyleValue(offset, 0, AUTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStyleValue(int offset, float value, int unit) {
|
|
||||||
if (YogaConstants.isUndefined(value)) {
|
|
||||||
value = YogaConstants.UNDEFINED;
|
|
||||||
unit = UNDEFINED;
|
|
||||||
}
|
|
||||||
putStyleFloat(offset, value);
|
|
||||||
putStyleInt(offset + FLOAT_SIZE, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
private YogaValue getStyleValue(int offset) {
|
|
||||||
float value = getStyleFloat(offset);
|
|
||||||
int unit = getStyleInt(offset + FLOAT_SIZE);
|
|
||||||
return new YogaValue(value, YogaUnit.fromInt(unit));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void putStyleOptional(int offset, float value) {
|
|
||||||
int isUndefinedBits = YogaConstants.isUndefined(value) ? TRUE_BITS : 0;
|
|
||||||
putStyleFloat(offset, value);
|
|
||||||
putStyleInt(offset + FLOAT_SIZE, isUndefinedBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getStyleOptional(int offset) {
|
|
||||||
boolean isUndefined = getBool(mStyleNativePointer + offset + FLOAT_SIZE);
|
|
||||||
return isUndefined
|
|
||||||
? YogaConstants.UNDEFINED
|
|
||||||
: getStyleFloat(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getLayoutFloat(int offset) {
|
|
||||||
return getFloat(mLayoutNativePointer + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float getFloat(long offset) {
|
|
||||||
int intBits = UNSAFE.getInt(null, offset);
|
|
||||||
return Float.intBitsToFloat(intBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void putFloat(long offset, float value) {
|
|
||||||
int intBits = Float.floatToRawIntBits(value);
|
|
||||||
UNSAFE.putInt(null, offset, intBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean getBool(long offset) {
|
|
||||||
// assumes little endian
|
|
||||||
return (UNSAFE.getInt(null, offset) & 0xFF) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -6,7 +6,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <fb/fbjni.h>
|
#include <fb/fbjni.h>
|
||||||
#include <fb/fbjni/ByteBuffer.h>
|
|
||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -22,23 +21,6 @@ struct JYogaConfig : public JavaClass<JYogaConfig> {
|
|||||||
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaConfig;";
|
static constexpr auto kJavaDescriptor = "Lcom/facebook/yoga/YogaConfig;";
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JYogaNodePropertiesJNI : public JavaClass<JYogaNodePropertiesJNI> {
|
|
||||||
static constexpr auto kJavaDescriptor =
|
|
||||||
"Lcom/facebook/yoga/YogaNodePropertiesJNI;";
|
|
||||||
};
|
|
||||||
|
|
||||||
struct JYogaNodePropertiesByteBuffer
|
|
||||||
: public JavaClass<JYogaNodePropertiesByteBuffer, JYogaNodePropertiesJNI> {
|
|
||||||
static constexpr auto kJavaDescriptor =
|
|
||||||
"Lcom/facebook/yoga/YogaNodePropertiesByteBuffer";
|
|
||||||
};
|
|
||||||
|
|
||||||
struct JYogaNodePropertiesHybrid
|
|
||||||
: public JavaClass<JYogaNodePropertiesHybrid, JYogaNodePropertiesJNI> {
|
|
||||||
static constexpr auto kJavaDescriptor =
|
|
||||||
"Lcom/facebook/yoga/YogaNodePropertiesHybrid";
|
|
||||||
};
|
|
||||||
|
|
||||||
struct YGConfigContext {
|
struct YGConfigContext {
|
||||||
global_ref<jobject>* logger;
|
global_ref<jobject>* logger;
|
||||||
global_ref<jobject>* config;
|
global_ref<jobject>* config;
|
||||||
@ -51,34 +33,16 @@ struct YGConfigContext {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JNINodeContext {
|
|
||||||
weak_ref<JYogaNode> node;
|
|
||||||
weak_ref<JYogaNodePropertiesJNI> props;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline weak_ref<JYogaNode>* YGNodeJobject(YGNodeRef node) {
|
static inline weak_ref<JYogaNode>* YGNodeJobject(YGNodeRef node) {
|
||||||
return &reinterpret_cast<JNINodeContext*>(node->getContext())->node;
|
return reinterpret_cast<weak_ref<JYogaNode>*>(node->getContext());
|
||||||
}
|
|
||||||
|
|
||||||
static inline weak_ref<JYogaNodePropertiesJNI>* YGNodePropsJObject(
|
|
||||||
YGNodeRef node) {
|
|
||||||
return &reinterpret_cast<JNINodeContext*>(node->getContext())->props;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void setNodeContext(
|
|
||||||
YGNodeRef node,
|
|
||||||
alias_ref<JYogaNode> javaNode,
|
|
||||||
alias_ref<JYogaNodePropertiesJNI> javaNodeProps) {
|
|
||||||
node->setContext(
|
|
||||||
new JNINodeContext{make_weak(javaNode), make_weak(javaNodeProps)});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void YGTransferLayoutDirection(
|
static void YGTransferLayoutDirection(
|
||||||
YGNodeRef node,
|
YGNodeRef node,
|
||||||
alias_ref<JYogaNodePropertiesJNI> javaProps) {
|
alias_ref<jobject> javaNode) {
|
||||||
static auto layoutDirectionField =
|
static auto layoutDirectionField =
|
||||||
javaProps->getClass()->getField<jint>("mLayoutDirection");
|
javaNode->getClass()->getField<jint>("mLayoutDirection");
|
||||||
javaProps->setFieldValue(
|
javaNode->setFieldValue(
|
||||||
layoutDirectionField, static_cast<jint>(YGNodeLayoutGetDirection(node)));
|
layoutDirectionField, static_cast<jint>(YGNodeLayoutGetDirection(node)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +50,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
|
|||||||
if (!root->getHasNewLayout()) {
|
if (!root->getHasNewLayout()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto obj = YGNodePropsJObject(root)->lockLocal();
|
auto obj = YGNodeJobject(root)->lockLocal();
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
YGLog(
|
YGLog(
|
||||||
root,
|
root,
|
||||||
@ -259,9 +223,7 @@ static YGSize YGJNIMeasureFunc(
|
|||||||
findClassStatic("com/facebook/yoga/YogaNode")
|
findClassStatic("com/facebook/yoga/YogaNode")
|
||||||
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
||||||
|
|
||||||
if (auto jProps = YGNodePropsJObject(node)->lockLocal()) {
|
YGTransferLayoutDirection(node, obj);
|
||||||
YGTransferLayoutDirection(node, jProps);
|
|
||||||
}
|
|
||||||
const auto measureResult =
|
const auto measureResult =
|
||||||
measureFunc(obj, width, widthMode, height, heightMode);
|
measureFunc(obj, width, widthMode, height, heightMode);
|
||||||
|
|
||||||
@ -325,36 +287,22 @@ static int YGJNILogFunc(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
jlong jni_YGNodeNew(
|
jlong jni_YGNodeNew(alias_ref<jobject> thiz) {
|
||||||
alias_ref<JYogaNodePropertiesJNI> javaProps,
|
|
||||||
alias_ref<JYogaNode> javaNode) {
|
|
||||||
const YGNodeRef node = YGNodeNew();
|
const YGNodeRef node = YGNodeNew();
|
||||||
setNodeContext(node, javaNode, javaProps);
|
node->setContext(new weak_ref<jobject>(make_weak(thiz)));
|
||||||
|
// YGNodeSetContext(node, new weak_ref<jobject>(make_weak(thiz)));
|
||||||
node->setPrintFunc(YGPrint);
|
node->setPrintFunc(YGPrint);
|
||||||
|
// YGNodeSetPrintFunc(node, YGPrint);
|
||||||
return reinterpret_cast<jlong>(node);
|
return reinterpret_cast<jlong>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
jlong jni_YGNodeNewWithConfig(
|
jlong jni_YGNodeNewWithConfig(alias_ref<jobject> thiz, jlong configPointer) {
|
||||||
alias_ref<JYogaNodePropertiesJNI> javaProps,
|
|
||||||
alias_ref<JYogaNode> javaNode,
|
|
||||||
jlong configPointer) {
|
|
||||||
const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer));
|
const YGNodeRef node = YGNodeNewWithConfig(_jlong2YGConfigRef(configPointer));
|
||||||
setNodeContext(node, javaNode, javaProps);
|
node->setContext(new weak_ref<jobject>(make_weak(thiz)));
|
||||||
node->setPrintFunc(YGPrint);
|
node->setPrintFunc(YGPrint);
|
||||||
return reinterpret_cast<jlong>(node);
|
return reinterpret_cast<jlong>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
jlong jni_YGNodeNewNoProps(alias_ref<jclass>, alias_ref<JYogaNode> javaNode) {
|
|
||||||
return jni_YGNodeNew(nullptr, javaNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
jlong jni_YGNodeNewNoPropsWithConfig(
|
|
||||||
alias_ref<jclass>,
|
|
||||||
alias_ref<JYogaNode> javaNode,
|
|
||||||
jlong configPointer) {
|
|
||||||
return jni_YGNodeNewWithConfig(nullptr, javaNode, configPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void jni_YGNodeSetOwner(
|
void jni_YGNodeSetOwner(
|
||||||
alias_ref<jobject> thiz,
|
alias_ref<jobject> thiz,
|
||||||
jlong nativePointer,
|
jlong nativePointer,
|
||||||
@ -366,28 +314,21 @@ void jni_YGNodeSetOwner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
jlong jni_YGNodeClone(
|
jlong jni_YGNodeClone(
|
||||||
alias_ref<jclass>,
|
alias_ref<jobject> thiz,
|
||||||
jlong nativePointer,
|
jlong nativePointer,
|
||||||
alias_ref<JYogaNode> clonedJavaObject,
|
alias_ref<jobject> clonedJavaObject) {
|
||||||
alias_ref<JYogaNodePropertiesJNI> clonedJavaProps) {
|
|
||||||
const YGNodeRef clonedYogaNode = YGNodeClone(_jlong2YGNodeRef(nativePointer));
|
const YGNodeRef clonedYogaNode = YGNodeClone(_jlong2YGNodeRef(nativePointer));
|
||||||
setNodeContext(clonedYogaNode, clonedJavaObject, clonedJavaProps);
|
clonedYogaNode->setContext(
|
||||||
|
new weak_ref<jobject>(make_weak(clonedJavaObject)));
|
||||||
return reinterpret_cast<jlong>(clonedYogaNode);
|
return reinterpret_cast<jlong>(clonedYogaNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
jlong jni_YGNodeCloneNoProps(
|
void jni_YGNodeFree(alias_ref<jclass>, jlong nativePointer) {
|
||||||
alias_ref<jclass> cls,
|
|
||||||
jlong nativePointer,
|
|
||||||
alias_ref<JYogaNode> clonedJavaObject) {
|
|
||||||
return jni_YGNodeClone(cls, nativePointer, clonedJavaObject, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void jni_YGNodeFree(alias_ref<jclass> thiz, jlong nativePointer) {
|
|
||||||
if (nativePointer == 0) {
|
if (nativePointer == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||||
delete reinterpret_cast<JNINodeContext*>(node->getContext());
|
delete YGNodeJobject(node);
|
||||||
YGNodeFree(node);
|
YGNodeFree(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +379,7 @@ void jni_YGNodeRemoveChild(
|
|||||||
_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean jni_YGNodeCalculateLayout(
|
void jni_YGNodeCalculateLayout(
|
||||||
alias_ref<jobject>,
|
alias_ref<jobject>,
|
||||||
jlong nativePointer,
|
jlong nativePointer,
|
||||||
jfloat width,
|
jfloat width,
|
||||||
@ -449,13 +390,6 @@ jboolean jni_YGNodeCalculateLayout(
|
|||||||
static_cast<float>(width),
|
static_cast<float>(width),
|
||||||
static_cast<float>(height),
|
static_cast<float>(height),
|
||||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
||||||
return root->getHasNewLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void jni_YGTransferLayoutOutputsRecursive(
|
|
||||||
alias_ref<jclass>,
|
|
||||||
jlong nativePointer) {
|
|
||||||
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
|
||||||
YGTransferLayoutOutputsRecursive(root);
|
YGTransferLayoutOutputsRecursive(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -729,43 +663,29 @@ void jni_YGConfigSetLogger(
|
|||||||
jint jni_YGNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
jint jni_YGNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
||||||
return YGNodeGetInstanceCount();
|
return YGNodeGetInstanceCount();
|
||||||
}
|
}
|
||||||
local_ref<JByteBuffer> jni_getStyleBuffer(
|
|
||||||
alias_ref<jclass>,
|
|
||||||
jlong nativePointer) {
|
|
||||||
YGStyle* style = &_jlong2YGNodeRef(nativePointer)->getStyle();
|
|
||||||
return JByteBuffer::wrapBytes(
|
|
||||||
reinterpret_cast<uint8_t*>(style), sizeof(YGStyle));
|
|
||||||
}
|
|
||||||
|
|
||||||
local_ref<JByteBuffer> jni_getLayoutBuffer(
|
|
||||||
alias_ref<jclass>,
|
|
||||||
jlong nativePointer) {
|
|
||||||
YGLayout* layout = &_jlong2YGNodeRef(nativePointer)->getLayout();
|
|
||||||
return JByteBuffer::wrapBytes(
|
|
||||||
reinterpret_cast<uint8_t*>(layout), sizeof(YGLayout));
|
|
||||||
}
|
|
||||||
|
|
||||||
jlong jni_YGNodeStylePointer(alias_ref<jclass>, jlong nativePointer) {
|
|
||||||
return reinterpret_cast<jlong>(&_jlong2YGNodeRef(nativePointer)->getStyle());
|
|
||||||
}
|
|
||||||
|
|
||||||
jlong jni_YGNodeLayoutPointer(alias_ref<jclass>, jlong nativePointer) {
|
|
||||||
return reinterpret_cast<jlong>(&_jlong2YGNodeRef(nativePointer)->getLayout());
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YGMakeNativeMethod(name) makeNativeMethod(#name, name)
|
#define YGMakeNativeMethod(name) makeNativeMethod(#name, name)
|
||||||
|
|
||||||
jint JNI_OnLoad(JavaVM* vm, void*) {
|
jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||||
return initialize(vm, [] {
|
return initialize(vm, [] {
|
||||||
registerNatives(
|
registerNatives(
|
||||||
"com/facebook/yoga/YogaNodePropertiesJNI",
|
"com/facebook/yoga/YogaNode",
|
||||||
{
|
{
|
||||||
YGMakeNativeMethod(jni_YGNodeClone),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeNew),
|
YGMakeNativeMethod(jni_YGNodeNew),
|
||||||
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
|
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
|
||||||
YGMakeNativeMethod(jni_YGNodeFree),
|
YGMakeNativeMethod(jni_YGNodeFree),
|
||||||
YGMakeNativeMethod(jni_YGNodeReset),
|
YGMakeNativeMethod(jni_YGNodeReset),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeClearChildren),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeInsertChild),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeInsertSharedChild),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeRemoveChild),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeMarkDirty),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeMarkDirtyAndPropogateToDescendants),
|
||||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetFlexDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleGetFlexDirection),
|
||||||
@ -828,23 +748,9 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetAspectRatio),
|
YGMakeNativeMethod(jni_YGNodeStyleGetAspectRatio),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetAspectRatio),
|
YGMakeNativeMethod(jni_YGNodeStyleSetAspectRatio),
|
||||||
YGMakeNativeMethod(jni_YGTransferLayoutOutputsRecursive),
|
|
||||||
});
|
|
||||||
registerNatives(
|
|
||||||
"com/facebook/yoga/YogaNode",
|
|
||||||
{
|
|
||||||
YGMakeNativeMethod(jni_YGNodeClearChildren),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeInsertChild),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeInsertSharedChild),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeRemoveChild),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeMarkDirty),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeMarkDirtyAndPropogateToDescendants),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
||||||
YGMakeNativeMethod(jni_YGNodePrint),
|
YGMakeNativeMethod(jni_YGNodePrint),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeClone),
|
||||||
YGMakeNativeMethod(jni_YGNodeSetOwner),
|
YGMakeNativeMethod(jni_YGNodeSetOwner),
|
||||||
});
|
});
|
||||||
registerNatives(
|
registerNatives(
|
||||||
@ -861,34 +767,5 @@ jint JNI_OnLoad(JavaVM* vm, void*) {
|
|||||||
YGMakeNativeMethod(
|
YGMakeNativeMethod(
|
||||||
jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour),
|
jni_YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour),
|
||||||
});
|
});
|
||||||
registerNatives(
|
|
||||||
"com/facebook/yoga/YogaNodePropertiesByteBuffer",
|
|
||||||
{
|
|
||||||
YGMakeNativeMethod(jni_YGNodeCloneNoProps),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeFree),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeNewNoProps),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeNewNoPropsWithConfig),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeReset),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
|
||||||
YGMakeNativeMethod(jni_getStyleBuffer),
|
|
||||||
YGMakeNativeMethod(jni_getLayoutBuffer),
|
|
||||||
});
|
|
||||||
registerNatives(
|
|
||||||
"com/facebook/yoga/YogaNodePropertiesHybrid",
|
|
||||||
{
|
|
||||||
YGMakeNativeMethod(jni_getStyleBuffer),
|
|
||||||
});
|
|
||||||
registerNatives(
|
|
||||||
"com/facebook/yoga/YogaNodePropertiesUnsafe",
|
|
||||||
{
|
|
||||||
YGMakeNativeMethod(jni_YGNodeCloneNoProps),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeFree),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeNewNoProps),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeNewNoPropsWithConfig),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeStylePointer),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeLayoutPointer),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
|
||||||
YGMakeNativeMethod(jni_YGNodeReset),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
java {
|
|
||||||
srcDirs = ['src']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018-present, Facebook, Inc.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the LICENSE
|
|
||||||
* file in the root directory of this source tree.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package sun.misc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stub for sun.misc.Unsafe, which is not exposed by the Android SDK.
|
|
||||||
*
|
|
||||||
* This only contains the methods and fields we need for Yoga.
|
|
||||||
*/
|
|
||||||
public final class Unsafe {
|
|
||||||
private static final Unsafe theUnsafe = null;
|
|
||||||
|
|
||||||
public final int getInt(Object object, long offset) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void putInt(Object object, long offset, int value) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -271,5 +271,3 @@ def jni_instrumentation_test_lib(**kwargs):
|
|||||||
def fb_xplat_cxx_test(**kwargs):
|
def fb_xplat_cxx_test(**kwargs):
|
||||||
"""A noop stub for OSS build."""
|
"""A noop stub for OSS build."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
JAVA_STUBS_TARGET = "//ReactAndroid:stubs"
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven {
|
maven {
|
||||||
url 'https://maven.google.com/'
|
url 'https://maven.google.com/'
|
||||||
@ -14,7 +13,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.0'
|
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||||
classpath 'de.undercouch:gradle-download-task:3.4.3'
|
classpath 'de.undercouch:gradle-download-task:3.4.3'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
// This source code is licensed under the MIT license found in the
|
// This source code is licensed under the MIT license found in the
|
||||||
// LICENSE file in the root directory of this source tree.
|
// LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
include ':ReactAndroid', ':RNTester:android:app', ':ReactAndroid:stubs'
|
include ':ReactAndroid', ':RNTester:android:app'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user