library/src/com/hb/views/PinnedSectionListView.java
private void createPinnedShadow(int position) {

		// try to recycle shadow
		PinnedViewShadow pinnedShadow = mRecycleShadow;
		mRecycleShadow = null;

		// create new shadow, if needed
		if (pinnedShadow == null) pinnedShadow = new PinnedViewShadow();
		// request new view using recycled view, if such
		View pinnedView = getAdapter().getView(position, pinnedShadow.view, PinnedSectionListView.this);

		// read layout parameters
		LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();
		if (layoutParams == null) { // create default layout params
		    layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		}

		int heightMode = MeasureSpec.getMode(layoutParams.height);
		int heightSize = MeasureSpec.getSize(layoutParams.height);

		if (heightMode == MeasureSpec.UNSPECIFIED) heightMode = MeasureSpec.EXACTLY;

		int maxHeight = getHeight() - getListPaddingTop() - getListPaddingBottom();
		if (heightSize > maxHeight) heightSize = maxHeight;

		// measure & layout
		int ws = MeasureSpec.makeMeasureSpec(getWidth() - getListPaddingLeft() - getListPaddingRight(), MeasureSpec.EXACTLY);
		int hs = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
		pinnedView.measure(ws, hs);
		pinnedView.layout(0, 0, pinnedView.getMeasuredWidth(), pinnedView.getMeasuredHeight());
		mTranslateY = 0;

		// initialize pinned shadow
		pinnedShadow.position = position;
		pinnedShadow.view = pinnedView;

		// store pinned shadow
		mPinnedShadow = pinnedShadow;
	}
/** Create shadow wrapper with a pinned view for a view at given position */
Create shadow wrapper with a pinned view for a view at given position
Create shadow wrapper with a pinned view for a view at given position
private void createPinnedShadow(int position) {
		PinnedViewShadow pinnedShadow = mRecycleShadow;
		mRecycleShadow = null;
		if (pinnedShadow == null) pinnedShadow = new PinnedViewShadow();
		View pinnedView = getAdapter().getView(position, pinnedShadow.view, PinnedSectionListView.this);
		LayoutParams layoutParams = (LayoutParams) pinnedView.getLayoutParams();
		if (layoutParams == null) { 
		    layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		}
		int heightMode = MeasureSpec.getMode(layoutParams.height);
		int heightSize = MeasureSpec.getSize(layoutParams.height);
		if (heightMode == MeasureSpec.UNSPECIFIED) heightMode = MeasureSpec.EXACTLY;
		int maxHeight = getHeight() - getListPaddingTop() - getListPaddingBottom();
		if (heightSize > maxHeight) heightSize = maxHeight;
		int ws = MeasureSpec.makeMeasureSpec(getWidth() - getListPaddingLeft() - getListPaddingRight(), MeasureSpec.EXACTLY);
		int hs = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
		pinnedView.measure(ws, hs);
		pinnedView.layout(0, 0, pinnedView.getMeasuredWidth(), pinnedView.getMeasuredHeight());
		mTranslateY = 0;
		pinnedShadow.position = position;
		pinnedShadow.view = pinnedView;
		mPinnedShadow = pinnedShadow;
	}
private void createPinnedShadow ( int position ) { PinnedViewShadow pinnedShadow = mRecycleShadow ; mRecycleShadow = null ; if ( pinnedShadow == null ) pinnedShadow = new PinnedViewShadow ( ) ; View pinnedView = getAdapter ( ) . getView ( position , pinnedShadow . view , PinnedSectionListView . this ) ; LayoutParams layoutParams = ( LayoutParams ) pinnedView . getLayoutParams ( ) ; if ( layoutParams == null ) { layoutParams = new LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . WRAP_CONTENT ) ; } int heightMode = MeasureSpec . getMode ( layoutParams . height ) ; int heightSize = MeasureSpec . getSize ( layoutParams . height ) ; if ( heightMode == MeasureSpec . UNSPECIFIED ) heightMode = MeasureSpec . EXACTLY ; int maxHeight = getHeight ( ) - getListPaddingTop ( ) - getListPaddingBottom ( ) ; if ( heightSize > maxHeight ) heightSize = maxHeight ; int ws = MeasureSpec . makeMeasureSpec ( getWidth ( ) - getListPaddingLeft ( ) - getListPaddingRight ( ) , MeasureSpec . EXACTLY ) ; int hs = MeasureSpec . makeMeasureSpec ( heightSize , heightMode ) ; pinnedView . measure ( ws , hs ) ; pinnedView . layout ( 0 , 0 , pinnedView . getMeasuredWidth ( ) , pinnedView . getMeasuredHeight ( ) ) ; mTranslateY = 0 ; pinnedShadow . position = position ; pinnedShadow . view = pinnedView ; mPinnedShadow = pinnedShadow ; }
Create shadow wrapper with a pinned view for a view at given position
Create shadow wrapper with a pinned view for a view at given position
// try to recycle shadow // create new shadow, if needed // request new view using recycled view, if such // read layout parameters // create default layout params // measure & layout // initialize pinned shadow // store pinned shadow