add UI Manager operations
Reviewed By: achen1 Differential Revision: D5741087 fbshipit-source-id: f6b8f713cb3c4e48b417b47557a45ff9a4a5bf05
This commit is contained in:
parent
e9a090fd9b
commit
672db77eae
|
@ -16,4 +16,9 @@ public class NoopPrinter implements Printer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logMessage(DebugOverlayTag tag, String message) {}
|
public void logMessage(DebugOverlayTag tag, String message) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldDisplayLogMessage(final DebugOverlayTag tag) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ package com.facebook.debug.holder;
|
||||||
|
|
||||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||||
|
|
||||||
/** Interface to pass data to debugging tools. */
|
/** Interface to debugging tool. */
|
||||||
public interface Printer {
|
public interface Printer {
|
||||||
|
|
||||||
void logMessage(final DebugOverlayTag tag, final String message, Object... args);
|
void logMessage(final DebugOverlayTag tag, final String message, Object... args);
|
||||||
|
|
||||||
void logMessage(final DebugOverlayTag tag, final String message);
|
void logMessage(final DebugOverlayTag tag, final String message);
|
||||||
|
boolean shouldDisplayLogMessage(final DebugOverlayTag tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,9 @@ public class ReactDebugOverlayTags {
|
||||||
"Bridge Calls", "JS to Java calls (warning: this is spammy)", Color.MAGENTA);
|
"Bridge Calls", "JS to Java calls (warning: this is spammy)", Color.MAGENTA);
|
||||||
public static final DebugOverlayTag NATIVE_MODULE =
|
public static final DebugOverlayTag NATIVE_MODULE =
|
||||||
new DebugOverlayTag("Native Module", "Native Module init", Color.rgb(0x80, 0x00, 0x80));
|
new DebugOverlayTag("Native Module", "Native Module init", Color.rgb(0x80, 0x00, 0x80));
|
||||||
|
public static final DebugOverlayTag UI_MANAGER =
|
||||||
|
new DebugOverlayTag(
|
||||||
|
"UI Manager",
|
||||||
|
"UI Manager View Operations (requires restart\nwarning: this is spammy)",
|
||||||
|
Color.CYAN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ android_library(
|
||||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||||
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"),
|
||||||
|
react_native_target("java/com/facebook/debug/tags:tags"),
|
||||||
|
react_native_target("java/com/facebook/debug/holder:holder"),
|
||||||
react_native_target("java/com/facebook/react/animation:animation"),
|
react_native_target("java/com/facebook/react/animation:animation"),
|
||||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||||
react_native_target("java/com/facebook/react/common:common"),
|
react_native_target("java/com/facebook/react/common:common"),
|
||||||
|
|
|
@ -15,6 +15,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_M
|
||||||
import android.content.ComponentCallbacks2;
|
import android.content.ComponentCallbacks2;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import com.facebook.common.logging.FLog;
|
import com.facebook.common.logging.FLog;
|
||||||
|
import com.facebook.debug.holder.PrinterHolder;
|
||||||
|
import com.facebook.debug.tags.ReactDebugOverlayTags;
|
||||||
import com.facebook.react.animation.Animation;
|
import com.facebook.react.animation.Animation;
|
||||||
import com.facebook.react.bridge.Callback;
|
import com.facebook.react.bridge.Callback;
|
||||||
import com.facebook.react.bridge.GuardedRunnable;
|
import com.facebook.react.bridge.GuardedRunnable;
|
||||||
|
@ -83,7 +85,8 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
|
|
||||||
protected static final String NAME = "UIManager";
|
protected static final String NAME = "UIManager";
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG =
|
||||||
|
PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.UI_MANAGER);
|
||||||
|
|
||||||
private final EventDispatcher mEventDispatcher;
|
private final EventDispatcher mEventDispatcher;
|
||||||
private final Map<String, Object> mModuleConstants;
|
private final Map<String, Object> mModuleConstants;
|
||||||
|
@ -254,9 +257,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
|
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
FLog.d(
|
String message =
|
||||||
ReactConstants.TAG,
|
"(UIManager.createView) tag: " + tag + ", class: " + className + ", props: " + props;
|
||||||
"(UIManager.createView) tag: " + tag + ", class: " + className + ", props: " + props);
|
FLog.d(ReactConstants.TAG, message);
|
||||||
|
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||||
}
|
}
|
||||||
mUIImplementation.createView(tag, className, rootViewTag, props);
|
mUIImplementation.createView(tag, className, rootViewTag, props);
|
||||||
}
|
}
|
||||||
|
@ -264,9 +268,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void updateView(int tag, String className, ReadableMap props) {
|
public void updateView(int tag, String className, ReadableMap props) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
FLog.d(
|
String message =
|
||||||
ReactConstants.TAG,
|
"(UIManager.updateView) tag: " + tag + ", class: " + className + ", props: " + props;
|
||||||
"(UIManager.updateView) tag: " + tag + ", class: " + className + ", props: " + props);
|
FLog.d(ReactConstants.TAG, message);
|
||||||
|
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||||
}
|
}
|
||||||
mUIImplementation.updateView(tag, className, props);
|
mUIImplementation.updateView(tag, className, props);
|
||||||
}
|
}
|
||||||
|
@ -291,14 +296,21 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
@Nullable ReadableArray addAtIndices,
|
@Nullable ReadableArray addAtIndices,
|
||||||
@Nullable ReadableArray removeFrom) {
|
@Nullable ReadableArray removeFrom) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
FLog.d(
|
String message =
|
||||||
ReactConstants.TAG,
|
"(UIManager.manageChildren) tag: "
|
||||||
"(UIManager.manageChildren) tag: " + viewTag +
|
+ viewTag
|
||||||
", moveFrom: " + moveFrom +
|
+ ", moveFrom: "
|
||||||
", moveTo: " + moveTo +
|
+ moveFrom
|
||||||
", addTags: " + addChildTags +
|
+ ", moveTo: "
|
||||||
", atIndices: " + addAtIndices +
|
+ moveTo
|
||||||
", removeFrom: " + removeFrom);
|
+ ", addTags: "
|
||||||
|
+ addChildTags
|
||||||
|
+ ", atIndices: "
|
||||||
|
+ addAtIndices
|
||||||
|
+ ", removeFrom: "
|
||||||
|
+ removeFrom;
|
||||||
|
FLog.d(ReactConstants.TAG, message);
|
||||||
|
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||||
}
|
}
|
||||||
mUIImplementation.manageChildren(
|
mUIImplementation.manageChildren(
|
||||||
viewTag,
|
viewTag,
|
||||||
|
@ -321,9 +333,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||||
int viewTag,
|
int viewTag,
|
||||||
ReadableArray childrenTags) {
|
ReadableArray childrenTags) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
FLog.d(
|
String message = "(UIManager.setChildren) tag: " + viewTag + ", children: " + childrenTags;
|
||||||
ReactConstants.TAG,
|
FLog.d(ReactConstants.TAG, message);
|
||||||
"(UIManager.setChildren) tag: " + viewTag + ", children: " + childrenTags);
|
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||||
}
|
}
|
||||||
mUIImplementation.setChildren(viewTag, childrenTags);
|
mUIImplementation.setChildren(viewTag, childrenTags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue