mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Merge "Only set drag shadow params if they are valid" into udc-dev am: 2e1ce4c72f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23249924 Change-Id: I12fff3774bb7dce43768a0408ac7a9ebde542016 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.DragEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -87,6 +88,7 @@ import java.util.function.Predicate;
|
||||
*/
|
||||
public class TaskbarDragController extends DragController<BaseTaskbarContext> implements
|
||||
TaskbarControllers.LoggableTaskbarController {
|
||||
private static final String TAG = "TaskbarDragController";
|
||||
|
||||
private static final boolean DEBUG_DRAG_SHADOW_SURFACE = false;
|
||||
private static final int ANIM_DURATION_RETURN_ICON_TO_TASKBAR = 300;
|
||||
@@ -318,12 +320,26 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
@Override
|
||||
public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {
|
||||
int iconSize = Math.max(mDragIconSize, btv.getWidth());
|
||||
shadowSize.set(iconSize, iconSize);
|
||||
if (iconSize > 0) {
|
||||
shadowSize.set(iconSize, iconSize);
|
||||
} else {
|
||||
Log.d(TAG, "Invalid icon size, dragSize=" + mDragIconSize
|
||||
+ " viewWidth=" + btv.getWidth());
|
||||
}
|
||||
|
||||
// The registration point was taken before the icon scaled to mDragIconSize, so
|
||||
// offset the registration to where the touch is on the new size.
|
||||
int offsetX = (mDragIconSize - mDragObject.dragView.getDragRegionWidth()) / 2;
|
||||
int offsetY = (mDragIconSize - mDragObject.dragView.getDragRegionHeight()) / 2;
|
||||
shadowTouchPoint.set(mRegistrationX + offsetX, mRegistrationY + offsetY);
|
||||
int touchX = mRegistrationX + offsetX;
|
||||
int touchY = mRegistrationY + offsetY;
|
||||
if (touchX >= 0 && touchY >= 0) {
|
||||
shadowTouchPoint.set(touchX, touchY);
|
||||
} else {
|
||||
Log.d(TAG, "Invalid touch point, "
|
||||
+ "registrationXY=(" + mRegistrationX + ", " + mRegistrationY + ") "
|
||||
+ "offsetXY=(" + offsetX + ", " + offsetY + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user