WidgetTray improvement

UI
- Fixing the issue of widget row not rendering
- Moved the resetting of previous bitmap to the start of onBind
instead of the onDetachedWindow.

Performance
- WidgetModel do not have to keep packageName list around.

Will com in immediate follow up CLs
- use lowRes widgets bitmap before fully loading the fullRes one.
- application icons are fully loaded in background thread.

b/19897708

Change-Id: I5b3b43a5c543a5135c395f90df32e66d57dc86e0
This commit is contained in:
Hyunyoung Song
2015-04-11 15:44:32 -07:00
parent d9760ee2de
commit 4e8fb91cf1
6 changed files with 49 additions and 66 deletions

View File

@@ -47,7 +47,7 @@ import com.android.launcher3.compat.AppWidgetManagerCompat;
*/
public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private static final String TAG = "PagedViewWidget";
private static final String TAG = "WidgetCell";
private static final boolean DEBUG = false;
// Temporary preset width and height of the image to keep them aligned.
@@ -120,7 +120,16 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
Log.d(TAG, String.format("[tag=%s] onDetachedFromWindow", getTagToString()));
}
super.onDetachedFromWindow();
deletePreview(true);
deletePreview(false);
}
public void reset() {
ImageView image = (ImageView) findViewById(R.id.widget_preview);
final TextView name = (TextView) findViewById(R.id.widget_name);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
image.setImageDrawable(null);
name.setText(null);
dims.setText(null);
}
public void deletePreview(boolean recycleImage) {