public void onDragExit(DragObject d) { // 只有是一个真正的drag拖出才关闭文件夹,比如说,在文件夹上放下dragview不是退出drag if (!d.dragComplete) { mOnExitAlarm.setOnAlarmListener(mOnExitAlarmListener); mOnExitAlarm.setAlarm(ON_EXIT_CLOSE_DELAY); } mReorderAlarm.cancelAlarm(); }
/* * 拖动结束 */ public void onDragOver(DragObject d) { float[] r = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, d.dragView, null); mTargetCell = mContent.findNearestArea((int) r[0], (int) r[1], 1, 1, mTargetCell); if (mTargetCell[0] != mPreviousTargetCell[0] || mTargetCell[1] != mPreviousTargetCell[1]) { mReorderAlarm.cancelAlarm(); mReorderAlarm.setOnAlarmListener(mReorderAlarmListener); mReorderAlarm.setAlarm(150); mPreviousTargetCell[0] = mTargetCell[0]; mPreviousTargetCell[1] = mTargetCell[1]; } }