public void setup(Launcher launcher, DragController dragController) {
    dragController.addDragListener(this);
    dragController.setFlingToDeleteDropTarget(mDeleteDropTarget);

    dragController.addDragListener(mInfoDropTarget);
    dragController.addDragListener(mDeleteDropTarget);
    dragController.addDragListener(mUninstallDropTarget);

    dragController.addDropTarget(mInfoDropTarget);
    dragController.addDropTarget(mDeleteDropTarget);
    dragController.addDropTarget(mUninstallDropTarget);

    mInfoDropTarget.setLauncher(launcher);
    mDeleteDropTarget.setLauncher(launcher);
    mUninstallDropTarget.setLauncher(launcher);
  }
 public void setup(Launcher launcher, DragController dragController) {
   dragController.addDragListener(this);
   dragController.addDragListener(mInfoDropTarget);
   dragController.addDragListener(mDeleteDropTarget);
   dragController.addDropTarget(mInfoDropTarget);
   dragController.addDropTarget(mDeleteDropTarget);
   dragController.setFlingToDeleteDropTarget(mDeleteDropTarget);
   mInfoDropTarget.setLauncher(launcher);
   mDeleteDropTarget.setLauncher(launcher);
   mQSBSearchBar = launcher.getQsbBar();
   if (mEnableDropDownDropTargets) {
     mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0, -mBarHeight);
   } else {
     mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "alpha", 1f, 0f);
   }
   setupAnimation(mQSBSearchBarAnim, mQSBSearchBar);
 }
Пример #3
0
  /**
   * A drag has begun.
   *
   * @param source An object representing where the drag originated
   * @param info The data associated with the object that is being dragged
   * @param dragAction The drag action: either {@link DragController#DRAG_ACTION_MOVE} or {@link
   *     DragController#DRAG_ACTION_COPY}
   */
  public void onDragStart(DragSource source, Object info, int dragAction) {
    // We are starting a drag.
    // Build up a list of DropTargets from the child views of the GridView.
    // Tell the drag controller about them.

    if (mGridView != null) {
      int numVisibleChildren = mGridView.getChildCount();
      for (int i = 0; i < numVisibleChildren; i++) {
        DropTarget view = (DropTarget) mGridView.getChildAt(i);
        mDragController.addDropTarget(view);
      }
    }

    // Always add the delete_zone so there is a place to get rid of views.
    // Find the delete_zone and add it as a drop target.
    // That gives the user a place to drag views to get them off the screen.
    View v = findViewById(R.id.delete_zone_view);
    if (v != null) {
      DeleteZone dz = (DeleteZone) v;
      mDragController.addDropTarget(dz);
    }
  }