@Override
 public void onDestroy() {
   if (view != null) {
     view.destroy();
     view = null;
   }
   miFullscreen = null;
   miBookmark = null;
   super.onDestroy();
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle args = getArguments();
    this.url = args == null ? null : args.getString(ARG_URL);
    if (url == null) {
      View layout = inflater.inflate(R.layout.empty_view, container, false);
      TextView textView = (TextView) layout.findViewById(R.id.empty_text);
      textView.setText("");
      ImageView icon = (ImageView) layout.findViewById(R.id.empty_icon);
      icon.setImageDrawable(
          FontIconDrawable.inflate(getActivity(), R.xml.ic_empty_view_not_available));
      return layout;
    }

    View layout = inflater.inflate(R.layout.article_view, container, false);
    final ProgressBar progressBar = (ProgressBar) layout.findViewById(R.id.webViewPogress);
    view = (ArticleWebView) layout.findViewById(R.id.webView);
    view.restoreState(savedInstanceState);
    view.loadUrl(url);
    view.setWebChromeClient(
        new WebChromeClient() {
          public void onProgressChanged(WebView view, final int newProgress) {
            final Activity activity = getActivity();
            if (activity != null) {
              activity.runOnUiThread(
                  new Runnable() {
                    @Override
                    public void run() {
                      progressBar.setProgress(newProgress);
                      if (newProgress >= progressBar.getMax()) {
                        progressBar.setVisibility(ViewGroup.GONE);
                      }
                    }
                  });
            }
          }
        });

    return layout;
  }
 @SuppressWarnings("deprecation")
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int itemId = item.getItemId();
   if (itemId == R.id.action_find_in_page) {
     view.showFindDialog(null, false);
     return true;
   }
   if (itemId == R.id.action_bookmark_article) {
     Application app = (Application) getActivity().getApplication();
     if (this.url != null) {
       if (item.isChecked()) {
         app.removeBookmark(this.url);
         displayBookmarked(false);
       } else {
         app.addBookmark(this.url);
         displayBookmarked(true);
       }
     }
     return true;
   }
   if (itemId == R.id.action_fullscreen) {
     ((ArticleCollectionActivity) getActivity()).toggleFullScreen();
     return true;
   }
   if (itemId == R.id.action_zoom_in) {
     view.textZoomIn();
     return true;
   }
   if (itemId == R.id.action_zoom_out) {
     view.textZoomOut();
     return true;
   }
   if (itemId == R.id.action_zoom_reset) {
     view.resetTextZoom();
     return true;
   }
   if (itemId == R.id.action_load_remote_content) {
     view.forceLoadRemoteContent = true;
     view.reload();
     return true;
   }
   if (itemId == R.id.action_select_style) {
     AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
     final String[] styleTitles = view.getAvailableStyles();
     builder
         .setTitle(R.string.select_style)
         .setItems(
             styleTitles,
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int which) {
                 String title = styleTitles[which];
                 view.saveStylePref(title);
                 view.applyStylePref();
               }
             });
     AlertDialog dialog = builder.create();
     dialog.show();
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
 void applyStylePref() {
   if (view != null) {
     view.applyStylePref();
   }
 }
 void applyTextZoomPref() {
   if (view != null) {
     view.applyTextZoomPref();
   }
 }