Scale icons from search to make app icons big like AA -> workspace

when dragging from search.

To scale the icon during dragging (instead of long press) I created a scale variable within DragOptions
so that right before dragStart gets called in DragController.java (in callOnDragStart())
the dragview scales before dragging..
 * note: the scale from search is 1.687 and the scale from allApps is 1.107
- included searchResult and smallSearchResult
- Added animation for scaling icon (used Interpolators.EMPHASIZED 500ms as suggested by motion designer)
- Cancel animation when drag finishes

bug: 222666176
test: Manual - after: https://drive.google.com/file/d/1ZZHnXlzdTxlM-RUIdJ6EOYkPPg6tCUxC/view?usp=sharing
before: https://drive.google.com/file/d/1NpBz3kT_slHXtpXObr_G8K6SZYG9_bLX/view?usp=sharing

Change-Id: I01309a3be928987ba00422ad947b80a3df865973
This commit is contained in:
Brandon Dayauon
2022-08-29 11:48:27 -07:00
parent e2791f0cf6
commit d3755f46cc
4 changed files with 36 additions and 4 deletions

View File

@@ -106,6 +106,7 @@ import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.WallpaperOffsetInterpolator;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.widget.LauncherAppWidgetHost;
import com.android.launcher3.widget.LauncherAppWidgetHost.ProviderChangedListener;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
@@ -152,6 +153,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
public static final int DEFAULT_PAGE = 0;
private final int mAllAppsIconSize;
private LayoutTransition mLayoutTransition;
@Thunk final WallpaperManager mWallpaperManager;
@@ -286,7 +289,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
mLauncher = Launcher.getLauncher(context);
mStateTransitionAnimation = new WorkspaceStateTransitionAnimation(mLauncher, this);
mWallpaperManager = WallpaperManager.getInstance(context);
mAllAppsIconSize = mLauncher.getDeviceProfile().allAppsIconSizePx;
mWallpaperOffset = new WallpaperOffsetInterpolator(this);
setHapticFeedbackEnabled(false);
@@ -1671,8 +1674,14 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
mDragSourceInternal = (ShortcutAndWidgetContainer) child.getParent();
}
if (child instanceof BubbleTextView && !dragOptions.isAccessibleDrag) {
dragOptions.preDragCondition = ((BubbleTextView) child).startLongPressAction();
if (child instanceof BubbleTextView) {
BubbleTextView btv = (BubbleTextView) child;
if (!dragOptions.isAccessibleDrag) {
dragOptions.preDragCondition = btv.startLongPressAction();
}
if (btv.isDisplaySearchResult()) {
dragOptions.preDragEndScale = (float) mAllAppsIconSize / btv.getIconSize();
}
}
final DragView dv;