Loading src/com/android/launcher3/CellLayout.java +2 −3 Original line number Diff line number Diff line Loading @@ -1018,8 +1018,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { cellToRect(cellX, cellY, spanX, spanY, r); if (v instanceof LauncherAppWidgetHostView) { DeviceProfile profile = mLauncher.getDeviceProfile(); Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } } else { // Find the top left corner of the rect the object will occupy Loading Loading @@ -1059,7 +1058,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { r.set(left, top, left + dragOutline.getWidth(), top + dragOutline.getHeight()); } Utilities.shrinkRectAboutCenter(r, mChildScale, mChildScale); Utilities.scaleRectAboutCenter(r, mChildScale); mDragOutlineAnims[mDragOutlineCurrent].setTag(dragOutline); mDragOutlineAnims[mDragOutlineCurrent].animateIn(); Loading src/com/android/launcher3/Utilities.java +16 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,22 @@ public final class Utilities { return delta; } public static float shrinkRectAboutCenter(Rect r, float scaleX, float scaleY) { public static void scaleRectAboutCenter(Rect r, float scale) { if (scale != 1.0f) { int cx = r.centerX(); int cy = r.centerY(); r.offset(-cx, -cy); r.left = (int) (r.left * scale + 0.5f); r.top = (int) (r.top * scale + 0.5f); r.right = (int) (r.right * scale + 0.5f); r.bottom = (int) (r.bottom * scale + 0.5f); r.offset(cx, cy); } } public static float shrinkRect(Rect r, float scaleX, float scaleY) { float scale = Math.min(Math.min(scaleX, scaleY), 1.0f); if (scale < 1.0f) { int deltaX = (int) (r.width() * (scaleX - scale) * 0.5f); Loading src/com/android/launcher3/Workspace.java +2 −3 Original line number Diff line number Diff line Loading @@ -399,8 +399,7 @@ public class Workspace extends PagedView float scale = 1; if (isWidget) { DeviceProfile profile = mLauncher.getDeviceProfile(); scale = Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); scale = Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } size[0] = r.width(); size[1] = r.height(); Loading Loading @@ -3475,7 +3474,7 @@ public class Workspace extends PagedView Rect r = estimateItemPosition(layout, targetCell[0], targetCell[1], spanX, spanY); if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET) { DeviceProfile profile = mLauncher.getDeviceProfile(); Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } loc[0] = r.left; loc[1] = r.top; Loading Loading
src/com/android/launcher3/CellLayout.java +2 −3 Original line number Diff line number Diff line Loading @@ -1018,8 +1018,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { cellToRect(cellX, cellY, spanX, spanY, r); if (v instanceof LauncherAppWidgetHostView) { DeviceProfile profile = mLauncher.getDeviceProfile(); Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } } else { // Find the top left corner of the rect the object will occupy Loading Loading @@ -1059,7 +1058,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { r.set(left, top, left + dragOutline.getWidth(), top + dragOutline.getHeight()); } Utilities.shrinkRectAboutCenter(r, mChildScale, mChildScale); Utilities.scaleRectAboutCenter(r, mChildScale); mDragOutlineAnims[mDragOutlineCurrent].setTag(dragOutline); mDragOutlineAnims[mDragOutlineCurrent].animateIn(); Loading
src/com/android/launcher3/Utilities.java +16 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,22 @@ public final class Utilities { return delta; } public static float shrinkRectAboutCenter(Rect r, float scaleX, float scaleY) { public static void scaleRectAboutCenter(Rect r, float scale) { if (scale != 1.0f) { int cx = r.centerX(); int cy = r.centerY(); r.offset(-cx, -cy); r.left = (int) (r.left * scale + 0.5f); r.top = (int) (r.top * scale + 0.5f); r.right = (int) (r.right * scale + 0.5f); r.bottom = (int) (r.bottom * scale + 0.5f); r.offset(cx, cy); } } public static float shrinkRect(Rect r, float scaleX, float scaleY) { float scale = Math.min(Math.min(scaleX, scaleY), 1.0f); if (scale < 1.0f) { int deltaX = (int) (r.width() * (scaleX - scale) * 0.5f); Loading
src/com/android/launcher3/Workspace.java +2 −3 Original line number Diff line number Diff line Loading @@ -399,8 +399,7 @@ public class Workspace extends PagedView float scale = 1; if (isWidget) { DeviceProfile profile = mLauncher.getDeviceProfile(); scale = Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); scale = Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } size[0] = r.width(); size[1] = r.height(); Loading Loading @@ -3475,7 +3474,7 @@ public class Workspace extends PagedView Rect r = estimateItemPosition(layout, targetCell[0], targetCell[1], spanX, spanY); if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET) { DeviceProfile profile = mLauncher.getDeviceProfile(); Utilities.shrinkRectAboutCenter(r, profile.appWidgetScale.x, profile.appWidgetScale.y); Utilities.shrinkRect(r, profile.appWidgetScale.x, profile.appWidgetScale.y); } loc[0] = r.left; loc[1] = r.top; Loading