2017-06-15 07:36:33 -07:00
|
|
|
/*
|
2016-08-04 08:19:59 -07:00
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
2016-12-05 02:56:20 -08:00
|
|
|
package com.facebook.yoga;
|
2016-08-04 08:19:59 -07:00
|
|
|
|
2017-10-31 23:08:19 -07:00
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2016-08-04 08:19:59 -07:00
|
|
|
import com.facebook.proguard.annotations.DoNotStrip;
|
|
|
|
import com.facebook.soloader.SoLoader;
|
|
|
|
|
2016-11-28 09:20:59 -08:00
|
|
|
@DoNotStrip
|
2017-04-13 12:38:45 -07:00
|
|
|
public class YogaNode {
|
2016-08-04 08:19:59 -07:00
|
|
|
|
|
|
|
static {
|
2016-12-03 04:40:23 -08:00
|
|
|
SoLoader.loadLibrary("yoga");
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-10-12 09:55:04 -07:00
|
|
|
/**
|
|
|
|
* Get native instance count. Useful for testing only.
|
|
|
|
*/
|
2016-12-03 04:40:18 -08:00
|
|
|
static native int jni_YGNodeGetInstanceCount();
|
2016-10-12 09:55:04 -07:00
|
|
|
|
2016-12-03 04:40:23 -08:00
|
|
|
private YogaNode mParent;
|
|
|
|
private List<YogaNode> mChildren;
|
|
|
|
private YogaMeasureFunction mMeasureFunction;
|
2017-01-10 07:03:56 -08:00
|
|
|
private YogaBaselineFunction mBaselineFunction;
|
2018-01-22 02:48:53 -08:00
|
|
|
private final long mNativePointer;
|
2016-08-04 08:20:07 -07:00
|
|
|
private Object mData;
|
2016-08-04 08:19:59 -07:00
|
|
|
|
2017-04-01 04:29:05 -07:00
|
|
|
/* Those flags needs be in sync with YGJNI.cpp */
|
2018-01-22 02:48:53 -08:00
|
|
|
private static final int MARGIN = 1;
|
|
|
|
private static final int PADDING = 2;
|
|
|
|
private static final int BORDER = 4;
|
2017-04-01 04:29:05 -07:00
|
|
|
|
|
|
|
@DoNotStrip
|
|
|
|
private int mEdgeSetFlag = 0;
|
|
|
|
|
2016-10-26 02:57:07 -07:00
|
|
|
private boolean mHasSetPosition = false;
|
|
|
|
|
2016-10-27 10:52:12 -07:00
|
|
|
@DoNotStrip
|
2016-12-02 05:47:43 -08:00
|
|
|
private float mWidth = YogaConstants.UNDEFINED;
|
2016-10-27 10:52:12 -07:00
|
|
|
@DoNotStrip
|
2016-12-02 05:47:43 -08:00
|
|
|
private float mHeight = YogaConstants.UNDEFINED;
|
2016-10-27 10:52:12 -07:00
|
|
|
@DoNotStrip
|
2016-12-02 05:47:43 -08:00
|
|
|
private float mTop = YogaConstants.UNDEFINED;
|
2016-10-27 10:52:12 -07:00
|
|
|
@DoNotStrip
|
2016-12-02 05:47:43 -08:00
|
|
|
private float mLeft = YogaConstants.UNDEFINED;
|
2016-10-27 10:52:12 -07:00
|
|
|
@DoNotStrip
|
2017-01-15 15:16:10 -08:00
|
|
|
private float mMarginLeft = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mMarginTop = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mMarginRight = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mMarginBottom = 0;
|
|
|
|
@DoNotStrip
|
2017-01-05 12:48:10 -08:00
|
|
|
private float mPaddingLeft = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mPaddingTop = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mPaddingRight = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mPaddingBottom = 0;
|
|
|
|
@DoNotStrip
|
2017-02-11 06:19:52 -08:00
|
|
|
private float mBorderLeft = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mBorderTop = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mBorderRight = 0;
|
|
|
|
@DoNotStrip
|
|
|
|
private float mBorderBottom = 0;
|
|
|
|
@DoNotStrip
|
2016-10-27 10:52:12 -07:00
|
|
|
private int mLayoutDirection = 0;
|
2017-03-29 16:39:24 -07:00
|
|
|
@DoNotStrip
|
|
|
|
private boolean mHasNewLayout = true;
|
2016-10-27 10:52:12 -07:00
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native long jni_YGNodeNew();
|
2016-12-03 04:40:23 -08:00
|
|
|
public YogaNode() {
|
2016-12-03 04:40:18 -08:00
|
|
|
mNativePointer = jni_YGNodeNew();
|
2016-08-04 08:19:59 -07:00
|
|
|
if (mNativePointer == 0) {
|
2016-10-24 10:35:41 -07:00
|
|
|
throw new IllegalStateException("Failed to allocate native memory");
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
private native long jni_YGNodeNewWithConfig(long configPointer);
|
|
|
|
public YogaNode(YogaConfig config) {
|
|
|
|
mNativePointer = jni_YGNodeNewWithConfig(config.mNativePointer);
|
|
|
|
if (mNativePointer == 0) {
|
|
|
|
throw new IllegalStateException("Failed to allocate native memory");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeFree(long nativePointer);
|
2018-01-22 02:48:53 -08:00
|
|
|
@Override
|
2016-10-24 10:35:41 -07:00
|
|
|
protected void finalize() throws Throwable {
|
|
|
|
try {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeFree(mNativePointer);
|
2016-10-24 10:35:41 -07:00
|
|
|
} finally {
|
|
|
|
super.finalize();
|
2016-10-07 05:15:59 -07:00
|
|
|
}
|
2016-10-24 10:35:41 -07:00
|
|
|
}
|
2016-08-04 08:19:59 -07:00
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeReset(long nativePointer);
|
2016-10-24 10:35:41 -07:00
|
|
|
public void reset() {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag = 0;
|
2016-10-26 02:57:07 -07:00
|
|
|
mHasSetPosition = false;
|
2017-03-29 16:39:24 -07:00
|
|
|
mHasNewLayout = true;
|
2016-10-26 07:24:44 -07:00
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
mWidth = YogaConstants.UNDEFINED;
|
|
|
|
mHeight = YogaConstants.UNDEFINED;
|
|
|
|
mTop = YogaConstants.UNDEFINED;
|
|
|
|
mLeft = YogaConstants.UNDEFINED;
|
2017-04-01 04:29:05 -07:00
|
|
|
mMarginLeft = 0;
|
|
|
|
mMarginTop = 0;
|
|
|
|
mMarginRight = 0;
|
|
|
|
mMarginBottom = 0;
|
|
|
|
mPaddingLeft = 0;
|
|
|
|
mPaddingTop = 0;
|
|
|
|
mPaddingRight = 0;
|
|
|
|
mPaddingBottom = 0;
|
|
|
|
mBorderLeft = 0;
|
|
|
|
mBorderTop = 0;
|
|
|
|
mBorderRight = 0;
|
|
|
|
mBorderBottom = 0;
|
2016-10-27 10:52:12 -07:00
|
|
|
mLayoutDirection = 0;
|
|
|
|
|
2016-10-26 07:24:44 -07:00
|
|
|
mMeasureFunction = null;
|
2017-04-25 03:18:15 -07:00
|
|
|
mBaselineFunction = null;
|
2016-10-26 07:24:44 -07:00
|
|
|
mData = null;
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeReset(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getChildCount() {
|
2016-11-07 05:40:11 -08:00
|
|
|
return mChildren == null ? 0 : mChildren.size();
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:23 -08:00
|
|
|
public YogaNode getChildAt(int i) {
|
2016-08-04 08:19:59 -07:00
|
|
|
return mChildren.get(i);
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
2016-12-03 04:40:23 -08:00
|
|
|
public void addChildAt(YogaNode child, int i) {
|
2016-10-07 05:15:59 -07:00
|
|
|
if (child.mParent != null) {
|
|
|
|
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
|
|
|
}
|
2016-08-04 08:19:59 -07:00
|
|
|
|
2016-11-07 05:40:11 -08:00
|
|
|
if (mChildren == null) {
|
|
|
|
mChildren = new ArrayList<>(4);
|
|
|
|
}
|
2016-08-04 08:19:59 -07:00
|
|
|
mChildren.add(i, child);
|
|
|
|
child.mParent = this;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
2016-12-03 04:40:23 -08:00
|
|
|
public YogaNode removeChildAt(int i) {
|
2016-08-04 08:19:59 -07:00
|
|
|
|
2016-12-03 04:40:23 -08:00
|
|
|
final YogaNode child = mChildren.remove(i);
|
2016-08-04 08:19:59 -07:00
|
|
|
child.mParent = null;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeRemoveChild(mNativePointer, child.mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
2018-01-22 02:48:53 -08:00
|
|
|
@Nullable
|
|
|
|
public
|
2016-12-03 04:40:23 -08:00
|
|
|
YogaNode getParent() {
|
2016-08-04 08:19:59 -07:00
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:23 -08:00
|
|
|
public int indexOf(YogaNode child) {
|
2016-11-07 05:40:11 -08:00
|
|
|
return mChildren == null ? -1 : mChildren.indexOf(child);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2017-02-03 11:19:45 -08:00
|
|
|
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
|
|
|
public void calculateLayout(float width, float height) {
|
|
|
|
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasNewLayout() {
|
2017-03-29 16:39:24 -07:00
|
|
|
return mHasNewLayout;
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeMarkDirty(long nativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
public void dirty() {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeMarkDirty(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
public boolean isDirty() {
|
2016-12-03 04:40:18 -08:00
|
|
|
return jni_YGNodeIsDirty(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
2016-12-03 04:40:23 -08:00
|
|
|
public void copyStyle(YogaNode srcNode) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
2016-11-17 09:10:47 -08:00
|
|
|
}
|
|
|
|
|
2017-03-29 16:39:24 -07:00
|
|
|
public void markLayoutSeen() {
|
|
|
|
mHasNewLayout = false;
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaDirection getStyleDirection() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setDirection(YogaDirection direction) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaFlexDirection getFlexDirection() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaJustify getJustifyContent() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setJustifyContent(YogaJustify justifyContent) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaAlign getAlignItems() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setAlignItems(YogaAlign alignItems) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaAlign getAlignSelf() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setAlignSelf(YogaAlign alignSelf) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaAlign getAlignContent() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
2016-08-12 04:17:36 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setAlignContent(YogaAlign alignContent) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
2016-08-12 04:17:36 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaPositionType getPositionType() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setPositionType(YogaPositionType positionType) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setWrap(YogaWrap flexWrap) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaOverflow getOverflow() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setOverflow(YogaOverflow overflow) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2017-02-06 09:31:22 -08:00
|
|
|
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
|
|
|
public YogaDisplay getDisplay() {
|
|
|
|
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
|
|
|
}
|
|
|
|
|
|
|
|
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
|
|
|
public void setDisplay(YogaDisplay display) {
|
|
|
|
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
2016-08-04 08:19:59 -07:00
|
|
|
public void setFlex(float flex) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
2016-08-23 04:36:55 -07:00
|
|
|
public float getFlexGrow() {
|
2016-12-03 04:40:18 -08:00
|
|
|
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
2016-08-23 04:36:55 -07:00
|
|
|
public void setFlexGrow(float flexGrow) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
2016-08-23 04:36:55 -07:00
|
|
|
public float getFlexShrink() {
|
2016-12-03 04:40:18 -08:00
|
|
|
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
2016-08-23 04:36:55 -07:00
|
|
|
public void setFlexShrink(float flexShrink) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
|
|
|
public YogaValue getFlexBasis() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
2016-08-23 04:36:55 -07:00
|
|
|
public void setFlexBasis(float flexBasis) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
2016-08-23 04:36:55 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
|
|
|
public void setFlexBasisPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
|
|
|
public void setFlexBasisAuto() {
|
|
|
|
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
|
|
|
public YogaValue getMargin(YogaEdge edge) {
|
2017-04-01 04:29:05 -07:00
|
|
|
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
2017-02-11 06:19:56 -08:00
|
|
|
return YogaValue.UNDEFINED;
|
2016-10-26 02:57:07 -07:00
|
|
|
}
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setMargin(YogaEdge edge, float margin) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= MARGIN;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
|
|
|
public void setMarginPercent(YogaEdge edge, float percent) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= MARGIN;
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
|
|
|
}
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
|
|
|
public void setMarginAuto(YogaEdge edge) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= MARGIN;
|
2017-02-14 14:26:09 -08:00
|
|
|
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
|
|
|
public YogaValue getPadding(YogaEdge edge) {
|
2017-04-01 04:29:05 -07:00
|
|
|
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
2017-02-11 06:19:56 -08:00
|
|
|
return YogaValue.UNDEFINED;
|
2016-10-26 02:57:07 -07:00
|
|
|
}
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setPadding(YogaEdge edge, float padding) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= PADDING;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
|
|
|
public void setPaddingPercent(YogaEdge edge, float percent) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= PADDING;
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
2016-12-02 05:47:43 -08:00
|
|
|
public float getBorder(YogaEdge edge) {
|
2017-04-01 04:29:05 -07:00
|
|
|
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
2017-02-11 06:19:56 -08:00
|
|
|
return YogaConstants.UNDEFINED;
|
2016-10-26 02:57:07 -07:00
|
|
|
}
|
2016-12-03 04:40:18 -08:00
|
|
|
return jni_YGNodeStyleGetBorder(mNativePointer, edge.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setBorder(YogaEdge edge, float border) {
|
2017-04-01 04:29:05 -07:00
|
|
|
mEdgeSetFlag |= BORDER;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
|
|
|
public YogaValue getPosition(YogaEdge edge) {
|
2016-10-26 02:57:07 -07:00
|
|
|
if (!mHasSetPosition) {
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
return YogaValue.UNDEFINED;
|
2016-10-26 02:57:07 -07:00
|
|
|
}
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
2016-12-02 05:47:43 -08:00
|
|
|
public void setPosition(YogaEdge edge, float position) {
|
2016-10-26 02:57:07 -07:00
|
|
|
mHasSetPosition = true;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
|
|
|
public void setPositionPercent(YogaEdge edge, float percent) {
|
|
|
|
mHasSetPosition = true;
|
|
|
|
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
|
|
|
public YogaValue getWidth() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setWidth(float width) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
|
|
|
public void setWidthPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
private native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
|
|
|
public void setWidthAuto() {
|
|
|
|
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
|
|
|
public YogaValue getHeight() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setHeight(float height) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
|
|
|
public void setHeightPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
private native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
|
|
|
public void setHeightAuto() {
|
|
|
|
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
|
|
|
public YogaValue getMinWidth() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setMinWidth(float minWidth) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
|
|
|
public void setMinWidthPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
|
|
|
public YogaValue getMinHeight() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setMinHeight(float minHeight) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
|
|
|
public void setMinHeightPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
|
|
|
public YogaValue getMaxWidth() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setMaxWidth(float maxWidth) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
|
|
|
public void setMaxWidthPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
|
|
|
public YogaValue getMaxHeight() {
|
|
|
|
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setMaxHeight(float maxheight) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
|
|
|
public void setMaxHeightPercent(float percent) {
|
|
|
|
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
2016-11-29 09:04:43 -08:00
|
|
|
public float getAspectRatio() {
|
2016-12-03 04:40:18 -08:00
|
|
|
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
2016-11-21 10:12:26 -08:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
2016-11-29 09:04:43 -08:00
|
|
|
public void setAspectRatio(float aspectRatio) {
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
2016-11-21 10:12:26 -08:00
|
|
|
}
|
|
|
|
|
2016-08-04 08:19:59 -07:00
|
|
|
public float getLayoutX() {
|
2016-10-27 10:52:12 -07:00
|
|
|
return mLeft;
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public float getLayoutY() {
|
2016-10-27 10:52:12 -07:00
|
|
|
return mTop;
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public float getLayoutWidth() {
|
2016-10-27 10:52:12 -07:00
|
|
|
return mWidth;
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public float getLayoutHeight() {
|
2016-10-27 10:52:12 -07:00
|
|
|
return mHeight;
|
|
|
|
}
|
|
|
|
|
2017-01-15 15:16:10 -08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-05 12:48:10 -08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-11 06:19:52 -08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-02 05:47:43 -08:00
|
|
|
public YogaDirection getLayoutDirection() {
|
2017-02-02 15:27:41 -08:00
|
|
|
return YogaDirection.fromInt(mLayoutDirection);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
2016-12-03 04:40:23 -08:00
|
|
|
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
2016-08-04 08:19:59 -07:00
|
|
|
mMeasureFunction = measureFunction;
|
2016-12-03 04:40:18 -08:00
|
|
|
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2016-11-07 05:59:47 -08:00
|
|
|
// Implementation Note: Why this method needs to stay final
|
|
|
|
//
|
2016-12-03 04:40:23 -08:00
|
|
|
// We cache the jmethodid for this method in Yoga code. This means that even if a subclass
|
2016-11-07 05:59:47 -08:00
|
|
|
// were to override measure, we'd still call this implementation from layout code since the
|
|
|
|
// overriding method will have a different jmethodid. This is final to prevent that mistake.
|
2016-08-04 08:19:59 -07:00
|
|
|
@DoNotStrip
|
2016-11-07 05:59:47 -08:00
|
|
|
public final long measure(float width, int widthMode, float height, int heightMode) {
|
2016-08-04 08:19:59 -07:00
|
|
|
if (!isMeasureDefined()) {
|
|
|
|
throw new RuntimeException("Measure function isn't defined!");
|
|
|
|
}
|
|
|
|
|
2016-10-27 10:52:09 -07:00
|
|
|
return mMeasureFunction.measure(
|
2016-08-04 08:19:59 -07:00
|
|
|
this,
|
|
|
|
width,
|
2017-02-02 15:27:41 -08:00
|
|
|
YogaMeasureMode.fromInt(widthMode),
|
2016-08-04 08:19:59 -07:00
|
|
|
height,
|
2017-02-02 15:27:41 -08:00
|
|
|
YogaMeasureMode.fromInt(heightMode));
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|
|
|
|
|
2017-01-10 07:03:56 -08:00
|
|
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
|
|
|
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
|
|
|
mBaselineFunction = baselineFunction;
|
|
|
|
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@DoNotStrip
|
|
|
|
public final float baseline(float width, float height) {
|
|
|
|
return mBaselineFunction.baseline(this, width, height);
|
|
|
|
}
|
|
|
|
|
2016-08-04 08:19:59 -07:00
|
|
|
public boolean isMeasureDefined() {
|
|
|
|
return mMeasureFunction != null;
|
|
|
|
}
|
|
|
|
|
2016-08-04 08:20:07 -07:00
|
|
|
public void setData(Object data) {
|
|
|
|
mData = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Object getData() {
|
|
|
|
return mData;
|
|
|
|
}
|
2017-04-27 16:19:17 -07:00
|
|
|
|
|
|
|
private native void jni_YGNodePrint(long nativePointer);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use the set logger (defaults to adb log) to print out the styles, children, and computed
|
|
|
|
* layout of the tree rooted at this node.
|
|
|
|
*/
|
|
|
|
public void print() {
|
|
|
|
jni_YGNodePrint(mNativePointer);
|
|
|
|
}
|
2016-08-04 08:19:59 -07:00
|
|
|
}
|