Disabled scrolling when removing a behaviour

This commit is contained in:
Ziver Koc 2014-08-20 14:46:29 +02:00
parent 0d4b35199d
commit fb02268d6d
8 changed files with 86 additions and 22 deletions

View file

@ -126,28 +126,6 @@ public class DynamicListView extends ListView {
listener = l;
}
protected void startItemHover(){
mTotalOffset = 0;
int position = pointToPosition(mDownX, mDownY);
int itemNum = position - getFirstVisiblePosition();
View selectedView = getChildAt(itemNum);
if(selectedView != null) {
mMobileItemId = getAdapter().getItemId(position);
mHoverCell = getAndAddHoverView(selectedView);
selectedView.setVisibility(INVISIBLE);
mCellIsMobile = true;
updateNeighborViewsForID(mMobileItemId);
}
else{ // Invalid position, reset
mMode = TouchMode.UNKNOWN;
}
}
/**
* Creates the hover cell with the appropriate bitmap and of appropriate
* size. The hover cell's BitmapDrawable is drawn on top of the bitmap every
@ -289,6 +267,7 @@ public class DynamicListView extends ListView {
addBorder(mHoverCell.getBitmap(), Color.BLACK);
invalidate();
return false;
} else if (mMode == TouchMode.SWAP) {
if (mCellIsMobile) {
mHoverCellCurrentBounds.offsetTo(mHoverCellOriginalBounds.left,
@ -330,6 +309,26 @@ public class DynamicListView extends ListView {
return super.onTouchEvent(event);
}
protected void startItemHover(){
mTotalOffset = 0;
int position = pointToPosition(mDownX, mDownY);
int itemNum = position - getFirstVisiblePosition();
View selectedView = getChildAt(itemNum);
if(selectedView != null) {
mMobileItemId = getAdapter().getItemId(position);
mHoverCell = getAndAddHoverView(selectedView);
selectedView.setVisibility(INVISIBLE);
mCellIsMobile = true;
updateNeighborViewsForID(mMobileItemId);
}
else{ // Invalid position, reset
mMode = TouchMode.UNKNOWN;
}
}
/**
* This method determines whether the hover cell has been shifted far enough
* to invoke a cell swap. If so, then the respective cell swap candidate is