/** Sets the header padding back to original size. */ private void resetHeaderPadding() { mRefreshView.setPadding( mRefreshView.getPaddingLeft(), mRefreshOriginalTopPadding, mRefreshView.getPaddingRight(), mRefreshView.getPaddingBottom()); }
/** reset header padding */ private void resetHeaderPadding() { headerLayout.setPadding( headerLayout.getPaddingLeft(), headerOriginalTopPadding, headerLayout.getPaddingRight(), headerLayout.getPaddingBottom()); }
/** Sets the KitKat translucent status/nav bar and adjusts the views' boundaries. */ private void setKitKatTranslucentBars() { // KitKat translucent status bar. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int statusBarHeight = Common.getStatusBarHeight(mContext); int navigationBarHeight = Common.getNavigationBarHeight(mContext); if (mDrawerParentLayout != null) { mDrawerParentLayout.setClipToPadding(false); mDrawerParentLayout.setPadding(0, 0, 0, 0); } if (mControlsLayoutHeaderParent != null) { int bottomPadding = mControlsLayoutHeaderParent.getPaddingBottom(); mControlsLayoutHeaderParent.setClipToPadding(false); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mControlsLayoutHeaderParent.getLayoutParams(); if (navigationBarHeight > 0) { /* The nav bar already has padding, so remove the extra 15dp * margin that was applied in the layout file. */ params.bottomMargin = 0; } params.bottomMargin += navigationBarHeight; mControlsLayoutHeaderParent.setLayoutParams(params); } } }
/** * 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()); } } }
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()); } } }