@Override
 public void onPreExecute() {
   Resources res = getResources();
   if (mProgressDialog != null && mProgressDialog.isShowing()) {
     mProgressDialog.setMessage(res.getString(R.string.card_browser_sorting_cards));
   } else {
     mProgressDialog =
         StyledProgressDialog.show(
             CardBrowser.this, "", res.getString(R.string.card_browser_sorting_cards), true);
   }
 }
        @Override
        public void onPreExecute() {
          if (!mUndoRedoDialogShowing) {
            if (mProgressDialog != null && mProgressDialog.isShowing()) {
              mProgressDialog.setMessage(getResources().getString(R.string.card_browser_load));
              mProgressDialog.setOnCancelListener(
                  new OnCancelListener() {

                    @Override
                    public void onCancel(DialogInterface arg0) {
                      canceled = true;
                      DeckTask.cancelTask();
                      closeCardBrowser();
                    }
                  });
            } else {
              mProgressDialog =
                  StyledProgressDialog.show(
                      CardBrowser.this,
                      "",
                      getResources().getString(R.string.card_browser_load),
                      true,
                      true,
                      new OnCancelListener() {

                        @Override
                        public void onCancel(DialogInterface arg0) {
                          canceled = true;
                          DeckTask.cancelTask();
                          closeCardBrowser();
                        }
                      });
            }
          } else {
            mProgressDialog.setMessage(getResources().getString(R.string.card_browser_load));
            mUndoRedoDialogShowing = false;
          }
        }