diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/DeviceProfile.java | 22 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 6 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherProvider.java | 2 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index a50540d26..62b05b0d6 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -265,7 +265,7 @@ public class DeviceProfile { if (isTablet) { // Pad the left and right of the workspace to ensure consistent spacing // between all icons - int width = isLandscape ? Math.max(widthPx, heightPx) : Math.min(widthPx, heightPx); + int width = getCurrentWidth(); // XXX: If the icon size changes across orientations, we will have to take // that into account here too. int gap = (int) ((width - 2 * edgeMarginPx - @@ -301,12 +301,8 @@ public class DeviceProfile { // Pad the left and right of the workspace to ensure consistent spacing // between all icons float gapScale = 1f + (dragViewScale - 1f) / 2f; - int width = isLandscape - ? Math.max(widthPx, heightPx) - : Math.min(widthPx, heightPx); - int height = isLandscape - ? Math.max(widthPx, heightPx) - : Math.min(widthPx, heightPx); + int width = getCurrentWidth(); + int height = getCurrentHeight(); int paddingTop = searchBarBounds.bottom; int paddingBottom = hotseatBarHeightPx + pageIndicatorHeightPx; int availableWidth = Math.max(0, width - (int) ((inv.numColumns * cellWidthPx) + @@ -517,4 +513,16 @@ public class DeviceProfile { } } } + + private int getCurrentWidth() { + return isLandscape + ? Math.max(widthPx, heightPx) + : Math.min(widthPx, heightPx); + } + + private int getCurrentHeight() { + return isLandscape + ? Math.min(widthPx, heightPx) + : Math.max(widthPx, heightPx); + } } diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 7414a2204..9d2a890a6 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -1999,7 +1999,7 @@ public class LauncherModel extends BroadcastReceiver "constructing info for partially restored package", true); info = getRestoredItemInfo(c, titleIndex, intent, - promiseType, cursorIconInfo, context); + promiseType, itemType, cursorIconInfo, context); intent = getRestoredItemIntent(c, context, intent); } else { // Don't restore items for other profiles. @@ -3380,7 +3380,7 @@ public class LauncherModel extends BroadcastReceiver * to a package that is not yet installed on the system. */ public ShortcutInfo getRestoredItemInfo(Cursor c, int titleIndex, Intent intent, - int promiseType, CursorIconInfo iconInfo, Context context) { + int promiseType, int itemType, CursorIconInfo iconInfo, Context context) { final ShortcutInfo info = new ShortcutInfo(); info.user = UserHandleCompat.myUserHandle(); @@ -3406,7 +3406,7 @@ public class LauncherModel extends BroadcastReceiver } info.contentDescription = mUserManager.getBadgedLabelForUser(info.title, info.user); - info.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; + info.itemType = itemType; info.promisedIntent = intent; info.status = promiseType; return info; diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java index ee72aea81..cc5e18bc1 100644 --- a/src/com/android/launcher3/LauncherProvider.java +++ b/src/com/android/launcher3/LauncherProvider.java @@ -772,7 +772,7 @@ public class LauncherProvider extends ContentProvider { long id = c.getLong(idIndex); updateStmt.bindLong(1, id); - updateStmt.execute(); + updateStmt.executeUpdateDelete(); } db.setTransactionSuccessful(); } catch (SQLException ex) { |