public class ReorderedLayerView extends ListView implements AdapterView.OnItemLongClickListener, AbsListView.OnScrollListener Fields LINE_THICKNESS


protected static final int SMOOTH_SCROLL_AMOUNT_AT_EDGE mAboveItemId

protected long mAboveItemId mActivePointerId

protected int mActivePointerId mBelowItemId

protected long mBelowItemId mCellIsMobile

protected boolean mCellIsMobile mCurrentFirstVisibleItem

protected int mCurrentFirstVisibleItem mCurrentScrollState

protected int mCurrentScrollState mCurrentVisibleItemCount

protected int mCurrentVisibleItemCount mDownX

protected int mDownX mDownY

protected int mDownY mDrawer

protected DrawerLayout mDrawer mHoverCell

protected BitmapDrawable mHoverCell mHoverCellCurrentBounds

protected Rect mHoverCellCurrentBounds mHoverCellOriginalBounds

protected Rect mHoverCellOriginalBounds mIsMobileScrolling

protected boolean mIsMobileScrolling mIsWaitingForScrollFinish

protected boolean mIsWaitingForScrollFinish mLastEventY

protected int mLastEventY mMobileItemId

protected long mMobileItemId mPreviousFirstVisibleItem

protected int mPreviousFirstVisibleItem mPreviousVisibleItemCount

protected int mPreviousVisibleItemCount mScrollState

protected int mScrollState mSmoothScrollAmountAtEdge

protected int mSmoothScrollAmountAtEdge mTotalOffset

protected int mTotalOffset Constructors ReorderedLayerView

public ReorderedLayerView(Context context) ReorderedLayerView

public ReorderedLayerView(Context context, AttributeSet attrs) ReorderedLayerView

public ReorderedLayerView(Context context, AttributeSet attrs, int defStyleAttr) ReorderedLayerView

public ReorderedLayerView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) Methods checkAndHandleFirstVisibleCellChange

protected void checkAndHandleFirstVisibleCellChange()

Determines if the listview scrolled up enough to reveal a new cell at the top of the list. If so, then the appropriate parameters are updated. checkAndHandleLastVisibleCellChange

protected void checkAndHandleLastVisibleCellChange()

Determines if the listview scrolled down enough to reveal a new cell at the bottom of the list. If so, then the appropriate parameters are updated. dispatchDraw

protected void dispatchDraw(Canvas canvas)

dispatchDraw gets invoked when all the child views are about to be drawn. By overriding this method, the hover cell (BitmapDrawable) can be drawn over the listview’s items whenever the listview is redrawn. getAndAddHoverView

protected BitmapDrawable getAndAddHoverView(View v)

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 single time an invalidate call is made. getBitmapFromView

protected Bitmap getBitmapFromView(View v)

Returns a bitmap showing a screenshot of the view passed in. getBitmapWithBorder

protected Bitmap getBitmapWithBorder(View v)

Draws a black border over the screenshot of the view passed in. getPositionForID

public int getPositionForID(long itemID)

Retrieves the position in the list corresponding to itemID getViewForID

public View getViewForID(long itemID)

Retrieves the view in the list corresponding to itemID handleCellSwitch

protected void handleCellSwitch()

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 determined and the data set is changed. Upon posting a notification of the data set change, a layout is invoked to place the cells in the right place. Using a ViewTreeObserver and a corresponding OnPreDrawListener, we can offset the cell being swapped to where it previously was and then animate it to its new position. handleMobileCellScroll

protected void handleMobileCellScroll()

Determines whether this listview is in a scrolling state invoked by the fact that the hover cell is out of the bounds of the listview; handleMobileCellScroll

protected boolean handleMobileCellScroll(Rect r)

This method is in charge of determining if the hover cell is above or below the bounds of the listview. If so, the listview does an appropriate upward or downward smooth scroll so as to reveal new items. init

protected void init(Context context) isScrollCompleted

protected void isScrollCompleted()

This method is in charge of invoking 1 of 2 actions. Firstly, if the listview is in a state of scrolling invoked by the hover cell being outside the bounds of the listview, then this scrolling event is continued. Secondly, if the hover cell has already been released, this invokes the animation for the hover cell to return to its correct position after the listview has entered an idle scroll state. onItemLongClick

public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) onScroll

public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) onScrollStateChanged

public void onScrollStateChanged(AbsListView view, int scrollState) onTouchEvent

public boolean onTouchEvent(MotionEvent event) setDrawer

public void setDrawer(DrawerLayout drawer) setDrawerLockMode

protected void setDrawerLockMode(int lockMode) touchEventsCancelled

protected void touchEventsCancelled()

Resets all the appropriate fields to a default state. touchEventsEnded

protected void touchEventsEnded()

Resets all the appropriate fields to a default state while also animating the hover cell back to its correct location. updateNeighborViewsForID

protected void updateNeighborViewsForID(long itemID)

Stores a reference to the views above and below the item currently corresponding to the hover cell. It is important to note that if this item is either at the top or bottom of the list, mAboveItemId or mBelowItemId may be invalid.