Fix resize frame for widgets added with tap-to-add button
This change updates the tap-to-add code to wait for the animations between each step (close widget sheet, snap to Workspace page) to finish before continuing with the next step of the flow. Bug: 331425905 Bug: 331699050 Test: manual Flag: ACONFIG com.android.launcher3.enable_widget_tap_to_add TEAMFOOD Change-Id: I774b86b429cd2e8a397e5605243056e6cea666b3
This commit is contained in:
@@ -423,11 +423,16 @@ public class LauncherAccessibilityDelegate extends BaseAccessibilityDelegate<Lau
|
||||
widgetInfo.bindOptions = widgetInfo.getDefaultSizeOptions(mContext);
|
||||
}
|
||||
Workspace<?> workspace = mContext.getWorkspace();
|
||||
workspace.post(
|
||||
() -> workspace.snapToPage(workspace.getPageIndexForScreenId(screenId))
|
||||
);
|
||||
mContext.addPendingItem(info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
|
||||
screenId, coordinates, info.spanX, info.spanY);
|
||||
workspace.post(() -> {
|
||||
workspace.snapToPage(workspace.getPageIndexForScreenId(screenId));
|
||||
workspace.setOnPageTransitionEndCallback(() -> {
|
||||
mContext.addPendingItem(info, LauncherSettings.Favorites.CONTAINER_DESKTOP,
|
||||
screenId, coordinates, info.spanX, info.spanY);
|
||||
if (finishCallback != null) {
|
||||
finishCallback.accept(/* success= */ true);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (item instanceof WorkspaceItemInfo) {
|
||||
WorkspaceItemInfo info = ((WorkspaceItemInfo) item).clone();
|
||||
mContext.getModelWriter().addItemToDatabase(info,
|
||||
|
||||
Reference in New Issue
Block a user