protected void updateUIForMode ( ) { // We need to use the correct LayoutParam values, based on scroll // direction final LinearLayout . LayoutParams lp = getLoadingLayoutLayoutParams ( ) ; // Remove Header, and then add Header Loading View again if needed if ( this == mHeaderLayout . getParent ( ) ) { removeView ( mHeaderLayout ) ; } if ( mMode . showHeaderLoadingLayout ( ) ) { addViewInternal ( mHeaderLayout , 0 , lp ) ; } // Remove Footer, and then add Footer Loading View again if needed if ( this == mFooterLayout . getParent ( ) ) { removeView ( mFooterLayout ) ; } if ( mMode . showFooterLoadingLayout ( ) ) { addViewInternal ( mFooterLayout , lp ) ; } // Hide Loading Views refreshLoadingViewsSize ( ) ; // If we're not using Mode.BOTH, set mCurrentMode to mMode, otherwise // set it to pull down mCurrentMode = ( mMode != Mode . BOTH ) ? mMode : Mode . PULL_FROM_START ; }
Updates the View State when the mode has been set . This does not do any checking that the mode is different to current state so always updates .