mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Merge "Fix taskbar drag view scale when returning to original icon" into tm-qpr-dev am: 3d1bb16493
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21533764 Change-Id: I04cbb24dc071677a8e6f5c4fa8981efc5bec6d34 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -340,7 +340,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
if (DEBUG_DRAG_SHADOW_SURFACE) {
|
||||
canvas.drawColor(0xffff0000);
|
||||
}
|
||||
float scale = mDragObject.dragView.getScaleX();
|
||||
float scale = mDragObject.dragView.getEndScale();
|
||||
canvas.scale(scale, scale);
|
||||
mDragObject.dragView.draw(canvas);
|
||||
canvas.restore();
|
||||
@@ -601,7 +601,15 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
View target = findTaskbarTargetForIconView(originalView);
|
||||
|
||||
int[] toPosition = target.getLocationOnScreen();
|
||||
float toScale = (float) target.getWidth() / mDragIconSize;
|
||||
float iconSize = target.getWidth();
|
||||
if (target instanceof BubbleTextView) {
|
||||
Rect bounds = new Rect();
|
||||
((BubbleTextView) target).getSourceVisualDragBounds(bounds);
|
||||
toPosition[0] += bounds.left;
|
||||
toPosition[1] += bounds.top;
|
||||
iconSize = bounds.width();
|
||||
}
|
||||
float toScale = iconSize / mDragIconSize;
|
||||
float toAlpha = (target == originalView) ? 1f : 0f;
|
||||
MultiValueUpdateListener listener = new MultiValueUpdateListener() {
|
||||
final FloatProp mDx = new FloatProp(fromX, toPosition[0], 0,
|
||||
|
||||
@@ -83,6 +83,7 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
|
||||
protected final int mRegistrationX;
|
||||
protected final int mRegistrationY;
|
||||
private final float mInitialScale;
|
||||
private final float mEndScale;
|
||||
protected final float mScaleOnDrop;
|
||||
protected final int[] mTempLoc = new int[2];
|
||||
|
||||
@@ -158,7 +159,7 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
|
||||
setClipToPadding(false);
|
||||
}
|
||||
|
||||
final float scale = (width + finalScaleDps) / width;
|
||||
mEndScale = (width + finalScaleDps) / width;
|
||||
|
||||
// Set the initial scale to avoid any jumps
|
||||
setScaleX(initialScale);
|
||||
@@ -169,8 +170,8 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
|
||||
mAnim.setDuration(VIEW_ZOOM_DURATION);
|
||||
mAnim.addUpdateListener(animation -> {
|
||||
final float value = (Float) animation.getAnimatedValue();
|
||||
setScaleX(initialScale + (value * (scale - initialScale)));
|
||||
setScaleY(initialScale + (value * (scale - initialScale)));
|
||||
setScaleX(Utilities.mapRange(value, initialScale, mEndScale));
|
||||
setScaleY(Utilities.mapRange(value, initialScale, mEndScale));
|
||||
if (!isAttachedToWindow()) {
|
||||
animation.cancel();
|
||||
}
|
||||
@@ -508,6 +509,10 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram
|
||||
return mInitialScale;
|
||||
}
|
||||
|
||||
public float getEndScale() {
|
||||
return mEndScale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user