@Override
    protected void onPreExecute() {
      if (dialogShow) {
        progDialog = new ProgressDialog(RssReaderActivity.this);
        progDialog.setCancelable(false);
        progDialog.setMessage(getString(R.string.rss_fetching));
        progDialog.setButton(
            DialogInterface.BUTTON_NEGATIVE,
            getString(R.string.btn_hide_text),
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                Toast.makeText(
                        RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
                    .show();
              }
            });
        progDialog.show();
      } else
        Toast.makeText(RssReaderActivity.this, R.string.rss_start_updating, Toast.LENGTH_SHORT)
            .show();

      isTaskRunning = true;
    }
  private static void creerProgressDialog() {
    mProgressDialog = new ProgressDialog(AppData.currentContext);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    mProgressDialog.setTitle(AppData.currentContext.getString(R.string.loading));
    mProgressDialog.setMessage(AppData.currentContext.getString(R.string.startLoading));

    mProgressDialog.setMax(100);
    mProgressDialog.setProgress(0);
    mProgressDialog.setCancelable(false);
  }
Beispiel #3
0
 @Override
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case PROGRESS_DIALOG:
       progressDialog = new ProgressDialog(D4.this);
       progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
       progressDialog.setMessage("Loading...");
       return progressDialog;
     default:
       return null;
   }
 }
Beispiel #4
0
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case 0:
       mProgress = new ProgressDialog(this);
       mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
       mProgress.setTitle("Updating");
       mProgress.setMessage("Wait...");
       mProgress.setCancelable(false);
       mProgress.setButton(
           "Cancel",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int whichButton) {
               mQuit = true;
               dismissDialog(0);
             }
           });
       return mProgress;
   }
   return null;
 }
 /**
  * creates a new EncryptionSwingWorker
  *
  * @param parentFrame the parent frame
  * @param backupMainPanel the BackupMainPanel
  * @param destinationPath the path of the current destination directory
  * @param encfsPlainDir the plaintext encfs dir where to copy the files into
  * @param encfsCipherPath the path of the ciphertext encfs dir
  * @param password the encfs password
  */
 public EncryptionFinishSwingWorker(
     Frame parentFrame,
     BackupMainPanel backupMainPanel,
     String destinationPath,
     File encfsPlainDir,
     String encfsCipherPath,
     String password) {
   this.parentFrame = parentFrame;
   this.backupMainPanel = backupMainPanel;
   this.destinationPath = destinationPath;
   this.encfsPlainDir = encfsPlainDir;
   this.encfsCipherPath = encfsCipherPath;
   this.password = password;
   encfsPath = encfsPlainDir.getPath();
   processExecutor = new ProcessExecutor();
   ProgressDialog progressDialog = new ProgressDialog(parentFrame, processExecutor);
   progressDialog.setIcon(IconManager.INFORMATION_ICON);
   progressDialog.setMessage(BUNDLE.getString("Removing_Unencrypted_Files"));
   progressDialog.setSpecialIcon(null);
   progressDialog.setIndeterminate(true);
   progressDialog.setCancelButtonVisible(false);
   dialogHandler = new ModalDialogHandler(progressDialog);
   dialogHandler.show();
 }
  /**
   * Enable SMS notifications by configuring the VoIP.ms URL callback, registering for GCM and
   * making the appropriate changes to the application preferences.
   *
   * @param activity The source activity.
   */
  public void enableNotifications(final Activity activity) {
    if (preferences.getEmail().equals("")
        || preferences.getPassword().equals("")
        || preferences.getDid().equals("")) {
      Utils.showInfoDialog(
          activity,
          applicationContext.getString(R.string.notifications_callback_username_password_did));
      return;
    }

    final ProgressDialog progressDialog = new ProgressDialog(activity);
    progressDialog.setMessage(activity.getString(R.string.notifications_callback_progress));
    progressDialog.setCancelable(false);
    progressDialog.show();

    new AsyncTask<Boolean, Void, Boolean>() {
      @Override
      protected Boolean doInBackground(Boolean... params) {
        try {
          String url =
              "https://www.voip.ms/api/v1/rest.php?"
                  + "api_username="******"UTF-8")
                  + "&"
                  + "api_password="******"UTF-8")
                  + "&"
                  + "method=setSMS"
                  + "&"
                  + "did="
                  + URLEncoder.encode(preferences.getDid(), "UTF-8")
                  + "&"
                  + "enable=1"
                  + "&"
                  + "url_callback_enable=1"
                  + "&"
                  + "url_callback="
                  + URLEncoder.encode(
                      "http://voipmssms-kourlas.rhcloud.com/sms_callback?did={TO}", "UTF-8")
                  + "&"
                  + "url_callback_retry=0";

          JSONObject result = Utils.getJson(url);
          String status = result.optString("status");
          return !(status == null || !status.equals("success"));
        } catch (Exception ex) {
          return false;
        }
      }

      @Override
      protected void onPostExecute(Boolean success) {
        progressDialog.hide();

        DialogInterface.OnClickListener gcmOnClickListener =
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                gcm.registerForGcm(activity, true, true);
              }
            };

        if (!success) {
          Utils.showAlertDialog(
              activity,
              null,
              applicationContext.getString(R.string.notifications_callback_fail),
              applicationContext.getString(R.string.ok),
              gcmOnClickListener,
              null,
              null);
        } else {
          Utils.showAlertDialog(
              activity,
              null,
              applicationContext.getString(R.string.notifications_callback_success),
              applicationContext.getString(R.string.ok),
              gcmOnClickListener,
              null,
              null);
        }
      }
    }.execute();
  }