DebugOverlayViewpublic class DebugOverlayView extends android.widget.FrameLayout implements SeekBar.OnSeekBarChangeListenerA full screen overlay layer that allows us to draw views from throughout the system on the top
most layer. |
Fields Summary |
---|
static final int | sCornerRectSize | com.android.systemui.recents.RecentsConfiguration | mConfig | DebugOverlayViewCallbacks | mCb | ArrayList | mRects | String | mText | android.graphics.Paint | mDebugOutline | android.graphics.Paint | mTmpPaint | android.graphics.Rect | mTmpRect | boolean | mEnabled | android.widget.SeekBar | mPrimarySeekBar | android.widget.SeekBar | mSecondarySeekBar |
Constructors Summary |
---|
public DebugOverlayView(android.content.Context context)
this(context, null);
| public DebugOverlayView(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, 0);
| public DebugOverlayView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
| public DebugOverlayView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
mDebugOutline.setColor(0xFFff0000);
mDebugOutline.setStyle(Paint.Style.STROKE);
mDebugOutline.setStrokeWidth(8f);
setWillNotDraw(false);
|
Methods Summary |
---|
void | addRect(android.graphics.Rect r, int color)Adds a rect to be drawn.
mRects.add(new Pair<Rect, Integer>(r, color));
invalidate();
| void | addRectRelativeToView(android.view.View v, android.graphics.Rect r, int color)Adds a rect, relative to a given view to be drawn.
Rect vr = new Rect();
v.getGlobalVisibleRect(vr);
r.offsetTo(vr.left, vr.top);
mRects.add(new Pair<Rect, Integer>(r, color));
invalidate();
| void | addViewRect(android.view.View v, int color)Adds a view's global rect to be drawn.
Rect vr = new Rect();
v.getGlobalVisibleRect(vr);
mRects.add(new Pair<Rect, Integer>(vr, color));
invalidate();
| public void | clear()Clears all debug rects.
mRects.clear();
| public void | disable()Disables the debug overlay drawing.
mEnabled = false;
setVisibility(View.GONE);
| public void | enable()Enables the debug overlay drawing.
mEnabled = true;
setVisibility(View.VISIBLE);
| protected void | onDraw(android.graphics.Canvas canvas)
if (mEnabled) {
// Draw the outline
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), mDebugOutline);
// Draw the rects
int numRects = mRects.size();
for (int i = 0; i < numRects; i++) {
Pair<Rect, Integer> r = mRects.get(i);
mTmpPaint.setColor(r.second);
canvas.drawRect(r.first, mTmpPaint);
}
// Draw the text
if (mText != null && mText.length() > 0) {
mTmpPaint.setColor(0xFFff0000);
mTmpPaint.setTextSize(60);
mTmpPaint.getTextBounds(mText, 0, 1, mTmpRect);
canvas.drawText(mText, 10f, getMeasuredHeight() - mTmpRect.height() - mConfig.systemInsets.bottom, mTmpPaint);
}
}
| protected void | onFinishInflate()
mPrimarySeekBar = (SeekBar) findViewById(R.id.debug_seek_bar_1);
mPrimarySeekBar.setOnSeekBarChangeListener(this);
mSecondarySeekBar = (SeekBar) findViewById(R.id.debug_seek_bar_2);
mSecondarySeekBar.setOnSeekBarChangeListener(this);
| protected void | onMeasure(int widthMeasureSpec, int heightMeasureSpec)
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
addRect(new Rect(0, 0, sCornerRectSize, sCornerRectSize), 0xFFff0000);
addRect(new Rect(getMeasuredWidth() - sCornerRectSize, getMeasuredHeight() - sCornerRectSize,
getMeasuredWidth(), getMeasuredHeight()), 0xFFff0000);
| public void | onProgressChanged(android.widget.SeekBar seekBar, int progress, boolean fromUser)
if (seekBar == mPrimarySeekBar) {
mCb.onPrimarySeekBarChanged((float) progress / mPrimarySeekBar.getMax());
} else if (seekBar == mSecondarySeekBar) {
mCb.onSecondarySeekBarChanged((float) progress / mSecondarySeekBar.getMax());
}
| public void | onStartTrackingTouch(android.widget.SeekBar seekBar)
// Do nothing
| public void | onStopTrackingTouch(android.widget.SeekBar seekBar)SeekBar.OnSeekBarChangeListener Implementation
// Do nothing
| public void | setCallbacks(com.android.systemui.recents.views.DebugOverlayView$DebugOverlayViewCallbacks cb)
mCb = cb;
| void | setText(java.lang.String message)Sets the debug text at the bottom of the screen.
mText = message;
invalidate();
|
|