Example usage for java.lang Long MIN_VALUE

List of usage examples for java.lang Long MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Long MIN_VALUE.

Prototype

long MIN_VALUE

To view the source code for java.lang Long MIN_VALUE.

Click Source Link

Document

A constant holding the minimum value a long can have, -263.

Usage

From source file:org.amanzi.neo.models.impl.measurement.AbstractMeasurementModel.java

@Override
public void initialize(final Node node) throws ModelException {
    try {//w  w w . j  a  v  a 2 s  .c o m
        super.initialize(node);

        minTimestamp = getNodeService().getNodeProperty(node,
                timePeriodNodeProperties.getMinTimestampProperty(), Long.MAX_VALUE, false);
        maxTimestamp = getNodeService().getNodeProperty(node,
                timePeriodNodeProperties.getMaxTimestampProperty(), Long.MIN_VALUE, false);
        final String primaryTypeName = getNodeService().getNodeProperty(node,
                measurementNodeProperties.getPrimaryTypeProperty(), DEFAULT_PRIMARY_TYPE.getId(), false);
        primaryType = NodeTypeManager.getInstance().getType(primaryTypeName);

        locationCount = getNodeService().getNodeProperty(node,
                getGeoNodeProperties().getLocationCountProperty(), 0, false);
    } catch (final Exception e) {
        processException("Error on initialization of Measurement Model", e);
    }
}

From source file:android.support.v7.widget.helper.ItemTouchHelper.java

/**
 * Starts dragging or swiping the given View. Call with null if you want to clear it.
 *
 * @param selected    The ViewHolder to drag or swipe. Can be null if you want to cancel the
 *                    current action//  w  w  w  .j a v a 2 s .  c o m
 * @param actionState The type of action
 */
private void select(ViewHolder selected, int actionState) {
    if (selected == mSelected && actionState == mActionState) {
        return;
    }
    mDragScrollStartTimeInMs = Long.MIN_VALUE;
    final int prevActionState = mActionState;
    // prevent duplicate animations
    endRecoverAnimation(selected, true);
    mActionState = actionState;
    if (actionState == ACTION_STATE_DRAG) {
        // we remove after animation is complete. this means we only elevate the last drag
        // child but that should perform good enough as it is very hard to start dragging a
        // new child before the previous one settles.
        mOverdrawChild = selected.itemView;
        addChildDrawingOrderCallback();
    }
    int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState)) - 1;
    boolean preventLayout = false;

    if (mSelected != null) {
        final ViewHolder prevSelected = mSelected;
        if (prevSelected.itemView.getParent() != null) {
            final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0 : swipeIfNecessary(prevSelected);
            releaseVelocityTracker();
            // find where we should animate to
            final float targetTranslateX, targetTranslateY;
            int animationType;
            switch (swipeDir) {
            case LEFT:
            case RIGHT:
            case START:
            case END:
                targetTranslateY = 0;
                targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth();
                break;
            case UP:
            case DOWN:
                targetTranslateX = 0;
                targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
                break;
            default:
                targetTranslateX = 0;
                targetTranslateY = 0;
            }
            if (prevActionState == ACTION_STATE_DRAG) {
                animationType = ANIMATION_TYPE_DRAG;
            } else if (swipeDir > 0) {
                animationType = ANIMATION_TYPE_SWIPE_SUCCESS;
            } else {
                animationType = ANIMATION_TYPE_SWIPE_CANCEL;
            }
            getSelectedDxDy(mTmpPosition);
            final float currentTranslateX = mTmpPosition[0];
            final float currentTranslateY = mTmpPosition[1];
            final RecoverAnimation rv = new RecoverAnimation(prevSelected, animationType, prevActionState,
                    currentTranslateX, currentTranslateY, targetTranslateX, targetTranslateY) {
                @Override
                public void onAnimationEnd(ValueAnimatorCompat animation) {
                    super.onAnimationEnd(animation);
                    if (this.mOverridden) {
                        return;
                    }
                    if (swipeDir <= 0) {
                        // this is a drag or failed swipe. recover immediately
                        mCallback.clearView(mRecyclerView, prevSelected);
                        // full cleanup will happen on onDrawOver
                    } else {
                        // wait until remove animation is complete.
                        mPendingCleanup.add(prevSelected.itemView);
                        mIsPendingCleanup = true;
                        if (swipeDir > 0) {
                            // Animation might be ended by other animators during a layout.
                            // We defer callback to avoid editing adapter during a layout.
                            postDispatchSwipe(this, swipeDir);
                        }
                    }
                    // removed from the list after it is drawn for the last time
                    if (mOverdrawChild == prevSelected.itemView) {
                        removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
                    }
                }
            };
            final long duration = mCallback.getAnimationDuration(mRecyclerView, animationType,
                    targetTranslateX - currentTranslateX, targetTranslateY - currentTranslateY);
            rv.setDuration(duration);
            mRecoverAnimations.add(rv);
            rv.start();
            preventLayout = true;
        } else {
            removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
            mCallback.clearView(mRecyclerView, prevSelected);
        }
        mSelected = null;
    }
    if (selected != null) {
        mSelectedFlags = (mCallback.getAbsoluteMovementFlags(mRecyclerView, selected)
                & actionStateMask) >> (mActionState * DIRECTION_FLAG_COUNT);
        mSelectedStartX = selected.itemView.getLeft();
        mSelectedStartY = selected.itemView.getTop();
        mSelected = selected;

        if (actionState == ACTION_STATE_DRAG) {
            mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
    }
    final ViewParent rvParent = mRecyclerView.getParent();
    if (rvParent != null) {
        rvParent.requestDisallowInterceptTouchEvent(mSelected != null);
    }
    if (!preventLayout) {
        mRecyclerView.getLayoutManager().requestSimpleAnimationsInNextLayout();
    }
    mCallback.onSelectedChanged(mSelected, mActionState);
    mRecyclerView.invalidate();
}

From source file:jetbrains.exodus.env.EnvironmentImpl.java

private long getNewestTxnRootAddress() {
    final TransactionImpl newestTxn = getNewestTransaction();
    return newestTxn == null ? Long.MIN_VALUE : newestTxn.getRoot();
}

From source file:com.panahit.telegramma.support.widget.helper.ItemTouchHelper.java

/**
 * Starts dragging or swiping the given View. Call with null if you want to clear it.
 *
 * @param selected    The ViewHolder to drag or swipe. Can be null if you want to cancel the
 *                    current action/*w ww.  j  a  v a 2 s . c o  m*/
 * @param actionState The type of action
 */
private void select(RecyclerView.ViewHolder selected, int actionState) {
    if (selected == mSelected && actionState == mActionState) {
        return;
    }
    mDragScrollStartTimeInMs = Long.MIN_VALUE;
    final int prevActionState = mActionState;
    // prevent duplicate animations
    endRecoverAnimation(selected, true);
    mActionState = actionState;
    if (actionState == ACTION_STATE_DRAG) {
        // we remove after animation is complete. this means we only elevate the last drag
        // child but that should perform good enough as it is very hard to start dragging a
        // new child before the previous one settles.
        mOverdrawChild = selected.itemView;
        addChildDrawingOrderCallback();
    }
    int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState)) - 1;
    boolean preventLayout = false;

    if (mSelected != null) {
        final RecyclerView.ViewHolder prevSelected = mSelected;
        if (prevSelected.itemView.getParent() != null) {
            final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0 : swipeIfNecessary(prevSelected);
            releaseVelocityTracker();
            // find where we should animate to
            final float targetTranslateX, targetTranslateY;
            int animationType;
            switch (swipeDir) {
            case LEFT:
            case RIGHT:
            case START:
            case END:
                targetTranslateY = 0;
                targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth();
                break;
            case UP:
            case DOWN:
                targetTranslateX = 0;
                targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
                break;
            default:
                targetTranslateX = 0;
                targetTranslateY = 0;
            }
            if (prevActionState == ACTION_STATE_DRAG) {
                animationType = ANIMATION_TYPE_DRAG;
            } else if (swipeDir > 0) {
                animationType = ANIMATION_TYPE_SWIPE_SUCCESS;
            } else {
                animationType = ANIMATION_TYPE_SWIPE_CANCEL;
            }
            getSelectedDxDy(mTmpPosition);
            final float currentTranslateX = mTmpPosition[0];
            final float currentTranslateY = mTmpPosition[1];
            final RecoverAnimation rv = new RecoverAnimation(prevSelected, animationType, prevActionState,
                    currentTranslateX, currentTranslateY, targetTranslateX, targetTranslateY) {
                @Override
                public void onAnimationEnd(ValueAnimatorCompat animation) {
                    super.onAnimationEnd(animation);
                    if (this.mOverridden) {
                        return;
                    }
                    if (swipeDir <= 0) {
                        // this is a drag or failed swipe. recover immediately
                        mCallback.clearView(mRecyclerView, prevSelected);
                        // full cleanup will happen on onDrawOver
                    } else {
                        // wait until remove animation is complete.
                        mPendingCleanup.add(prevSelected.itemView);
                        mIsPendingCleanup = true;
                        if (swipeDir > 0) {
                            // Animation might be ended by other animators during a layout.
                            // We defer callback to avoid editing adapter during a layout.
                            postDispatchSwipe(this, swipeDir);
                        }
                    }
                    // removed from the list after it is drawn for the last time
                    if (mOverdrawChild == prevSelected.itemView) {
                        removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
                    }
                }
            };
            final long duration = mCallback.getAnimationDuration(mRecyclerView, animationType,
                    targetTranslateX - currentTranslateX, targetTranslateY - currentTranslateY);
            rv.setDuration(duration);
            mRecoverAnimations.add(rv);
            rv.start();
            preventLayout = true;
        } else {
            removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
            mCallback.clearView(mRecyclerView, prevSelected);
        }
        mSelected = null;
    }
    if (selected != null) {
        mSelectedFlags = (mCallback.getAbsoluteMovementFlags(mRecyclerView, selected)
                & actionStateMask) >> (mActionState * DIRECTION_FLAG_COUNT);
        mSelectedStartX = selected.itemView.getLeft();
        mSelectedStartY = selected.itemView.getTop();
        mSelected = selected;

        if (actionState == ACTION_STATE_DRAG) {
            mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
    }
    final ViewParent rvParent = mRecyclerView.getParent();
    if (rvParent != null) {
        rvParent.requestDisallowInterceptTouchEvent(mSelected != null);
    }
    if (!preventLayout) {
        mRecyclerView.getLayoutManager().requestSimpleAnimationsInNextLayout();
    }
    mCallback.onSelectedChanged(mSelected, mActionState);
    mRecyclerView.invalidate();
}

From source file:net.aksingh.java.api.owm.CurrentWeatherData.java

public boolean hasCityCode() {
    return (this.cityID != Long.MIN_VALUE);
}

From source file:com.antsdb.saltedfish.server.mysql.PacketEncoder.java

/**
  * /*  ww w . j a  va 2s . c o m*/
  * From server to client. One packet for each row in the result set.
  * 
  * <pre>
  * Bytes                   Name
  * -----                   ----
  * n (Length Coded String) (column value)
  * ...
  * 
  * (column value):         The data in the column, as a character string.
  *                         If a column is defined as non-character, the
  *                         server converts the value into a character
  *                         before sending it. Since the value is a Length
  *                         Coded String, a NULL can be represented with a
  *                         single byte containing 251(see the description
  *                         of Length Coded Strings in section "Elements" above).
  * 
  * @see http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Row_Data_Packet
  * </pre>
  * 
  * @param buffer
  * @param nColumns 
  * @param rowRec
  */
public void writeRowTextBody(ByteBuf buffer, long pRecord, int nColumns) {
    for (int i = 0; i < nColumns; i++) {
        Object fv = Record.getValue(pRecord, i);
        if (fv instanceof Boolean) {
            // mysql has no boolean it is actually tinyint
            fv = ((Boolean) fv) ? 1 : 0;
        }
        if (fv == null) {
            // null mark is 251
            buffer.writeByte((byte) 251);
        } else if (fv instanceof Duration) {
            Duration t = (Duration) fv;
            String text = DurationFormatUtils.formatDuration(t.toMillis(), "HH:mm:ss");
            BufferUtils.writeLenString(buffer, text, this.cs);
        } else if (fv instanceof Timestamp) {
            // @see ResultSetRow#getDateFast, mysql jdbc driver only take precision 19,21,29 if callers wants
            // to get a Date from a datetime column
            Timestamp ts = (Timestamp) fv;
            if (ts.getTime() == Long.MIN_VALUE) {
                // mysql '0000-00-00 00:00:00' is treated as null in jdbc
                buffer.writeByte((byte) 251);
            } else {
                String text;
                if (ts.getNanos() == 0) {
                    text = TIMESTAMP19_FORMAT.format(ts);
                } else {
                    text = TIMESTAMP29_FORMAT.format(ts);
                }
                BufferUtils.writeLenString(buffer, text, this.cs);
            }
        } else if (fv instanceof byte[]) {
            BufferUtils.writeWithLength(buffer, (byte[]) fv);
        } else if ((fv instanceof Date) && (((Date) fv).getTime() == Long.MIN_VALUE)) {
            // mysql '0000-00-00' is treated as null in jdbc
            buffer.writeByte((byte) 251);
        } else {
            String val = fv.toString();
            if (val.length() == 0) {
                // empty mark is 0
                buffer.writeByte((byte) 0);
            } else {
                BufferUtils.writeLenString(buffer, val, this.cs);
            }
        }
    }
}

From source file:com.smartitengineering.cms.api.impl.content.ContentLoaderImpl.java

public FieldValue getSimpleValueFor(String value, FieldValueType type) {
    final FieldValue result;
    switch (type) {
    case BOOLEAN:
        logger.debug("Getting as boolean");
        MutableBooleanFieldValue booleanFieldValue = createBooleanFieldValue();
        result = booleanFieldValue;//  ww w . j a va  2  s  . c  o m
        booleanFieldValue.setValue(Boolean.parseBoolean(value));
        break;
    case CONTENT:
        logger.debug("Getting as content");
        MutableContentFieldValue contentFieldValue = createContentFieldValue();
        if (logger.isDebugEnabled()) {
            logger.debug("Content value: " + value);
        }
        try {
            DataInputStream inputStream = new DataInputStream(
                    new ByteArrayInputStream(StringUtils.getBytesUtf8(value)));
            ContentIdImpl idImpl = new ContentIdImpl();
            idImpl.readExternal(inputStream);
            contentFieldValue.setValue(idImpl);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        result = contentFieldValue;
        break;
    case INTEGER:
        logger.debug("Getting as integer");
        MutableNumberFieldValue integerFieldValue = createIntegerFieldValue();
        integerFieldValue.setValue(NumberUtils.toInt(value, Integer.MIN_VALUE));
        result = integerFieldValue;
        break;
    case DOUBLE:
        logger.debug("Getting as double");
        MutableNumberFieldValue doubleFieldValue = createDoubleFieldValue();
        doubleFieldValue.setValue(NumberUtils.toDouble(value, Double.MIN_VALUE));
        result = doubleFieldValue;
        break;
    case LONG:
        logger.debug("Getting as long");
        MutableNumberFieldValue longFieldValue = createLongFieldValue();
        longFieldValue.setValue(NumberUtils.toLong(value, Long.MIN_VALUE));
        result = longFieldValue;
        break;
    case DATE_TIME:
        logger.debug("Getting as date time");
        MutableDateTimeFieldValue valueOf;
        try {
            valueOf = DateTimeFieldValueImpl.valueOf(value);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
        result = valueOf;
        break;
    case OTHER:
        logger.debug("Getting as other");
        MutableOtherFieldValue otherFieldValue = createOtherFieldValue();
        otherFieldValue.setValue(Base64.decodeBase64(value));
        result = otherFieldValue;
        break;
    case STRING:
    default:
        logger.debug("Getting as else or string");
        MutableStringFieldValue fieldValue = createStringFieldValue();
        fieldValue.setValue(value);
        result = fieldValue;
    }
    return result;
}

From source file:com.google.uzaygezen.core.LongArrayBitVector.java

private int compareTo(long[] other) {
    int i;//from  w  w w. ja  v  a  2  s .c o m
    for (i = data.length; --i >= 0 && data[i] == other[i];)
        ;
    final int cmp;
    if (i == -1) {
        cmp = 0;
    } else {
        // 0, positives, Long.MAX_VALUE, Long.MIN_VALUE, negatives, -1
        long x = data[i] + Long.MIN_VALUE;
        long y = other[i] + Long.MIN_VALUE;
        cmp = Long.compare(x, y);
        assert cmp != 0;
    }
    return cmp;
}

From source file:com.anarchy.classify.library.helper.ClassifyItemTouchHelper.java

/**
 * Starts dragging or swiping the given View. Call with null if you want to clear it.
 *
 * @param selected    The ViewHolder to drag or swipe. Can be null if you want to cancel the
 *                    current action/* ww w . j  a  v a  2s  . com*/
 * @param actionState The type of action
 */
private void select(RecyclerView.ViewHolder selected, int actionState) {
    if (selected == mSelected && actionState == mActionState) {
        return;
    }
    if (mCallback.getMergeStatus()) {
        if (mSelected != null) {
            mCallback.onMerged(mSelected);
            mSelected = null;
            return;
        }
    }
    mDragScrollStartTimeInMs = Long.MIN_VALUE;
    final int prevActionState = mActionState;
    // prevent duplicate animations
    endRecoverAnimation(selected, true);
    mActionState = actionState;
    if (actionState == ACTION_STATE_DRAG) {
        // we remove after animation is complete. this means we only elevate the last drag
        // child but that should perform good enough as it is very hard to start dragging a
        // new child before the previous one settles.
        mOverdrawChild = selected.itemView;
        addChildDrawingOrderCallback();
    }
    int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState)) - 1;
    boolean preventLayout = false;

    if (mSelected != null) {
        final RecyclerView.ViewHolder prevSelected = mSelected;
        if (prevSelected.itemView.getParent() != null) {
            final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0 : swipeIfNecessary(prevSelected);
            releaseVelocityTracker();
            // find where we should animate to
            final float targetTranslateX, targetTranslateY;
            int animationType;
            switch (swipeDir) {
            case LEFT:
            case RIGHT:
            case START:
            case END:
                targetTranslateY = 0;
                targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth();
                break;
            case UP:
            case DOWN:
                targetTranslateX = 0;
                targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
                break;
            default:
                targetTranslateX = 0;
                targetTranslateY = 0;
            }
            if (prevActionState == ACTION_STATE_DRAG) {
                animationType = ANIMATION_TYPE_DRAG;
            } else if (swipeDir > 0) {
                animationType = ANIMATION_TYPE_SWIPE_SUCCESS;
            } else {
                animationType = ANIMATION_TYPE_SWIPE_CANCEL;
            }
            getSelectedDxDy(mTmpPosition);
            final float currentTranslateX = mTmpPosition[0];
            final float currentTranslateY = mTmpPosition[1];
            final RecoverAnimation rv = new RecoverAnimation(prevSelected, animationType, prevActionState,
                    currentTranslateX, currentTranslateY, targetTranslateX, targetTranslateY) {
                @Override
                public void onAnimationEnd(ValueAnimatorCompat animation) {
                    super.onAnimationEnd(animation);
                    if (this.mOverridden) {
                        return;
                    }
                    if (swipeDir <= 0) {
                        // this is a drag or failed swipe. recover immediately
                        mCallback.clearView(mRecyclerView, prevSelected);
                        // full cleanup will happen on onDrawOver
                    } else {
                        // wait until remove animation is complete.
                        mPendingCleanup.add(prevSelected.itemView);
                        mIsPendingCleanup = true;
                        if (swipeDir > 0) {
                            // Animation might be ended by other animators during a layout.
                            // We defer callback to avoid editing adapter during a layout.
                            postDispatchSwipe(this, swipeDir);
                        }
                    }
                    // removed from the list after it is drawn for the last time
                    if (mOverdrawChild == prevSelected.itemView) {
                        removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
                    }
                }
            };
            final long duration = mCallback.getAnimationDuration(mRecyclerView, animationType,
                    targetTranslateX - currentTranslateX, targetTranslateY - currentTranslateY);
            rv.setDuration(duration);
            mRecoverAnimations.add(rv);
            rv.start();
            preventLayout = true;
        } else {
            removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
            mCallback.clearView(mRecyclerView, prevSelected);
        }
        mSelected = null;
    }
    if (selected != null) {
        mSelectedFlags = (mCallback.getAbsoluteMovementFlags(mRecyclerView, selected)
                & actionStateMask) >> (mActionState * DIRECTION_FLAG_COUNT);
        mSelectedStartX = selected.itemView.getLeft();
        mSelectedStartY = selected.itemView.getTop();
        mSelected = selected;

        if (actionState == ACTION_STATE_DRAG) {
            mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
    }
    final ViewParent rvParent = mRecyclerView.getParent();
    if (rvParent != null) {
        rvParent.requestDisallowInterceptTouchEvent(mSelected != null);
    }
    if (!preventLayout) {
        mRecyclerView.getLayoutManager().requestSimpleAnimationsInNextLayout();
    }
    mCallback.onSelectedChanged(mSelected, mActionState);
    mRecyclerView.invalidate();
}

From source file:com.ferdi2005.secondgram.support.widget.helper.ItemTouchHelper.java

/**
 * Starts dragging or swiping the given View. Call with null if you want to clear it.
 *
 * @param selected    The ViewHolder to drag or swipe. Can be null if you want to cancel the
 *                    current action//from w  w w  .jav a  2s  .c  o m
 * @param actionState The type of action
 */
void select(ViewHolder selected, int actionState) {
    if (selected == mSelected && actionState == mActionState) {
        return;
    }
    mDragScrollStartTimeInMs = Long.MIN_VALUE;
    final int prevActionState = mActionState;
    // prevent duplicate animations
    endRecoverAnimation(selected, true);
    mActionState = actionState;
    if (actionState == ACTION_STATE_DRAG) {
        // we remove after animation is complete. this means we only elevate the last drag
        // child but that should perform good enough as it is very hard to start dragging a
        // new child before the previous one settles.
        mOverdrawChild = selected.itemView;
        addChildDrawingOrderCallback();
    }
    int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState)) - 1;
    boolean preventLayout = false;

    if (mSelected != null) {
        final ViewHolder prevSelected = mSelected;
        if (prevSelected.itemView.getParent() != null) {
            final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0 : swipeIfNecessary(prevSelected);
            releaseVelocityTracker();
            // find where we should animate to
            final float targetTranslateX, targetTranslateY;
            int animationType;
            switch (swipeDir) {
            case LEFT:
            case RIGHT:
            case START:
            case END:
                targetTranslateY = 0;
                targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth();
                break;
            case UP:
            case DOWN:
                targetTranslateX = 0;
                targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
                break;
            default:
                targetTranslateX = 0;
                targetTranslateY = 0;
            }
            if (prevActionState == ACTION_STATE_DRAG) {
                animationType = ANIMATION_TYPE_DRAG;
            } else if (swipeDir > 0) {
                animationType = ANIMATION_TYPE_SWIPE_SUCCESS;
            } else {
                animationType = ANIMATION_TYPE_SWIPE_CANCEL;
            }
            getSelectedDxDy(mTmpPosition);
            final float currentTranslateX = mTmpPosition[0];
            final float currentTranslateY = mTmpPosition[1];
            final RecoverAnimation rv = new RecoverAnimation(prevSelected, animationType, prevActionState,
                    currentTranslateX, currentTranslateY, targetTranslateX, targetTranslateY) {
                @Override
                public void onAnimationEnd(ValueAnimatorCompat animation) {
                    super.onAnimationEnd(animation);
                    if (this.mOverridden) {
                        return;
                    }
                    if (swipeDir <= 0) {
                        // this is a drag or failed swipe. recover immediately
                        mCallback.clearView(mRecyclerView, prevSelected);
                        // full cleanup will happen on onDrawOver
                    } else {
                        // wait until remove animation is complete.
                        mPendingCleanup.add(prevSelected.itemView);
                        mIsPendingCleanup = true;
                        if (swipeDir > 0) {
                            // Animation might be ended by other animators during a layout.
                            // We defer callback to avoid editing adapter during a layout.
                            postDispatchSwipe(this, swipeDir);
                        }
                    }
                    // removed from the list after it is drawn for the last time
                    if (mOverdrawChild == prevSelected.itemView) {
                        removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
                    }
                }
            };
            final long duration = mCallback.getAnimationDuration(mRecyclerView, animationType,
                    targetTranslateX - currentTranslateX, targetTranslateY - currentTranslateY);
            rv.setDuration(duration);
            mRecoverAnimations.add(rv);
            rv.start();
            preventLayout = true;
        } else {
            removeChildDrawingOrderCallbackIfNecessary(prevSelected.itemView);
            mCallback.clearView(mRecyclerView, prevSelected);
        }
        mSelected = null;
    }
    if (selected != null) {
        mSelectedFlags = (mCallback.getAbsoluteMovementFlags(mRecyclerView, selected)
                & actionStateMask) >> (mActionState * DIRECTION_FLAG_COUNT);
        mSelectedStartX = selected.itemView.getLeft();
        mSelectedStartY = selected.itemView.getTop();
        mSelected = selected;

        if (actionState == ACTION_STATE_DRAG) {
            mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
    }
    final ViewParent rvParent = mRecyclerView.getParent();
    if (rvParent != null) {
        rvParent.requestDisallowInterceptTouchEvent(mSelected != null);
    }
    if (!preventLayout) {
        mRecyclerView.getLayoutManager().requestSimpleAnimationsInNextLayout();
    }
    mCallback.onSelectedChanged(mSelected, mActionState);
    mRecyclerView.invalidate();
}