/**
  * Method that recreates all the dispositions
  *
  * @param animate If the recreate should be done with an animation
  */
 private void recreateDispositions(boolean animate) {
   // Remove all the current views and add the new ones
   removeAllViews();
   for (Disposition disposition : mDispositions) {
     createFrame(getLocationFromDisposition(disposition), animate);
   }
   mOldResizeFrameLocation = null;
   mTarget = null;
   if (mOnFrameSelectedListener != null) {
     mOnFrameSelectedListener.onFrameUnselectedListener();
   }
 }
  /**
   * Method that finalizes the delete animation
   *
   * @param target The disposition target
   */
  void finishDeleteAnimation(Disposition target) {
    removeView(mTarget);
    mDispositions.remove(target);
    Collections.sort(mDispositions);
    mChanged = true;

    // Clean status
    mOldResizeFrameLocation = null;
    mTarget = null;
    if (mOnFrameSelectedListener != null) {
      mOnFrameSelectedListener.onFrameUnselectedListener();
    }
  }
 /** {@inheritDoc} */
 @Override
 public void onCancel() {
   if (mOldResizeFrameLocation != null) {
     mTarget.setLeft(mOldResizeFrameLocation.left);
     mTarget.setRight(mOldResizeFrameLocation.right);
     mTarget.setTop(mOldResizeFrameLocation.top);
     mTarget.setBottom(mOldResizeFrameLocation.bottom);
   }
   mOldResizeFrameLocation = null;
   mTarget = null;
   if (mOnFrameSelectedListener != null) {
     mOnFrameSelectedListener.onFrameUnselectedListener();
   }
 }
  /**
   * Method that select a view as the target of to resize
   *
   * @param v The target view
   */
  boolean selectTarget(View v) {
    // Do not do long click if we do not have a target
    if (mTarget != null && v.equals(mTarget)) return false;
    if (mResizeFrame == null) return false;

    // Show the resize frame view just in place of the current clicked view

    mResizeFrame.hide();
    FrameLayout.LayoutParams frameParams =
        (FrameLayout.LayoutParams) mResizeFrame.getLayoutParams();
    int padding = mInternalPadding + mResizeFrame.getNeededPadding();
    frameParams.width = v.getWidth() + (padding * 2);
    frameParams.height = v.getHeight() + (padding * 2);
    mResizeFrame.setX(v.getX() - padding);
    mResizeFrame.setY(v.getY() - padding);
    mResizeFrame.show();

    // Save the new view
    mTarget = v;
    if (mOnFrameSelectedListener != null) {
      mOnFrameSelectedListener.onFrameSelectedListener(v);
    }
    return true;
  }