diff options
author | Michael Jurka <mikejurka@google.com> | 2011-01-25 22:41:40 -0800 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-01-25 22:42:27 -0800 |
commit | f12c75cb48f87955600c56ccbe0aac84b0c11b28 (patch) | |
tree | 43932592576b117bd089f48777740ed345e7ff10 /src/com/android/launcher2/CustomizePagedView.java | |
parent | 878aaca1fee925805e4fc210317540bb5ef933ae (diff) | |
download | android_packages_apps_Trebuchet-f12c75cb48f87955600c56ccbe0aac84b0c11b28.tar.gz android_packages_apps_Trebuchet-f12c75cb48f87955600c56ccbe0aac84b0c11b28.tar.bz2 android_packages_apps_Trebuchet-f12c75cb48f87955600c56ccbe0aac84b0c11b28.zip |
Improve feedback during spring loaded mode
- Uniformly scale the outlines of items on the screens to match the correct grid size as closely as possible
- Fix bug with drag + drop that was reporting dragged items' height wrong
- Remove unused code
Diffstat (limited to 'src/com/android/launcher2/CustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index c74e5f42e..e934efa9c 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -479,8 +479,9 @@ public class CustomizePagedView extends PagedViewWithDraggableItems } } - Bitmap drawableToBitmap(Drawable d, View v) { - Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); + Bitmap drawableToBitmap(Drawable d, View v, boolean clipHeight) { + int height = clipHeight ? v.getPaddingTop() + d.getIntrinsicHeight() : v.getHeight(); + Bitmap b = Bitmap.createBitmap(v.getWidth(), height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); c.translate((v.getWidth() - d.getIntrinsicWidth()) / 2, v.getPaddingTop()); d.draw(c); @@ -508,8 +509,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems // Get the widget preview as the drag representation final LinearLayout l = (LinearLayout) v; final ImageView i = (ImageView) l.findViewById(R.id.widget_preview); - final Drawable icon = i.getDrawable(); - Bitmap b = drawableToBitmap(icon, i); + Bitmap b = drawableToBitmap(i.getDrawable(), i, true); PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) v.getTag(); int[] spanXY = CellLayout.rectToCell( @@ -529,7 +529,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems // get icon (top compound drawable, index is 1) final TextView tv = (TextView) v; final Drawable icon = tv.getCompoundDrawables()[1]; - Bitmap b = drawableToBitmap(icon, tv); + Bitmap b = drawableToBitmap(icon, tv, false); PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag(); mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b); @@ -546,7 +546,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems // get icon (top compound drawable, index is 1) final TextView tv = (TextView) v; final Drawable icon = tv.getCompoundDrawables()[1]; - Bitmap b = drawableToBitmap(icon, tv); + Bitmap b = drawableToBitmap(icon, tv, false); ApplicationInfo app = (ApplicationInfo) v.getTag(); app = new ApplicationInfo(app); |