6.3.2.10.20. ReorderedLayerView

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

6.3.2.10.20.1. Fields

6.3.2.10.20.1.1. LINE_THICKNESS

protected static final int LINE_THICKNESS

6.3.2.10.20.1.2. SMOOTH_SCROLL_AMOUNT_AT_EDGE

protected static final int SMOOTH_SCROLL_AMOUNT_AT_EDGE

6.3.2.10.20.1.3. mAboveItemId

protected long mAboveItemId

6.3.2.10.20.1.4. mActivePointerId

protected int mActivePointerId

6.3.2.10.20.1.5. mBelowItemId

protected long mBelowItemId

6.3.2.10.20.1.6. mCellIsMobile

protected boolean mCellIsMobile

6.3.2.10.20.1.7. mCurrentFirstVisibleItem

protected int mCurrentFirstVisibleItem

6.3.2.10.20.1.8. mCurrentScrollState

protected int mCurrentScrollState

6.3.2.10.20.1.9. mCurrentVisibleItemCount

protected int mCurrentVisibleItemCount

6.3.2.10.20.1.10. mDownX

protected int mDownX

6.3.2.10.20.1.11. mDownY

protected int mDownY

6.3.2.10.20.1.12. mDrawer

protected DrawerLayout mDrawer

6.3.2.10.20.1.13. mHoverCell

protected BitmapDrawable mHoverCell

6.3.2.10.20.1.14. mHoverCellCurrentBounds

protected Rect mHoverCellCurrentBounds

6.3.2.10.20.1.15. mHoverCellOriginalBounds

protected Rect mHoverCellOriginalBounds

6.3.2.10.20.1.16. mIsMobileScrolling

protected boolean mIsMobileScrolling

6.3.2.10.20.1.17. mIsWaitingForScrollFinish

protected boolean mIsWaitingForScrollFinish

6.3.2.10.20.1.18. mLastEventY

protected int mLastEventY

6.3.2.10.20.1.19. mMobileItemId

protected long mMobileItemId

6.3.2.10.20.1.20. mPreviousFirstVisibleItem

protected int mPreviousFirstVisibleItem

6.3.2.10.20.1.21. mPreviousVisibleItemCount

protected int mPreviousVisibleItemCount

6.3.2.10.20.1.22. mScrollState

protected int mScrollState

6.3.2.10.20.1.23. mSmoothScrollAmountAtEdge

protected int mSmoothScrollAmountAtEdge

6.3.2.10.20.1.24. mTotalOffset

protected int mTotalOffset

6.3.2.10.20.2. Constructors

6.3.2.10.20.2.1. ReorderedLayerView

public ReorderedLayerView(Context context)

6.3.2.10.20.2.2. ReorderedLayerView

public ReorderedLayerView(Context context, AttributeSet attrs)

6.3.2.10.20.2.3. ReorderedLayerView

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

6.3.2.10.20.2.4. ReorderedLayerView

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

6.3.2.10.20.3. Methods

6.3.2.10.20.3.1. 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.

6.3.2.10.20.3.2. 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.

6.3.2.10.20.3.3. 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.

6.3.2.10.20.3.4. 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.

6.3.2.10.20.3.5. getBitmapFromView

protected Bitmap getBitmapFromView(View v)

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

6.3.2.10.20.3.6. getBitmapWithBorder

protected Bitmap getBitmapWithBorder(View v)

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

6.3.2.10.20.3.7. getPositionForID

public int getPositionForID(long itemID)

Retrieves the position in the list corresponding to itemID

6.3.2.10.20.3.8. getViewForID

public View getViewForID(long itemID)

Retrieves the view in the list corresponding to itemID

6.3.2.10.20.3.9. 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.

6.3.2.10.20.3.10. 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;

6.3.2.10.20.3.11. 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.

6.3.2.10.20.3.12. init

protected void init(Context context)

6.3.2.10.20.3.13. 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.

6.3.2.10.20.3.14. onItemLongClick

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

6.3.2.10.20.3.15. onScroll

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

6.3.2.10.20.3.16. onScrollStateChanged

public void onScrollStateChanged(AbsListView view, int scrollState)

6.3.2.10.20.3.17. onTouchEvent

public boolean onTouchEvent(MotionEvent event)

6.3.2.10.20.3.18. setDrawer

public void setDrawer(DrawerLayout drawer)

6.3.2.10.20.3.19. setDrawerLockMode

protected void setDrawerLockMode(int lockMode)

6.3.2.10.20.3.20. touchEventsCancelled

protected void touchEventsCancelled()

Resets all the appropriate fields to a default state.

6.3.2.10.20.3.21. touchEventsEnded

protected void touchEventsEnded()

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

6.3.2.10.20.3.22. 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.