Lines Matching refs:item
254 for (ItemInfo item : tmpWorkspaceItems) {
255 item.unbind();
257 for (ItemInfo item : tmpAppWidgets) {
258 item.unbind();
266 * Adds an item to the DB if it was not created previously, or move it to a new
269 static void addOrMoveItemInDatabase(Context context, ItemInfo item, long container,
271 if (item.container == ItemInfo.NO_ID) {
273 addItemToDatabase(context, item, container, screen, cellX, cellY, false);
276 moveItemInDatabase(context, item, container, screen, cellX, cellY);
281 final long itemId, final ItemInfo item, StackTraceElement[] stackTrace) {
283 if (modelItem != null && item != modelItem) {
285 if (modelItem instanceof ShortcutInfo && item instanceof ShortcutInfo) {
287 ShortcutInfo shortcut = (ShortcutInfo) item;
308 // the modelItem needs to match up perfectly with item if our model is
310 // modelItem == item or the equality check above
311 String msg = "item: " + ((item != null) ? item.toString() : "null") +
323 static void checkItemInfo(final ItemInfo item) {
325 final long itemId = item.id;
329 checkItemInfoLocked(itemId, item, stackTrace);
337 final ItemInfo item, final String callingFunction) {
338 final long itemId = item.id;
349 checkItemInfoLocked(itemId, item, stackTrace);
351 if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP &&
352 item.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
353 // Item is in a folder, make sure this folder exists
354 if (!sBgFolders.containsKey(item.container)) {
355 // An items container is being set to a that of an item which is not in
357 String msg = "item: " + item + " container being set to: " +
358 item.container + ", not in the list of folders";
420 * Move an item in the DB to a new <container, screen, cellX, cellY>
422 static void moveItemInDatabase(Context context, final ItemInfo item, final long container,
424 String transaction = "DbDebug Modify item (" + item.title + ") in db, id: " + item.id +
425 " (" + item.container + ", " + item.screen + ", " + item.cellX + ", " + item.cellY +
429 item.container = container;
430 item.cellX = cellX;
431 item.cellY = cellY;
437 item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY);
439 item.screen = screen;
443 values.put(LauncherSettings.Favorites.CONTAINER, item.container);
444 values.put(LauncherSettings.Favorites.CELLX, item.cellX);
445 values.put(LauncherSettings.Favorites.CELLY, item.cellY);
446 values.put(LauncherSettings.Favorites.SCREEN, item.screen);
448 updateItemInDatabaseHelper(context, values, item, "moveItemInDatabase");
452 * Move and/or resize item in the DB to a new <container, screen, cellX, cellY, spanX, spanY>
454 static void modifyItemInDatabase(Context context, final ItemInfo item, final long container,
456 String transaction = "DbDebug Modify item (" + item.title + ") in db, id: " + item.id +
457 " (" + item.container + ", " + item.screen + ", " + item.cellX + ", " + item.cellY +
461 item.cellX = cellX;
462 item.cellY = cellY;
463 item.spanX = spanX;
464 item.spanY = spanY;
470 item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY);
472 item.screen = screen;
476 values.put(LauncherSettings.Favorites.CONTAINER, item.container);
477 values.put(LauncherSettings.Favorites.CELLX, item.cellX);
478 values.put(LauncherSettings.Favorites.CELLY, item.cellY);
479 values.put(LauncherSettings.Favorites.SPANX, item.spanX);
480 values.put(LauncherSettings.Favorites.SPANY, item.spanY);
481 values.put(LauncherSettings.Favorites.SCREEN, item.screen);
483 updateItemInDatabaseHelper(context, values, item, "modifyItemInDatabase");
487 * Update an item to the database in a specified container.
489 static void updateItemInDatabase(Context context, final ItemInfo item) {
491 item.onAddToDatabase(context, values);
492 item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
493 updateItemInDatabaseHelper(context, values, item, "updateItemInDatabase");
539 ItemInfo item = new ItemInfo();
540 item.cellX = c.getInt(cellXIndex);
541 item.cellY = c.getInt(cellYIndex);
542 item.spanX = c.getInt(spanXIndex);
543 item.spanY = c.getInt(spanYIndex);
544 item.container = c.getInt(containerIndex);
545 item.itemType = c.getInt(itemTypeIndex);
546 item.screen = c.getInt(screenIndex);
548 item.user = um.getUserForSerialNumber(serialNumber);
549 // If the user no longer exists, skip this item
550 if (item.user != null) {
551 items.add(item);
606 * Add an item to the database in a specified container. Sets the container, screen, cellX and
607 * cellY fields of the item. Also assigns an ID to the item.
609 static void addItemToDatabase(Context context, final ItemInfo item, final long container,
611 item.container = container;
612 item.cellX = cellX;
613 item.cellY = cellY;
618 item.screen = ((Launcher) context).getHotseat().getOrderInHotseat(cellX, cellY);
620 item.screen = screen;
625 item.onAddToDatabase(context, values);
628 item.id = app.getLauncherProvider().generateNewId();
629 values.put(LauncherSettings.Favorites._ID, item.id);
630 item.updateValuesWithCoordinates(values, item.cellX, item.cellY);
635 String transaction = "DbDebug Add item (" + item.title + ") to db, id: "
636 + item.id + " (" + container + ", " + screen + ", " + cellX + ", "
646 checkItemInfoLocked(item.id, item, stackTrace);
647 sBgItemsIdMap.put(item.id, item);
648 switch (item.itemType) {
650 sBgFolders.put(item.id, (FolderInfo) item);
654 if (item.container == LauncherSettings.Favorites.CONTAINER_DESKTOP ||
655 item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
656 sBgWorkspaceItems.add(item);
658 if (!sBgFolders.containsKey(item.container)) {
659 // Adding an item to a folder that doesn't exist.
660 String msg = "adding item: " + item + " to a folder that " +
668 sBgAppWidgets.add((LauncherAppWidgetInfo) item);
704 * Removes the specified item from the database
706 * @param item
708 static void deleteItemFromDatabase(Context context, final ItemInfo item) {
710 final Uri uriToDelete = LauncherSettings.Favorites.getContentUri(item.id, false);
714 String transaction = "DbDebug Delete item (" + item.title + ") from db, id: "
715 + item.id + " (" + item.container + ", " + item.screen + ", " + item.cellX +
716 ", " + item.cellY + ")";
724 switch (item.itemType) {
726 item.id);
728 if (info.container == item.id) {
731 String msg = "deleting a folder (" + item + ") which still " +
737 sBgWorkspaceItems.remove(item);
741 sBgWorkspaceItems.remove(item);
744 sBgAppWidgets.remove((LauncherAppWidgetInfo) item);
747 sBgItemsIdMap.remove(item.id);
748 sBgDbIconCache.remove(item);
1220 private boolean checkItemPlacement(ItemInfo occupied[][][], ItemInfo item) {
1221 int containerIndex = item.screen;
1222 if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
1223 // Return early if we detect that an item is under the hotseat button
1224 if (mCallbacks == null || mCallbacks.get().isAllAppsButtonRank(item.screen)) {
1230 if (occupied[Launcher.SCREEN_COUNT][item.screen][0] != null) {
1231 Log.e(TAG, "Error loading shortcut into hotseat " + item
1232 + " into position (" + item.screen + ":" + item.cellX + "," + item.cellY
1233 + ") occupied by " + occupied[Launcher.SCREEN_COUNT][item.screen][0]);
1236 occupied[Launcher.SCREEN_COUNT][item.screen][0] = item;
1239 } else if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
1245 for (int x = item.cellX; x < (item.cellX+item.spanX); x++) {
1246 for (int y = item.cellY; y < (item.cellY+item.spanY); y++) {
1248 Log.e(TAG, "Error loading shortcut " + item
1249 + " into cell (" + containerIndex + "-" + item.screen + ":"
1257 for (int x = item.cellX; x < (item.cellX+item.spanX); x++) {
1258 for (int y = item.cellY; y < (item.cellY+item.spanY); y++) {
1259 occupied[containerIndex][x][y] = item;
1403 // Item is in a user folder