Implement method bindings for gap/row-gap/column-gap

Summary:
This adds method bindings for `YGNodeStyleSetGap` and `YGNodeStyleGetGap`.

Changelog:
[Genral][Added] - Implement method bindings for yoga gap/row-gap/column-gap

Reviewed By: yungsters

Differential Revision: D39922411

fbshipit-source-id: 6cbb4d352203d2ec92df162c3f2f2efd02bd9568
This commit is contained in:
Nick Gerleman
2022-10-13 08:18:49 -07:00
committed by Facebook GitHub Bot
parent 582533dbc6
commit f992e63ac5
13 changed files with 111 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ public class YogaNative {
static {
SoLoader.loadLibrary("yoga");
}
// JNI methods that use Vanilla JNI
// YGConfig related
static native long jni_YGConfigNewJNI();
@@ -108,6 +108,8 @@ public class YogaNative {
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
static native void jni_YGNodeStyleSetGapJNI(long nativePointer, int gutter, float gapLength);
static native void jni_YGNodeSetHasMeasureFuncJNI(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodeSetHasBaselineFuncJNI(long nativePointer, boolean hasMeasureFunc);
static native void jni_YGNodePrintJNI(long nativePointer);

View File

@@ -188,6 +188,10 @@ public abstract class YogaNode implements YogaProps {
public abstract void setAspectRatio(float aspectRatio);
public abstract float getGap(YogaGutter gutter);
public abstract void setGap(YogaGutter gutter, float gapLength);
public abstract float getLayoutX();
public abstract float getLayoutY();

View File

@@ -725,4 +725,14 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
}
mHasNewLayout = false;
}
@Override
public float getGap(YogaGutter gutter) {
return YogaNative.jni_YGNodeStyleGetGapJNI(mNativePointer, gutter.intValue());
}
@Override
public void setGap(YogaGutter gutter, float gapLength) {
YogaNative.jni_YGNodeStyleSetGapJNI(mNativePointer, gutter.intValue(), gapLength);
}
}