コード例 #1
0
 /** Sets the header padding back to original size. */
 private void resetHeaderPadding() {
   mRefreshView.setPadding(
       mRefreshView.getPaddingLeft(),
       mRefreshOriginalTopPadding,
       mRefreshView.getPaddingRight(),
       mRefreshView.getPaddingBottom());
 }
コード例 #2
0
 /** reset header padding */
 private void resetHeaderPadding() {
   headerLayout.setPadding(
       headerLayout.getPaddingLeft(),
       headerOriginalTopPadding,
       headerLayout.getPaddingRight(),
       headerLayout.getPaddingBottom());
 }
コード例 #3
0
 /**
  * adjust header padding according to motion event
  *
  * @param ev
  */
 private void adjustHeaderPadding(MotionEvent ev) {
   // adjust header padding according to motion event history
   int pointerCount = ev.getHistorySize();
   if (isVerticalFadingEdgeEnabled()) {
     setVerticalScrollBarEnabled(false);
   }
   for (int i = 0; i < pointerCount; i++) {
     if (currentHeaderStatus == HEADER_STATUS_DROP_DOWN_TO_LOAD
         || currentHeaderStatus == HEADER_STATUS_RELEASE_TO_LOAD) {
       headerLayout.setPadding(
           headerLayout.getPaddingLeft(),
           (int)
               (((ev.getHistoricalY(i) - actionDownPointY) - headerOriginalHeight)
                   / headerPaddingTopRate),
           headerLayout.getPaddingRight(),
           headerLayout.getPaddingBottom());
     }
   }
 }
コード例 #4
0
  private void applyHeaderPadding(MotionEvent ev) {
    // getHistorySize has been available since API 1
    int pointerCount = ev.getHistorySize();

    for (int p = 0; p < pointerCount; p++) {
      if (mRefreshState == RELEASE_TO_REFRESH) {
        if (isVerticalFadingEdgeEnabled()) {
          setVerticalScrollBarEnabled(false);
        }

        int historicalY = (int) ev.getHistoricalY(p);

        // Calculate the padding to apply, we divide by 1.7 to
        // simulate a more resistant effect during pull.
        int topPadding = (int) (((historicalY - mLastMotionY) - mRefreshViewHeight) / 1.7);

        mRefreshView.setPadding(
            mRefreshView.getPaddingLeft(),
            topPadding,
            mRefreshView.getPaddingRight(),
            mRefreshView.getPaddingBottom());
      }
    }
  }