@Override
  public void onDrawShadow(Canvas canvas) {

    super.onDrawShadow(canvas);
    drawable.draw(canvas);
    getView().draw(canvas);
  }
Example #2
0
    public final void startDrag(View.DragShadowBuilder dragShadowBuilder) {
      Point shadowSize = new Point();
      Point shadowTouchPoint = new Point();
      dragShadowBuilder.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

      itemView.startDrag(
          null,
          dragShadowBuilder,
          new DragInfo(getItemId(), shadowSize, shadowTouchPoint, adapter.getLastTouchPoint()),
          0);

      adapter.notifyItemChanged(getAdapterPosition());
    }
Example #3
0
    @Override
    public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) {

      super.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

      // Double the height and width
      int height = getView().getHeight() * 2;
      int width = getView().getWidth() * 2;
      mBitmapDrawable.setBounds(0, 0, width, height);
      shadowSize.set(width, height);

      // Set the touch point to the middle
      shadowTouchPoint.set(width / 2, height / 2);
    }