Expose print function to java
Summary: Allow printing a node from java Reviewed By: astreet Differential Revision: D4962456 fbshipit-source-id: 8f62ed6724490e621fbc11573b2a9b25c56e51f1
This commit is contained in:
committed by
Facebook Github Bot
parent
77c05b5ff6
commit
83fddd8af6
@@ -667,4 +667,14 @@ public class YogaNode {
|
|||||||
public Object getData() {
|
public Object getData() {
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -223,6 +223,11 @@ void jni_YGNodeReset(alias_ref<jobject> thiz, jlong nativePointer) {
|
|||||||
YGNodeSetPrintFunc(node, YGPrint);
|
YGNodeSetPrintFunc(node, YGPrint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void jni_YGNodePrint(alias_ref<jobject> thiz, jlong nativePointer) {
|
||||||
|
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||||
|
YGNodePrint(node, (YGPrintOptions) (YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren));
|
||||||
|
}
|
||||||
|
|
||||||
void jni_YGNodeInsertChild(alias_ref<jobject>, jlong nativePointer, jlong childPointer, jint index) {
|
void jni_YGNodeInsertChild(alias_ref<jobject>, jlong nativePointer, jlong childPointer, jint index) {
|
||||||
YGNodeInsertChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index);
|
YGNodeInsertChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer), index);
|
||||||
}
|
}
|
||||||
@@ -490,6 +495,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
||||||
YGMakeNativeMethod(jni_YGSetLogger),
|
YGMakeNativeMethod(jni_YGSetLogger),
|
||||||
YGMakeNativeMethod(jni_YGLog),
|
YGMakeNativeMethod(jni_YGLog),
|
||||||
|
YGMakeNativeMethod(jni_YGNodePrint),
|
||||||
});
|
});
|
||||||
registerNatives("com/facebook/yoga/YogaConfig",
|
registerNatives("com/facebook/yoga/YogaConfig",
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user