Пример #1
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());
    }
Пример #2
0
    public final void startDrag() {
      PointF touchPoint = adapter.getLastTouchPoint();
      int x = (int) (touchPoint.x - itemView.getX());
      int y = (int) (touchPoint.y - itemView.getY());

      startDrag(getShadowBuilder(itemView, new Point(x, y)));
    }