Simplifyling widget inflation and addition flow.

> Removing insert parameter used to select the index of the view.
  ShortcutAndWidgetContainer no longet relies on the index and instead
  uses x and y to refer a particulat view.
> Creating helper methods to easily insert the icon by passing ItemInfo
  directly. LauncherModel.addItemToDatabase synchronously updates the
  ItemInfo with proper postion information. So we can directly use the
  info instead of passing each parameter separately.

 Bug: 32904959

Change-Id: I021c1b818f2f42604b95a6970e06aacc7211292a
This commit is contained in:
Sunny Goyal committed 2016-12-07 13:16:08 -08:00
1 parent 4633be64e8
commit d5462aa31b
4 files changed
+50 -70

No files matched your search

@@ -63,7 +63,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public PendingAppWidgetHostView(Context context, LauncherAppWidgetInfo info,
boolean disabledForSafeMode) {
IconCache cache, boolean disabledForSafeMode) {
super(new ContextThemeWrapper(context, R.style.WidgetContainerTheme));
mLauncher = Launcher.getLauncher(context);
@@ -82,6 +82,10 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
if (Utilities.ATLEAST_LOLLIPOP) {
setElevation(getResources().getDimension(R.dimen.pending_widget_elevation));
}
updateIcon(cache);
updateAppWidget(null);
setOnClickListener(mLauncher);
}
@Override
@@ -117,7 +121,7 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
mDrawableSizeChanged = true;
}
public void updateIcon(IconCache cache) {
private void updateIcon(IconCache cache) {
Bitmap icon = cache.getIcon(mIconLookupIntent, mInfo.user);
if (mIcon == icon) {
return;