Widget preview improvements

- Make widget preview bitmaps as small as they can be, saving ~0.7-2MB peak memory (5104303)
- When adding/dragging a widget, make the drag outline/drag view much more closely match the actual size (5566938)

Change-Id: I5b5b7b84fa551d56432a76223b1a9e4de620ff56
This commit is contained in:
Michael Jurka
2011-11-03 13:50:45 -07:00
parent fd99e7776a
commit 038f9d8bfb
5 changed files with 171 additions and 113 deletions

View File

@@ -30,6 +30,7 @@ public class PagedViewGridLayout extends GridLayout implements Page {
private int mCellCountX;
private int mCellCountY;
private Runnable mOnLayoutListener;
public PagedViewGridLayout(Context context, int cellCountX, int cellCountY) {
super(context, null, 0);
@@ -57,6 +58,17 @@ public class PagedViewGridLayout extends GridLayout implements Page {
heightMeasureSpec);
}
public void setOnLayoutListener(Runnable r) {
mOnLayoutListener = r;
}
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (mOnLayoutListener != null) {
mOnLayoutListener.run();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean result = super.onTouchEvent(event);