Updating how widget previews look

Also fixing issue where some widget previews would
be way too large when picked up

Bug: 6472013

Change-Id: Iebfc33b1070da591a9d1d32d7c8e65a3fb057a7e
This commit is contained in:
Michael Jurka
2012-05-18 15:04:49 -07:00
parent a4ac83cc3b
commit dac8591072
18 changed files with 286 additions and 111 deletions

View File

@@ -17,6 +17,8 @@
package com.android.launcher2;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Insets;
import android.util.AttributeSet;
import android.widget.ImageView;
@@ -34,4 +36,22 @@ class PagedViewWidgetImageView extends ImageView {
super.requestLayout();
}
}
@Override
protected void onDraw(Canvas canvas) {
Insets insets = Insets.NONE;
if (getBackground() != null) {
insets = getBackground().getLayoutInsets();
}
canvas.save();
canvas.clipRect(getScrollX() + getPaddingLeft() + insets.left,
getScrollY() + getPaddingTop() + insets.top,
getScrollX() + getRight() - getLeft() - getPaddingRight() - insets.right,
getScrollY() + getBottom() - getTop() - getPaddingBottom() - insets.bottom);
super.onDraw(canvas);
canvas.restore();
}
}