Refactoring to ensure item deletion always removes from the DB.

- Routing the various places where we call through to delete from
  LauncherModel through Launcher, which will delegate the removal
  of the icon from the workspace, and properly handle the removal
  of all items and their contents from the db.

Bug: 23944119

Change-Id: I022fe2b3e79da16b5af87505c4362490b8422686
This commit is contained in:
Winson
2015-09-09 16:38:15 -07:00
parent 01251b0dc4
commit c0b52fefbc
6 changed files with 75 additions and 67 deletions
+5 -8
View File
@@ -1118,9 +1118,9 @@ public class Workspace extends PagedView
LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag();
LauncherAppWidgetHostView lahv = (LauncherAppWidgetHostView) info.hostView;
if (lahv != null && lahv.isReinflateRequired()) {
mLauncher.removeAppWidget(info);
// Remove the current widget which is inflated with the wrong orientation
cl.removeView(lahv);
// Remove and rebind the current widget (which was inflated in the wrong
// orientation), but don't delete it from the database
mLauncher.removeItem(lahv, info, false /* deleteFromDb */);
mLauncher.bindAppWidget(info);
}
}
@@ -4519,12 +4519,9 @@ public class Workspace extends PagedView
for (LauncherAppWidgetInfo info : mInfos) {
if (info.hostView instanceof PendingAppWidgetHostView) {
// Remove and rebind the current widget, but don't delete it from the database
PendingAppWidgetHostView view = (PendingAppWidgetHostView) info.hostView;
mLauncher.removeAppWidget(info);
CellLayout cl = (CellLayout) view.getParent().getParent();
// Remove the current widget
cl.removeView(view);
mLauncher.removeItem(view, info, false /* deleteFromDb */);
mLauncher.bindAppWidget(info);
}
}