@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;
    }
Esempio n. 2
0
  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);
  }
Esempio n. 3
0
  protected void initWidget() {
    mTipDlg = new ProgressDialog(this, R.string.dlg_login_server_tip);
    mTipDlg.setCancelable(false);
    m_device_id = getIntent().getStringExtra(Constant.EXTRA_DEVICE_ID);
    m_tb_h_flip = (ToggleButton) findViewById(R.id.tb_image_h_flip);
    m_tb_v_flip = (ToggleButton) findViewById(R.id.tb_image_v_flip);

    Button btnFinish = (Button) findViewById(R.id.btnRight);
    btnFinish.setText(R.string.finish);
    btnFinish.setVisibility(View.VISIBLE);
    btnFinish.setOnClickListener(this);
    LibImpl.getInstance().setMediaParamHandler(m_handler);
    loadData();
  }
Esempio n. 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;
 }
Esempio n. 5
0
 /**
  * Specify whether this HUD can be cancelled by using back button (default is false)
  *
  * @return Current HUD
  */
 public KProgressHUD setCancellable(boolean isCancellable) {
   mProgressDialog.setCancelable(isCancellable);
   return this;
 }
Esempio n. 6
0
  /**
   * 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();
  }