Rewrite: Widget preview loader logic

> Widget previews are saved in data dir instead of cache dir
> Expiring widget previews similar to IconCache
> Removed support for setting thread priorities

Bug: 19865031
Change-Id: Ib6033c2b1ff8ae61bba8762ca994ccd8217d3c75
This commit is contained in:
Sunny Goyal
2015-03-19 14:31:19 -07:00
parent 71c3baf5eb
commit 5b0e669169
15 changed files with 535 additions and 1474 deletions

View File

@@ -366,13 +366,12 @@ public class Workspace extends SmoothPagedView
// estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each
// dimension if unsuccessful
public int[] estimateItemSize(int hSpan, int vSpan,
ItemInfo itemInfo, boolean springLoaded) {
public int[] estimateItemSize(ItemInfo itemInfo, boolean springLoaded) {
int[] size = new int[2];
if (getChildCount() > 0) {
// Use the first non-custom page to estimate the child position
CellLayout cl = (CellLayout) getChildAt(numCustomPages());
Rect r = estimateItemPosition(cl, itemInfo, 0, 0, hSpan, vSpan);
Rect r = estimateItemPosition(cl, itemInfo, 0, 0, itemInfo.spanX, itemInfo.spanY);
size[0] = r.width();
size[1] = r.height();
if (springLoaded) {
@@ -2065,7 +2064,7 @@ public class Workspace extends SmoothPagedView
}
public void onDragStartedWithItem(PendingAddItemInfo info, Bitmap b, boolean clipAlpha) {
int[] size = estimateItemSize(info.spanX, info.spanY, info, false);
int[] size = estimateItemSize(info, false);
// The outline is used to visualize where the item will land if dropped
mDragOutline = createDragOutline(b, DRAG_BITMAP_PADDING, size[0], size[1], clipAlpha);
@@ -4032,8 +4031,7 @@ public class Workspace extends SmoothPagedView
}
public Bitmap createWidgetBitmap(ItemInfo widgetInfo, View layout) {
int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(widgetInfo.spanX,
widgetInfo.spanY, widgetInfo, false);
int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(widgetInfo, false);
int visibility = layout.getVisibility();
layout.setVisibility(VISIBLE);