diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-09-26 19:29:58 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-09-26 19:29:58 +0000 |
commit | ecee887d1a43a12253f51a689eeac19a9c5a1f89 (patch) | |
tree | 785b3c269e27cb36a7da4216ffe5d2746a4e9405 | |
parent | 5ba1fc93c411d9197ade1bab2a171d31f1c91c3e (diff) | |
parent | 45812a9ed6b75427b3076907bc8717472cd238b2 (diff) | |
download | packages_apps_Trebuchet-ecee887d1a43a12253f51a689eeac19a9c5a1f89.tar.gz packages_apps_Trebuchet-ecee887d1a43a12253f51a689eeac19a9c5a1f89.tar.bz2 packages_apps_Trebuchet-ecee887d1a43a12253f51a689eeac19a9c5a1f89.zip |
Merge "Drag and drop preview size for BubbleTextView" into ub-launcher3-qt-future-dev
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/dragndrop/DragLayer.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/graphics/DragPreviewProvider.java | 7 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 1cb15db98..223cd7d89 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1493,7 +1493,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator> Rect dragRect = null; if (child instanceof BubbleTextView) { dragRect = new Rect(); - ((BubbleTextView) child).getIconBounds(dragRect); + BubbleTextView.getIconBounds(child, dragRect, grid.iconSizePx); dragLayerY += dragRect.top; // Note: The dragRect is used to calculate drag layer offsets, but the // dragVisualizeOffset in addition to the dragRect (the size) to position the outline. diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index b59164ae0..cdc70611d 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -284,7 +284,8 @@ public class DragLayer extends BaseDragLayer<Launcher> { // The child may be scaled (always about the center of the view) so to account for it, // we have to offset the position by the scaled size. Once we do that, we can center // the drag view about the scaled child view. - toY += Math.round(toScale * tv.getPaddingTop()); + // padding will remain constant (does not scale with size) + toY += tv.getPaddingTop(); toY -= dragView.getMeasuredHeight() * (1 - toScale) / 2; if (dragView.getDragVisualizeOffset() != null) { toY -= Math.round(toScale * dragView.getDragVisualizeOffset().y); diff --git a/src/com/android/launcher3/graphics/DragPreviewProvider.java b/src/com/android/launcher3/graphics/DragPreviewProvider.java index 747efe307..f57945197 100644 --- a/src/com/android/launcher3/graphics/DragPreviewProvider.java +++ b/src/com/android/launcher3/graphics/DragPreviewProvider.java @@ -195,15 +195,22 @@ public class DragPreviewProvider { private final Bitmap mPreviewSnapshot; private final Context mContext; + private final boolean mIsIcon; OutlineGeneratorCallback(Bitmap preview) { mPreviewSnapshot = preview; mContext = mView.getContext(); + mIsIcon = mView instanceof BubbleTextView; } @Override public void run() { Bitmap preview = convertPreviewToAlphaBitmap(mPreviewSnapshot); + if (mIsIcon) { + int size = Launcher.getLauncher(mContext).getDeviceProfile().iconSizePx; + preview = Bitmap.createScaledBitmap(preview, size, size, false); + } + //else case covers AppWidgetHost (doesn't drag/drop across different device profiles) // We start by removing most of the alpha channel so as to ignore shadows, and // other types of partial transparency when defining the shape of the object |