private void initializeIfBookmarkModelLoaded(){
  if (mEnhancedBookmarksModel.isBookmarkModelLoaded()) {
    mSearchView.onEnhancedBookmarkDelegateInitialized(this);
    mDrawerListView.onEnhancedBookmarkDelegateInitialized(this);
    mContentView.onEnhancedBookmarkDelegateInitialized(this);
    if (mStateStack.isEmpty()) {
      setState(UIState.createStateFromUrl(getUrlFromPreference(),mEnhancedBookmarksModel));
    }
 else     if (mStateStack.peek().mState == UIState.STATE_LOADING) {
      String url=mStateStack.pop().mUrl;
      setState(UIState.createStateFromUrl(url,mEnhancedBookmarksModel));
    }
  }
 else {
    mContentView.showLoadingUi();
    mDrawerListView.showLoadingUi();
    mContentView.showLoadingUi();
    if (mStateStack.isEmpty() || mStateStack.peek().mState != UIState.STATE_LOADING) {
      setState(UIState.createLoadingState(getUrlFromPreference()));
    }
 else     if (!mStateStack.isEmpty()) {
      setState(mStateStack.pop());
    }
  }
}

private void initializeIfBookmarkModelLoaded ( ) { if ( mEnhancedBookmarksModel . isBookmarkModelLoaded ( ) ) { mSearchView . onEnhancedBookmarkDelegateInitialized ( this ) ; mDrawerListView . onEnhancedBookmarkDelegateInitialized ( this ) ; mContentView . onEnhancedBookmarkDelegateInitialized ( this ) ; if ( mStateStack . isEmpty ( ) ) { setState ( UIState . createStateFromUrl ( getUrlFromPreference ( ) , mEnhancedBookmarksModel ) ) ; } else if ( mStateStack . peek ( ) . mState == UIState . STATE_LOADING ) { String url = mStateStack . pop ( ) . mUrl ; setState ( UIState . createStateFromUrl ( url , mEnhancedBookmarksModel ) ) ; } } else { mContentView . showLoadingUi ( ) ; mDrawerListView . showLoadingUi ( ) ; mContentView . showLoadingUi ( ) ; if ( mStateStack . isEmpty ( ) || mStateStack . peek ( ) . mState != UIState . STATE_LOADING ) { setState ( UIState . createLoadingState ( getUrlFromPreference ( ) ) ) ; } else if ( ! mStateStack . isEmpty ( ) ) { setState ( mStateStack . pop ( ) ) ; } } }
initialization method that has 3 different behaviors based on whether bookmark model is loaded . if the bookmark model is not loaded yet , it pushes a loading state to backstack which contains the url from preference . if the model is loaded and the backstack is empty , it creates a state by fetching the last visited bookmark url stored in preference . if the bookmark model is loaded but backstack contains a pending loading state , it creates a new state by getting the url of the loading state and replace the previous loading state with the new normal state .
