Commit eecf02da authored by Winson Chung's avatar Winson Chung
Browse files

Fixing some issues/regressions related to scaled icons.

- Fixes issue with folder icons being clipped in landscape in sw720dp (Bug: 6118397)
- Fixes issue with divider being in wrong orientation in sw720dp
- Fixes issue with scaled icons not being drawn with filtering
- Fixes issue with side pages showing under the hotseat when in landscape in phone UI
- Animates the drag view on pick up and drop

Change-Id: Iad26427ec63fcbc9bdb3b29a4645689ba445d5c8
parent 633f1aad
res/drawable-sw720dp-land-hdpi/divider_launcher_holo.9.png

199 Bytes

res/drawable-sw720dp-land-mdpi/divider_launcher_holo.9.png

1.05 KB

...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<dimen name="workspace_bottom_padding">0dp</dimen> <dimen name="workspace_bottom_padding">0dp</dimen>
<!-- We really want the page spacing to be the max of either the button bar <!-- We really want the page spacing to be the max of either the button bar
height or the qsb bar height --> height or the qsb bar height -->
<dimen name="workspace_page_spacing">@dimen/button_bar_height</dimen> <dimen name="workspace_page_spacing">-1dp</dimen>
<dimen name="workspace_divider_padding_left">0dp</dimen> <dimen name="workspace_divider_padding_left">0dp</dimen>
<dimen name="workspace_divider_padding_right">0dp</dimen> <dimen name="workspace_divider_padding_right">0dp</dimen>
<dimen name="workspace_divider_padding_top">12dp</dimen> <dimen name="workspace_divider_padding_top">12dp</dimen>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<!-- Hotseat --> <!-- Hotseat -->
<dimen name="hotseat_cell_width">75dp</dimen> <dimen name="hotseat_cell_width">75dp</dimen>
<dimen name="hotseat_cell_height">85dp</dimen> <dimen name="hotseat_cell_height">75dp</dimen>
<!-- Workspace --> <!-- Workspace -->
<dimen name="workspace_cell_width">96dp</dimen> <dimen name="workspace_cell_width">96dp</dimen>
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
<dimen name="workspace_cell_width">96dip</dimen> <dimen name="workspace_cell_width">96dip</dimen>
<dimen name="workspace_cell_height">96dip</dimen> <dimen name="workspace_cell_height">96dip</dimen>
<dimen name="folder_cell_width">96dp</dimen>
<dimen name="folder_cell_height">96dp</dimen>
<!-- AppsCustomize --> <!-- AppsCustomize -->
<integer name="apps_customize_maxCellCountX">-1</integer> <integer name="apps_customize_maxCellCountX">-1</integer>
<integer name="apps_customize_maxCellCountY">-1</integer> <integer name="apps_customize_maxCellCountY">-1</integer>
...@@ -49,5 +52,5 @@ ...@@ -49,5 +52,5 @@
<!-- When dragging items on the workspace, the number of dps by which the position of <!-- When dragging items on the workspace, the number of dps by which the position of
the drag view should be offset from the position of the original view. --> the drag view should be offset from the position of the original view. -->
<dimen name="dragViewOffsetX">0dp</dimen> <dimen name="dragViewOffsetX">0dp</dimen>
<dimen name="dragViewOffsetY">-12dp</dimen> <dimen name="dragViewOffsetY">0dp</dimen>
</resources> </resources>
...@@ -102,10 +102,10 @@ ...@@ -102,10 +102,10 @@
<!-- When dragging items on the workspace, the number of dps by which the position of <!-- When dragging items on the workspace, the number of dps by which the position of
the drag view should be offset from the position of the original view. --> the drag view should be offset from the position of the original view. -->
<dimen name="dragViewOffsetX">0dp</dimen> <dimen name="dragViewOffsetX">0dp</dimen>
<dimen name="dragViewOffsetY">-8dp</dimen> <dimen name="dragViewOffsetY">0dp</dimen>
<!-- When dragging an item, how much bigger (fixed dps) the dragged view <!-- When dragging an item, how much bigger (fixed dps) the dragged view
should be. If 0, it will not be scaled at all. --> should be. If 0, it will not be scaled at all. -->
<dimen name="dragViewScale">8dp</dimen> <dimen name="dragViewScale">12dp</dimen>
<!-- Padding applied to AppWidgets --> <!-- Padding applied to AppWidgets -->
<dimen name="app_widget_preview_padding_left">8dp</dimen> <dimen name="app_widget_preview_padding_left">8dp</dimen>
......
...@@ -47,8 +47,6 @@ public class BubbleTextView extends TextView { ...@@ -47,8 +47,6 @@ public class BubbleTextView extends TextView {
static final float PADDING_H = 8.0f; static final float PADDING_H = 8.0f;
static final float PADDING_V = 3.0f; static final float PADDING_V = 3.0f;
private Paint mPaint;
private float mBubbleColorAlpha;
private int mPrevAlpha = -1; private int mPrevAlpha = -1;
private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper(); private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
...@@ -88,9 +86,6 @@ public class BubbleTextView extends TextView { ...@@ -88,9 +86,6 @@ public class BubbleTextView extends TextView {
final Resources res = getContext().getResources(); final Resources res = getContext().getResources();
int bubbleColor = res.getColor(R.color.bubble_dark_background); int bubbleColor = res.getColor(R.color.bubble_dark_background);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(bubbleColor);
mBubbleColorAlpha = Color.alpha(bubbleColor) / 255.0f;
mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor = mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor =
res.getColor(android.R.color.holo_blue_light); res.getColor(android.R.color.holo_blue_light);
...@@ -178,7 +173,8 @@ public class BubbleTextView extends TextView { ...@@ -178,7 +173,8 @@ public class BubbleTextView extends TextView {
// The translate of scrollX and scrollY is necessary when drawing TextViews, because // The translate of scrollX and scrollY is necessary when drawing TextViews, because
// they set scrollX and scrollY to large values to achieve centered text // they set scrollX and scrollY to large values to achieve centered text
destCanvas.save(); destCanvas.save();
destCanvas.scale(getScaleX(), getScaleY(), getWidth() / 2, getHeight() / 2); destCanvas.scale(getScaleX(), getScaleY(),
(getWidth() + padding) / 2, (getHeight() + padding) / 2);
destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2); destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE); destCanvas.clipRect(clipRect, Op.REPLACE);
draw(destCanvas); draw(destCanvas);
...@@ -328,7 +324,6 @@ public class BubbleTextView extends TextView { ...@@ -328,7 +324,6 @@ public class BubbleTextView extends TextView {
protected boolean onSetAlpha(int alpha) { protected boolean onSetAlpha(int alpha) {
if (mPrevAlpha != alpha) { if (mPrevAlpha != alpha) {
mPrevAlpha = alpha; mPrevAlpha = alpha;
mPaint.setAlpha((int) (alpha * mBubbleColorAlpha));
super.onSetAlpha(alpha); super.onSetAlpha(alpha);
} }
return true; return true;
......
...@@ -137,8 +137,8 @@ public class CellLayout extends ViewGroup { ...@@ -137,8 +137,8 @@ public class CellLayout extends ViewGroup {
private CellLayoutChildren mChildren; private CellLayoutChildren mChildren;
private boolean mIsHotseat = false; private boolean mIsHotseat = false;
private final int mBubbleScalePercent; private float mChildScale = 1f;
private final int mBubbleHotseatScalePercent; private float mHotseatChildScale = 1f;
public CellLayout(Context context) { public CellLayout(Context context) {
this(context, null); this(context, null);
...@@ -185,8 +185,14 @@ public class CellLayout extends ViewGroup { ...@@ -185,8 +185,14 @@ public class CellLayout extends ViewGroup {
mNormalBackground.setFilterBitmap(true); mNormalBackground.setFilterBitmap(true);
mActiveGlowBackground.setFilterBitmap(true); mActiveGlowBackground.setFilterBitmap(true);
mBubbleScalePercent = res.getInteger(R.integer.app_icon_scale_percent); int iconScale = res.getInteger(R.integer.app_icon_scale_percent);
mBubbleHotseatScalePercent = res.getInteger(R.integer.app_icon_hotseat_scale_percent); if (iconScale >= 0) {
mChildScale = iconScale / 100f;
}
int hotseatIconScale = res.getInteger(R.integer.app_icon_hotseat_scale_percent);
if (hotseatIconScale >= 0) {
mHotseatChildScale = hotseatIconScale / 100f;
}
// Initialize the data structures used for the drag visualization. // Initialize the data structures used for the drag visualization.
...@@ -497,25 +503,6 @@ public class CellLayout extends ViewGroup { ...@@ -497,25 +503,6 @@ public class CellLayout extends ViewGroup {
@Override @Override
protected void dispatchDraw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) {
// Debug drawing for hit space
if (false) {
final Rect frame = mRect;
for (int i = mChildren.getChildCount() - 1; i >= 0; i--) {
final View child = mChildren.getChildAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
if ((child.getVisibility() == VISIBLE || child.getAnimation() != null) &&
lp.isLockedToGrid) {
child.getHitRect(frame);
frame.offset(mPaddingLeft, mPaddingTop);
Paint p = new Paint();
p.setColor(Color.GREEN);
canvas.drawRect(frame, p);
}
}
}
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
if (mForegroundAlpha > 0) { if (mForegroundAlpha > 0) {
mOverScrollForegroundDrawable.setBounds(mForegroundRect); mOverScrollForegroundDrawable.setBounds(mForegroundRect);
...@@ -582,12 +569,16 @@ public class CellLayout extends ViewGroup { ...@@ -582,12 +569,16 @@ public class CellLayout extends ViewGroup {
mIsHotseat = isHotseat; mIsHotseat = isHotseat;
} }
public float getChildrenScale() {
return mIsHotseat ? mHotseatChildScale : mChildScale;
}
public boolean addViewToCellLayout( public boolean addViewToCellLayout(
View child, int index, int childId, LayoutParams params, boolean markCells) { View child, int index, int childId, LayoutParams params, boolean markCells) {
return addViewToCellLayout(child, index, childId, params, markCells, false); return addViewToCellLayout(child, index, childId, params, markCells, false);
} }
private void scaleChild(BubbleTextView bubbleChild, float pivot, int scalePercent) { private void scaleChild(BubbleTextView bubbleChild, float pivot, float scale) {
// If we haven't measured the child yet, do it now // If we haven't measured the child yet, do it now
// (this happens if we're being dropped from all-apps // (this happens if we're being dropped from all-apps
if (bubbleChild.getLayoutParams() instanceof LayoutParams && if (bubbleChild.getLayoutParams() instanceof LayoutParams &&
...@@ -597,20 +588,13 @@ public class CellLayout extends ViewGroup { ...@@ -597,20 +588,13 @@ public class CellLayout extends ViewGroup {
int measuredWidth = bubbleChild.getMeasuredWidth(); int measuredWidth = bubbleChild.getMeasuredWidth();
int measuredHeight = bubbleChild.getMeasuredHeight(); int measuredHeight = bubbleChild.getMeasuredHeight();
float scale = scalePercent / 100f;
bubbleChild.setPivotX(pivot);
bubbleChild.setPivotY(pivot);
bubbleChild.setScaleX(scale); bubbleChild.setScaleX(scale);
bubbleChild.setScaleY(scale); bubbleChild.setScaleY(scale);
bubbleChild.setTranslationX(measuredWidth * (1 - scale) / 2);
bubbleChild.setTranslationY(measuredHeight * (1 - scale) / 2);
} }
private void resetChild(BubbleTextView bubbleChild) { private void resetChild(BubbleTextView bubbleChild) {
bubbleChild.setScaleX(1f); bubbleChild.setScaleX(1f);
bubbleChild.setScaleY(1f); bubbleChild.setScaleY(1f);
bubbleChild.setTranslationX(0f);
bubbleChild.setTranslationY(0f);
bubbleChild.setTextColor(getResources().getColor(R.color.workspace_icon_text_color)); bubbleChild.setTextColor(getResources().getColor(R.color.workspace_icon_text_color));
} }
...@@ -629,14 +613,14 @@ public class CellLayout extends ViewGroup { ...@@ -629,14 +613,14 @@ public class CellLayout extends ViewGroup {
// Start the child with 100% scale and visible text // Start the child with 100% scale and visible text
resetChild(bubbleChild); resetChild(bubbleChild);
if (mIsHotseat && !allApps && mBubbleHotseatScalePercent >= 0) { if (mIsHotseat && !allApps && mHotseatChildScale >= 0) {
// Scale/make transparent for a hotseat // Scale/make transparent for a hotseat
scaleChild(bubbleChild, 0f, mBubbleHotseatScalePercent); scaleChild(bubbleChild, 0f, mHotseatChildScale);
bubbleChild.setTextColor(getResources().getColor(android.R.color.transparent)); bubbleChild.setTextColor(getResources().getColor(android.R.color.transparent));
} else if (mBubbleScalePercent >= 0) { } else if (mChildScale >= 0) {
// Else possibly still scale it if we need to for smaller icons // Else possibly still scale it if we need to for smaller icons
scaleChild(bubbleChild, 0f, mBubbleScalePercent); scaleChild(bubbleChild, 0f, mChildScale);
} }
} }
...@@ -727,7 +711,7 @@ public class CellLayout extends ViewGroup { ...@@ -727,7 +711,7 @@ public class CellLayout extends ViewGroup {
public void setTagToCellInfoForPoint(int touchX, int touchY) { public void setTagToCellInfoForPoint(int touchX, int touchY) {
final CellInfo cellInfo = mCellInfo; final CellInfo cellInfo = mCellInfo;
final Rect frame = mRect; Rect frame = mRect;
final int x = touchX + mScrollX; final int x = touchX + mScrollX;
final int y = touchY + mScrollY; final int y = touchY + mScrollY;
final int count = mChildren.getChildCount(); final int count = mChildren.getChildCount();
...@@ -741,10 +725,15 @@ public class CellLayout extends ViewGroup { ...@@ -741,10 +725,15 @@ public class CellLayout extends ViewGroup {
lp.isLockedToGrid) { lp.isLockedToGrid) {
child.getHitRect(frame); child.getHitRect(frame);
float scale = child.getScaleX();
frame = new Rect(child.getLeft(), child.getTop(), child.getRight(),
child.getBottom());
// The child hit rect is relative to the CellLayoutChildren parent, so we need to // The child hit rect is relative to the CellLayoutChildren parent, so we need to
// offset that by this CellLayout's padding to test an (x,y) point that is relative // offset that by this CellLayout's padding to test an (x,y) point that is relative
// to this view. // to this view.
frame.offset(mPaddingLeft, mPaddingTop); frame.offset(mPaddingLeft, mPaddingTop);
frame.inset((int) (frame.width() * (1f - scale) / 2),
(int) (frame.height() * (1f - scale) / 2));
if (frame.contains(x, y)) { if (frame.contains(x, y)) {
cellInfo.cell = child; cellInfo.cell = child;
...@@ -791,6 +780,7 @@ public class CellLayout extends ViewGroup { ...@@ -791,6 +780,7 @@ public class CellLayout extends ViewGroup {
if (action == MotionEvent.ACTION_DOWN) { if (action == MotionEvent.ACTION_DOWN) {
setTagToCellInfoForPoint((int) ev.getX(), (int) ev.getY()); setTagToCellInfoForPoint((int) ev.getX(), (int) ev.getY());
} }
return false; return false;
} }
...@@ -1978,8 +1968,8 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) { ...@@ -1978,8 +1968,8 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
leftMargin - rightMargin; leftMargin - rightMargin;
height = myCellVSpan * cellHeight + ((myCellVSpan - 1) * heightGap) - height = myCellVSpan * cellHeight + ((myCellVSpan - 1) * heightGap) -
topMargin - bottomMargin; topMargin - bottomMargin;
x = myCellX * (cellWidth + widthGap) + leftMargin; x = (int) (myCellX * (cellWidth + widthGap) + leftMargin);
y = myCellY * (cellHeight + heightGap) + topMargin; y = (int) (myCellY * (cellHeight + heightGap) + topMargin);
} }
} }
......
...@@ -18,10 +18,14 @@ package com.android.launcher2; ...@@ -18,10 +18,14 @@ package com.android.launcher2;
import android.app.WallpaperManager; import android.app.WallpaperManager;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect; import android.graphics.Rect;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.android.launcher2.CellLayout.LayoutParams;
public class CellLayoutChildren extends ViewGroup { public class CellLayoutChildren extends ViewGroup {
static final String TAG = "CellLayoutChildren"; static final String TAG = "CellLayoutChildren";
...@@ -67,6 +71,22 @@ public class CellLayoutChildren extends ViewGroup { ...@@ -67,6 +71,22 @@ public class CellLayoutChildren extends ViewGroup {
return null; return null;
} }
@Override
protected void dispatchDraw(Canvas canvas) {
// Debug drawing for hit space
if (false) {
Paint p = new Paint();
p.setColor(0x6600FF00);
for (int i = getChildCount() - 1; i >= 0; i--) {
final View child = getChildAt(i);
final CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
canvas.drawRect(lp.x, lp.y, lp.x + lp.width, lp.y + lp.height, p);
}
}
super.dispatchDraw(canvas);
}
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int count = getChildCount(); int count = getChildCount();
......
...@@ -433,8 +433,10 @@ public class DragLayer extends FrameLayout { ...@@ -433,8 +433,10 @@ public class DragLayer extends FrameLayout {
public void animateViewIntoPosition(DragView dragView, final View child, int duration, public void animateViewIntoPosition(DragView dragView, final View child, int duration,
final Runnable onFinishAnimationRunnable, View anchorView) { final Runnable onFinishAnimationRunnable, View anchorView) {
((CellLayoutChildren) child.getParent()).measureChild(child); CellLayoutChildren parentChildren = (CellLayoutChildren) child.getParent();
CellLayout parent = (CellLayout) (CellLayout) parentChildren.getParent();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
parentChildren.measureChild(child);
Rect r = new Rect(); Rect r = new Rect();
getViewRectRelativeToSelf(dragView, r); getViewRectRelativeToSelf(dragView, r);
...@@ -442,20 +444,25 @@ public class DragLayer extends FrameLayout { ...@@ -442,20 +444,25 @@ public class DragLayer extends FrameLayout {
int coord[] = new int[2]; int coord[] = new int[2];
coord[0] = lp.x; coord[0] = lp.x;
coord[1] = lp.y; coord[1] = lp.y;
// Since the child hasn't necessarily been laid out, we force the lp to be updated with // Since the child hasn't necessarily been laid out, we force the lp to be updated with
// the correct coordinates (above) and use these to determine the final location // the correct coordinates (above) and use these to determine the final location
float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord); float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord);
int toX = coord[0]; int toX = coord[0];
int toY = coord[1]; int toY = coord[1];
if (child instanceof TextView) { if (child instanceof TextView) {
float childrenScale = parent.getChildrenScale();
TextView tv = (TextView) child; TextView tv = (TextView) child;
Drawable d = tv.getCompoundDrawables()[1];
// Center in the y coordinate about the target's drawable // The child may be scaled (always about the center of the view) so to account for it,
toY += Math.round(scale * tv.getPaddingTop()); // we have to offset the position by the scaled size. Once we do that, we can center
toY -= (dragView.getHeight() - (int) Math.round(scale * d.getIntrinsicHeight())) / 2; // the drag view about the scaled child view.
// Center in the x coordinate about the target's drawable toY += Math.round(((1f - childrenScale) * child.getMeasuredHeight()) / 2 +
scale * childrenScale * tv.getPaddingTop());
toY -= dragView.getMeasuredHeight() * (1 - scale * childrenScale) / 2;
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2; toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
scale *= childrenScale;
} else if (child instanceof FolderIcon) { } else if (child instanceof FolderIcon) {
// Account for holographic blur padding on the drag view // Account for holographic blur padding on the drag view
toY -= Workspace.DRAG_BITMAP_PADDING / 2; toY -= Workspace.DRAG_BITMAP_PADDING / 2;
......
...@@ -162,7 +162,7 @@ public class DragView extends View { ...@@ -162,7 +162,7 @@ public class DragView extends View {
// for debugging // for debugging
Paint p = new Paint(); Paint p = new Paint();
p.setStyle(Paint.Style.FILL); p.setStyle(Paint.Style.FILL);
p.setColor(0xaaffffff); p.setColor(0x66ffffff);
canvas.drawRect(0, 0, getWidth(), getHeight(), p); canvas.drawRect(0, 0, getWidth(), getHeight(), p);
} }
......
...@@ -29,7 +29,7 @@ class FastBitmapDrawable extends Drawable { ...@@ -29,7 +29,7 @@ class FastBitmapDrawable extends Drawable {
private int mAlpha; private int mAlpha;
private int mWidth; private int mWidth;
private int mHeight; private int mHeight;
private final Paint mPaint = new Paint(); private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
FastBitmapDrawable(Bitmap b) { FastBitmapDrawable(Bitmap b) {
mAlpha = 255; mAlpha = 255;
......
...@@ -2015,6 +2015,7 @@ public final class Launcher extends Activity ...@@ -2015,6 +2015,7 @@ public final class Launcher extends Activity
} }
public boolean onLongClick(View v) { public boolean onLongClick(View v) {
if (mState != State.WORKSPACE) { if (mState != State.WORKSPACE) {
return false; return false;
} }
......
...@@ -580,7 +580,14 @@ public abstract class PagedView extends ViewGroup { ...@@ -580,7 +580,14 @@ public abstract class PagedView extends ViewGroup {
// Calculate the variable page spacing if necessary // Calculate the variable page spacing if necessary
if (mPageSpacing < 0) { if (mPageSpacing < 0) {
setPageSpacing(((right - left) - getChildAt(0).getMeasuredWidth()) / 2); // The gap between pages in the PagedView should be equal to the gap from the page
// to the edge of the screen (so it is not visible in the current screen). To
// account for unequal padding on each side of the paged view, we take the maximum
// of the left/right gap and use that as the gap between each page.
int offset = getRelativeChildOffset(0);
int spacing = Math.max(offset, (right - left) - offset -
getChildAt(0).getMeasuredWidth());
setPageSpacing(spacing);
} }
} }
......
...@@ -1902,10 +1902,14 @@ public class Workspace extends SmoothPagedView ...@@ -1902,10 +1902,14 @@ public class Workspace extends SmoothPagedView
final Bitmap b = createDragBitmap(child, new Canvas(), DRAG_BITMAP_PADDING); final Bitmap b = createDragBitmap(child, new Canvas(), DRAG_BITMAP_PADDING);
final int bmpWidth = b.getWidth(); final int bmpWidth = b.getWidth();
final int bmpHeight = b.getHeight();
mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY); mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY);
final int dragLayerX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2; int dragLayerX =
int dragLayerY = mTempXY[1] - DRAG_BITMAP_PADDING / 2; Math.round(mTempXY[0] - (bmpWidth - child.getScaleX() * child.getWidth()) / 2);
int dragLayerY =
Math.round(mTempXY[1] - (bmpHeight - child.getScaleY() * bmpHeight) / 2
- DRAG_BITMAP_PADDING / 2);
Point dragVisualizeOffset = null; Point dragVisualizeOffset = null;
Rect dragRect = null; Rect dragRect = null;
...@@ -1934,7 +1938,7 @@ public class Workspace extends SmoothPagedView ...@@ -1934,7 +1938,7 @@ public class Workspace extends SmoothPagedView
} }
mDragController.startDrag(b, dragLayerX, dragLayerY, source, child.getTag(), mDragController.startDrag(b, dragLayerX, dragLayerY, source, child.getTag(),
DragController.DRAG_ACTION_MOVE, dragVisualizeOffset, dragRect, 1f); DragController.DRAG_ACTION_MOVE, dragVisualizeOffset, dragRect, child.getScaleX());
b.recycle(); b.recycle();
// Show the scrolling indicator when you pick up an item // Show the scrolling indicator when you pick up an item
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment