@Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // restore webview state
    if (savedInstanceState != null) {
      WebView webView = (WebView) mRootView.findViewById(R.id.fragment_main_webview);
      webView.restoreState(savedInstanceState);
    }

    // setup webview
    renderView();

    // pull to refresh
    SwipeRefreshLayout swipeRefreshLayout =
        (SwipeRefreshLayout) mRootView.findViewById(R.id.container_swipe_refresh);
    swipeRefreshLayout.setOnRefreshListener(this);

    // load and show data
    if (mViewState == null || mViewState == ViewState.OFFLINE) {
      loadData();
    } else if (mViewState == ViewState.CONTENT) {
      showContent();
    } else if (mViewState == ViewState.PROGRESS) {
      showProgress();
    } else if (mViewState == ViewState.EMPTY) {
      showEmpty();
    }

    // progress in action bar
    showActionBarProgress(mActionBarProgress);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // load and show data
    if (mViewState == null || mViewState == ViewState.OFFLINE) {
      loadData();
    } else if (mViewState == ViewState.CONTENT) {
      if (mProductList != null && mTreeStateManager != null) bindData();
      showContent();
    } else if (mViewState == ViewState.PROGRESS) {
      showProgress();
    }
  }