Add support for show layout bounds.

Summary: Supports show layout bounds either by override within FlatViewGroup, or if show layout bounds is set in settings.  Currently requires app restart to disable.

Reviewed By: ahmedre

Differential Revision: D3553669
This commit is contained in:
Seth Kirby
2016-07-19 01:59:34 -07:00
committed by Ahmed El-Helw
parent 76c2904d31
commit 7df627f9be
4 changed files with 219 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
package com.facebook.react.flat;
import android.graphics.Canvas;
import android.graphics.Color;
/**
* Base class for all DrawCommands. Becomes immutable once it has its bounds set. Until then, a
@@ -40,6 +41,26 @@ import android.graphics.Canvas;
}
}
protected static int getDebugBorderColor() {
return Color.CYAN;
}
protected String getDebugName() {
return getClass().getSimpleName().substring(4);
}
@Override
public void debugDraw(FlatViewGroup parent, Canvas canvas) {
parent.debugDrawNamedRect(
canvas,
getDebugBorderColor(),
getDebugName(),
mLeft,
mTop,
mRight,
mBottom);
}
protected void onPreDraw(FlatViewGroup parent, Canvas canvas) {
}