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
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index 93626f0..01d7593 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -30,6 +30,7 @@
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 @@
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);