public void showProgressDialog(final int messageId) {
    try {
      final MainPanel panel = mFileSystemController.getActivePanel();
      panel
          .getActivity()
          .runOnUiThread(
              new Runnable() {
                @Override
                public void run() {
                  if (mProgressDialog != null && mProgressDialog.isShowing()) {
                    dismissProgressDialog();
                  }

                  mProgressDialog =
                      new Dialog(panel.getActivity(), android.R.style.Theme_Translucent);
                  mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                  mProgressDialog.setCancelable(false);
                  mProgressDialog.setContentView(R.layout.dialog_progress);
                  mProgressDialog.show();
                }
              });
      ((TextView) mProgressDialog.findViewById(R.id.progress_bar_text)).setText(messageId);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 private void showErrorDialog(String message) {
   try {
     ErrorDialog.newInstance(message)
         .show(
             mFileSystemController.getActivePanel().getActivity().getSupportFragmentManager(),
             "errorDialog");
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
 private void handleNetworkAuthError(Exception e) {
   mFileSystemController
       .getActivePanel()
       .getActivity()
       .runOnUiThread(
           new Runnable() {
             @Override
             public void run() {
               ToastNotification.makeText(
                       App.sInstance.getApplicationContext(),
                       App.sInstance.getString(R.string.error_unknown_unexpected_error),
                       Toast.LENGTH_LONG)
                   .show();
             }
           });
   dismissProgressDialog();
   e.printStackTrace();
 }