public Crossfader build() {
        if (mFirstWidth < mSecondWidth) {
            throw new RuntimeException("the first layout has to be the layout with the greater width");
        }

        //get the layout which should be replaced by the CrossFadeSlidingPaneLayout
        ViewGroup container = ((ViewGroup) mContent.getParent());

        //remove the content from it's parent
        container.removeView(mContent);

        //create the cross fader container
        mCrossFadeSlidingPaneLayout = (T) LayoutInflater.from(mContent.getContext()).inflate(mBaseLayout, container, false);
        container.addView(mCrossFadeSlidingPaneLayout);

        //find the container layouts
        FrameLayout mCrossFadePanel = (FrameLayout) mCrossFadeSlidingPaneLayout.findViewById(R.id.panel);
        LinearLayout mCrossFadeFirst = (LinearLayout) mCrossFadeSlidingPaneLayout.findViewById(R.id.first);
        LinearLayout mCrossFadeSecond = (LinearLayout) mCrossFadeSlidingPaneLayout.findViewById(R.id.second);
        LinearLayout mCrossFadeContainer = (LinearLayout) mCrossFadeSlidingPaneLayout.findViewById(R.id.content);

        //define the widths
        setWidth(mCrossFadePanel, mFirstWidth);
        setWidth(mCrossFadeFirst, mFirstWidth);
        setWidth(mCrossFadeSecond, mSecondWidth);
        setLeftMargin(mCrossFadeContainer, mSecondWidth);

        //add content to the panel
        mCrossFadeFirst.addView(mFirst, mFirstWidth, ViewGroup.LayoutParams.MATCH_PARENT);
        mCrossFadeSecond.addView(mSecond, mSecondWidth, ViewGroup.LayoutParams.MATCH_PARENT);

        //add back main content
        mCrossFadeContainer.addView(mContent, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

        // try to restore all saved values again
        boolean cross_faded = false;
        if (mSavedInstance != null) {
            cross_faded = mSavedInstance.getBoolean(BUNDLE_CROSS_FADED, false);
        }

        if (cross_faded) {
            mCrossFadeSlidingPaneLayout.setOffset(1);
        } else {
            mCrossFadeSlidingPaneLayout.setOffset(0);
        }

        //set the PanelSlideListener for the CrossFadeSlidingPaneLayout
        mCrossFadeSlidingPaneLayout.setPanelSlideListener(mPanelSlideListener);

        //set the ability to slide
        mCrossFadeSlidingPaneLayout.setCanSlide(mCanSlide);

        //define that we don't want a slider color
        mCrossFadeSlidingPaneLayout.setSliderFadeColor(Color.TRANSPARENT);

        //enable / disable the resize functionality
        enableResizeContentPanel(mResizeContentPanel);

        return this;
    }
public Crossfader build ( ) { if ( mFirstWidth < mSecondWidth ) { throw new RuntimeException ( "the first layout has to be the layout with the greater width" ) ; } ViewGroup container = ( ( ViewGroup ) mContent . getParent ( ) ) ; container . removeView ( mContent ) ; mCrossFadeSlidingPaneLayout = ( T ) LayoutInflater . from ( mContent . getContext ( ) ) . inflate ( mBaseLayout , container , false ) ; container . addView ( mCrossFadeSlidingPaneLayout ) ; FrameLayout mCrossFadePanel = ( FrameLayout ) mCrossFadeSlidingPaneLayout . findViewById ( R . id . panel ) ; LinearLayout mCrossFadeFirst = ( LinearLayout ) mCrossFadeSlidingPaneLayout . findViewById ( R . id . first ) ; LinearLayout mCrossFadeSecond = ( LinearLayout ) mCrossFadeSlidingPaneLayout . findViewById ( R . id . second ) ; LinearLayout mCrossFadeContainer = ( LinearLayout ) mCrossFadeSlidingPaneLayout . findViewById ( R . id . content ) ; setWidth ( mCrossFadePanel , mFirstWidth ) ; setWidth ( mCrossFadeFirst , mFirstWidth ) ; setWidth ( mCrossFadeSecond , mSecondWidth ) ; setLeftMargin ( mCrossFadeContainer , mSecondWidth ) ; mCrossFadeFirst . addView ( mFirst , mFirstWidth , ViewGroup . LayoutParams . MATCH_PARENT ) ; mCrossFadeSecond . addView ( mSecond , mSecondWidth , ViewGroup . LayoutParams . MATCH_PARENT ) ; mCrossFadeContainer . addView ( mContent , ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . MATCH_PARENT ) ; boolean cross_faded = false ; if ( mSavedInstance != null ) { cross_faded = mSavedInstance . getBoolean ( BUNDLE_CROSS_FADED , false ) ; } if ( cross_faded ) { mCrossFadeSlidingPaneLayout . setOffset ( 1 ) ; } else { mCrossFadeSlidingPaneLayout . setOffset ( 0 ) ; } mCrossFadeSlidingPaneLayout . setPanelSlideListener ( mPanelSlideListener ) ; mCrossFadeSlidingPaneLayout . setCanSlide ( mCanSlide ) ; mCrossFadeSlidingPaneLayout . setSliderFadeColor ( Color . TRANSPARENT ) ; enableResizeContentPanel ( mResizeContentPanel ) ; return this ; }
builds the crossfader and it's content views
will define all properties and define and add the layouts

@return