Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7826bf52 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implements LAUNCHER_ITEM_DROP_FOLDER_CREATED event." into ub-launcher3-rvc-dev

parents ac327df5 5a01f0ec
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ message ItemInfo {
    Task task = 2;
    Shortcut shortcut = 3;
    Widget widget = 4;
    FolderIcon folder_icon = 9;
  }
  // When used for launch event, stores the global predictive rank
  optional int32 rank = 5;
@@ -92,6 +93,11 @@ message Task {
  optional int32 index = 3;
}

// Represents folder in a closed state.
message FolderIcon {
  optional int32 cardinality = 1;
}

//////////////////////////////////////////////
// Containers

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public interface DropTarget {
        public DraggableView originalView = null;

        /** Used for matching DROP event with its corresponding DRAG event on the server side. */
        final InstanceId mLogInstanceId =
        public final InstanceId logInstanceId =
                new InstanceIdSequence(1 << 20 /*InstanceId.INSTANCE_ID_MAX*/)
                    .newInstanceId();

+22 −7
Original line number Diff line number Diff line
@@ -416,8 +416,12 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
        mLauncher.getStateManager().goToState(SPRING_LOADED);
        mStatsLogManager.log(
                LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
                dragObject.mLogInstanceId,
                dragObject.originalDragInfo.buildProto(null));
                dragObject.logInstanceId,
                dragObject.originalDragInfo.buildProto(
                    dragObject.dragSource instanceof Folder
                        ? ((Folder) dragObject.dragSource).mInfo
                        : null)
        );
    }

    public void deferRemoveExtraEmptyScreen() {
@@ -1645,7 +1649,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
            Rect folderLocation = new Rect();
            float scale = mLauncher.getDragLayer().getDescendantRectRelativeToSelf(v, folderLocation);
            target.removeView(v);

            mStatsLogManager.log(
                    LauncherEvent.LAUNCHER_ITEM_DROP_FOLDER_CREATED,
                    d.logInstanceId,
                    destInfo.buildProto(null));
            FolderIcon fi = mLauncher.addFolder(target, container, screenId, targetCell[0],
                    targetCell[1]);
            destInfo.cellX = -1;
@@ -1683,6 +1690,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
        if (dropOverView instanceof FolderIcon) {
            FolderIcon fi = (FolderIcon) dropOverView;
            if (fi.acceptDrop(d.dragInfo)) {
                mStatsLogManager.log(
                        LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                        d.logInstanceId,
                        fi.mInfo.buildProto(null));
                fi.onDrop(d, false /* itemReturnedOnFailedDrop */);

                // if the drag started here, we need to remove it from the workspace
@@ -1885,15 +1896,15 @@ public class Workspace extends PagedView<WorkspacePageIndicator>

            mLauncher.getStateManager().goToState(
                    NORMAL, SPRING_LOADED_EXIT_DELAY, onCompleteRunnable);
            mStatsLogManager.log(
                    LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                    d.logInstanceId,
                    d.dragInfo.buildProto(null));
        }

        if (d.stateAnnouncer != null && !droppedOnOriginalCell) {
            d.stateAnnouncer.completeAction(R.string.item_moved);
        }
        mStatsLogManager.log(
                LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                d.mLogInstanceId,
                d.dragInfo.buildProto(null));
    }

    public void onNoCellFound(View dropTargetLayout) {
@@ -2515,6 +2526,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                resetTransitionTransform();
            }
        }
        mStatsLogManager.log(
                LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                d.logInstanceId,
                d.dragInfo.buildProto(null));
    }

    public Bitmap createWidgetBitmap(ItemInfo widgetInfo, View layout) {
+1 −2
Original line number Diff line number Diff line
@@ -186,8 +186,7 @@ public class DragController implements DragDriver.EventListener, TouchController

        mDragObject.dragSource = source;
        mDragObject.dragInfo = dragInfo;
        mDragObject.originalDragInfo = new ItemInfo();
        mDragObject.originalDragInfo.copyFrom(dragInfo);
        mDragObject.originalDragInfo = mDragObject.dragInfo.makeShallowCopy();

        if (dragOffset != null) {
            dragView.setDragVisualizeOffset(new Point(dragOffset));
+5 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragController.DragListener;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.FolderInfo.FolderListener;
@@ -1346,6 +1347,10 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        if (d.stateAnnouncer != null) {
            d.stateAnnouncer.completeAction(R.string.item_moved);
        }
        StatsLogManager.newInstance(getContext())
                .log(StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
                    d.logInstanceId,
                    d.dragInfo.buildProto(mInfo));
    }

    // This is used so the item doesn't immediately appear in the folder when added. In one case
Loading