private void initProgressDialog() {
   progressDialog = new ProgressDialog(context);
   progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
   progressDialog.setMessage(message);
   progressDialog.setOnCancelListener(this);
   progressDialog.show();
 }
Ejemplo n.º 2
0
 void showProgress(int msgId) {
   progress = new ProgressDialog(this);
   progress.setMessage(getString(msgId));
   progress.setIndeterminate(true);
   progress.setCancelable(true);
   progress.setOnCancelListener(abortListener);
   final int msgId2 = msgId;
   progress.setButton(
       DialogInterface.BUTTON_POSITIVE,
       getString(R.string.background),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface d, int which) {
           // Cheat slightly: just launch home screen
           startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
           // Argh, can't prevent a dismiss at this point, so re-show it
           showProgress(msgId2);
           Toast.makeText(SGTPuzzles.this, R.string.bg_unreliable_warn, Toast.LENGTH_LONG).show();
         }
       });
   progress.setButton(
       DialogInterface.BUTTON_NEGATIVE,
       getString(android.R.string.cancel),
       handler.obtainMessage(MsgType.ABORT.ordinal()));
   progress.show();
 }
 @Override
 protected void onPreExecute() {
   progressDialog = new ProgressDialog(this.context);
   progressDialog.setMessage("正在上传照片,请稍候...");
   progressDialog.setIndeterminate(false);
   progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
   progressDialog.setCanceledOnTouchOutside(false);
   progressDialog.setCancelable(true);
   progressDialog.setOnCancelListener(
       new DialogInterface.OnCancelListener() {
         @Override
         public void onCancel(DialogInterface dialogInterface) {
           alertUser();
         }
       });
   progressDialog.setButton(
       DialogInterface.BUTTON_POSITIVE,
       "取消",
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialogInterface, int i) {
           alertUser();
         }
       });
   progressDialog.setMax(total);
   progressDialog.show();
 }
Ejemplo n.º 4
0
  @Override
  protected void onPreExecute() {
    progressDialog.setTitle(titleId);
    progressDialog.setMessage(activity.getString(messageId));
    progressDialog.setIndeterminate(false);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(
        new DialogInterface.OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            ProgressingTask.this.cancel(false);
          }
        });
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setProgress(0);
    progressDialog.setMax(100);
    // progressDialog.setProgressNumberFormat(null); // requires API level 11 (Android 3.0.x)
    progressDialog.show();

    progress =
        new Progress() {
          @Override
          public boolean isCancelled() {
            return ProgressingTask.this.isCancelled();
          }

          @Override
          public void publishProgress(int value) {
            ProgressingTask.this.publishProgress(value);
          }
        };
  }
 private void startProgress(CharSequence message) {
   if (mProgress == null) {
     mProgress = new NonSearchableProgressDialog(this);
     mProgress.setIndeterminate(true);
     mProgress.setCanceledOnTouchOutside(false);
     setProgressMessage(message != null ? message : getText(R.string.msg_validating_phone));
     mProgress.setOnCancelListener(
         new OnCancelListener() {
           @Override
           public void onCancel(DialogInterface dialog) {
             keepScreenOn(false);
             Toast.makeText(
                     NumberValidation.this, R.string.msg_validation_canceled, Toast.LENGTH_LONG)
                 .show();
             abort();
           }
         });
     mProgress.setOnDismissListener(
         new OnDismissListener() {
           public void onDismiss(DialogInterface dialog) {
             // remove sync starter
             if (mSyncStart != null) {
               mHandler.removeCallbacks(mSyncStart);
               mSyncStart = null;
             }
           }
         });
   }
   mProgress.show();
 }
  private void getNC() {
    List<NameValuePair> targVar = new ArrayList<NameValuePair>();
    targVar.add(
        Wenku8Interface.getNovelContent(currentAid, currentCid, GlobalConfig.getFetchLanguage()));

    final asyncNovelContentTask ast = new asyncNovelContentTask();
    ast.execute(targVar);

    pDialog = new ProgressDialog(parentActivity);
    pDialog.setTitle(getResources().getString(R.string.load_status));
    pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    pDialog.setCancelable(true);
    pDialog.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            // TODO Auto-generated method stub
            ast.cancel(true);
            pDialog.dismiss();
            pDialog = null;
          }
        });
    pDialog.setMessage(getResources().getString(R.string.load_loading));
    pDialog.setProgress(0);
    pDialog.setMax(1);
    pDialog.show();

    return;
  }
Ejemplo n.º 7
0
  @Override
  protected Dialog onCreateDialog(int id, Bundle args) {
    final ProgressDialog dialog = new ProgressDialog(this.getParent());
    dialog.setTitle("Please Wait...");
    dialog.setIndeterminate(true);
    dialog.setMessage(String.valueOf(strProgressMessage));
    dialog.setCancelable(true);
    dialog.setOnCancelListener(
        new DialogInterface.OnCancelListener() {
          public void onCancel(DialogInterface dialog) {
            Log.i("LOCATOR", "user cancelling authentication");
          }
        });

    dialog.setOnKeyListener(
        new DialogInterface.OnKeyListener() {
          @Override
          public boolean onKey(DialogInterface arg0, int keyCode, KeyEvent event) {
            // TODO Auto-generated method stub
            if (((keyCode == KeyEvent.KEYCODE_SEARCH) || (keyCode == KeyEvent.KEYCODE_MENU))) {
              return true;
            }
            return false;
          }
        });
    mProgressDialog = dialog;
    return dialog;
  }
Ejemplo n.º 8
0
  private void showMapWithLocationClient() {
    progressDialog = new ProgressDialog(this);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("正在确定你的位置...");

    progressDialog.setOnCancelListener(
        new OnCancelListener() {

          public void onCancel(DialogInterface arg0) {
            if (progressDialog.isShowing()) {
              progressDialog.dismiss();
            }
            Log.d("map", "cancel retrieve location");
            finish();
          }
        });

    progressDialog.show();

    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);

    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    // option.setCoorType("bd09ll"); //设置坐标类型
    // Johnson change to use gcj02 coordination. chinese national standard
    // so need to conver to bd09 everytime when draw on baidu map
    option.setCoorType("gcj02");
    option.setScanSpan(30000);
    option.setAddrType("all");
    mLocClient.setLocOption(option);
  }
  /**
   * Called when the activity is first created. Retrieves the wufoo form and inserts it into the
   * view.
   *
   * @param savedInstanceState Um I don't even know. Read the Android documentation.
   */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (android.os.Build.VERSION.SDK_INT >= 11) setTheme(R.style.Default_New);
    super.onCreate(savedInstanceState);

    wv = new WebView(this);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.addJavascriptInterface(new JavascriptInterface(), "HTMLOUT");
    wv.setWebViewClient(new RestoreDraftClient());

    FrameLayout fl = new FrameLayout(this);
    fl.setBackgroundResource(R.color.backClr);
    fl.addView(wv);
    setContentView(fl);
    setTitle(R.string.contact);

    baconPDialog =
        Callisto.BaconDialog(
            ContactForm.this, this.getResources().getString(R.string.loading) + "...", null);
    baconPDialog.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            // Finish the activity if the fetching is canceled
            finish();
          }
        });
    baconPDialog.setCancelable(true);
    thatWhichWillReadTheCSS = new ReadCSS();
    thatWhichWillReadTheCSS.execute((Void[]) null);
  }
 public void setOnCancelListener(final DialogInterface.OnCancelListener paramOnCancelListener)
 {
   if (paramOnCancelListener != null)
   {
     spinner.setOnCancelListener(new DialogInterface.OnCancelListener()
     {
       public void onCancel(DialogInterface paramAnonymousDialogInterface)
       {
         BusyJSI.spinner.setOnCancelListener(null);
         paramOnCancelListener.onCancel(paramAnonymousDialogInterface);
       }
     });
     return;
   }
   spinner.setOnCancelListener(null);
 }
 /**
  * TODO: change Toast messages to another AlertDialog (i do not know how to do this, i hate
  * Android UI)
  *
  * @param emailAddress
  * @param emailDomain
  */
 private void sendResetPasswordEmail(final String emailAddress) {
   final ProgressDialog resetPasswordProgressDialog = new ProgressDialog(context);
   resetPasswordProgressDialog.setTitle(getString(R.string.label_reset_password));
   resetPasswordProgressDialog.setMessage(getString(R.string.dialog_resetting_password));
   resetPasswordProgressDialog.setIndeterminate(true);
   resetPasswordProgressDialog.setCancelable(true);
   resetPasswordProgressDialog.setOnCancelListener(
       new OnCancelListener() {
         @Override
         public void onCancel(DialogInterface dialog) {
           dialog.dismiss();
         }
       });
   resetPasswordProgressDialog.show();
   Thread thread =
       new Thread(
           new Runnable() {
             @Override
             public void run() {
               Looper.prepare();
               try {
                 lewaAuthService.resetPassword(
                     new SendResetPasswordEmailHandler(resetPasswordProgressDialog), emailAddress);
               } catch (APIException e) {
                 Log.e(TAG, "api exception not caught"); // can never get
                 // here
               } catch (IOException e) {
                 Log.e(TAG, "io exception not caught"); // can never get here
               }
             }
           });
   thread.start();
 }
 private void setupProgressDialog(Context context) {
   // Setup progress dialog
   mProgressDialog = new ProgressDialog(context);
   mProgressDialog.setIndeterminate(true);
   mProgressDialog.setCancelable(false);
   mProgressDialog.setOnCancelListener(this);
 }
Ejemplo n.º 13
0
 private void performSearch(String query) {
   progressDialog =
       ProgressDialog.show(MainActivity.this, "Please wait...", "Retrieving data...", true, true);
   PerformLoginTask task = new PerformLoginTask();
   task.execute(query);
   progressDialog.setOnCancelListener(new CancelTaskOnCancelListener(task));
 }
Ejemplo n.º 14
0
  public void startGameSearch() {
    fTCPClient = TCPClient.getInstance();

    fTCPClient.subscribeToCommand(ServerCommandType.ServerSettings, this);
    fTCPClient.subscribeToCommand(ServerCommandType.PlayerFound, this);
    fTCPClient.subscribeToCommand(ServerCommandType.Error, this);

    fTCPClient.connect();

    fTCPClient.sendCommand(
        new UpdateNameCommand(PlayerSettings.getInstance(MainActivity.this).getPlayerName()));

    fProgressDialog = new ProgressDialog(MainActivity.this);
    fProgressDialog.setMessage("Searching for Player...");
    fProgressDialog.setCancelable(true);
    fProgressDialog.setOnCancelListener(
        new DialogInterface.OnCancelListener() {

          @Override
          public void onCancel(DialogInterface dialog) {
            fTCPClient.disconnect();
          }
        });

    runOnUiThread(
        new Runnable() {

          @Override
          public void run() {
            fProgressDialog.show();
          }
        });
  }
Ejemplo n.º 15
0
  /**
   * Shows the ProgressDialog.
   *
   * @param context -The Activity which needs the ProgressDialog.
   * @param title -The title.
   * @param message -The message.
   * @param cancelListener -The OnCancelListener.
   * @return - A progress dialog.
   */
  public static ProgressDialog showPrgressDialog(
      Context context, String title, String message, OnCancelListener cancelListener) {
    ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true);
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(cancelListener);

    return progressDialog;
  }
Ejemplo n.º 16
0
 @Override
 protected void onPreExecute() {
   pd = new ProgressDialog(mContext);
   // pd.setTitle("Procesando Datos...");
   pd.setMessage("Espere...                    ");
   pd.setCancelable(true);
   pd.setOnCancelListener(this);
   pd.setIndeterminate(true);
   pd.show();
 }
Ejemplo n.º 17
0
 public static ProgressDialog showProgressDialog(
     Activity context, int message, ProgressDialog.OnCancelListener cancelListener) {
   ProgressDialog mDialog = new ProgressDialog(context);
   mDialog.setCancelable(cancelListener != null);
   mDialog.setOnCancelListener(cancelListener);
   mDialog.setMessage(context.getString(message));
   mDialog.setIndeterminate(true);
   mDialog.show();
   return mDialog;
 }
Ejemplo n.º 18
0
  @Override
  protected void onPreExecute() {
    super.onPreExecute();

    if (isShowDialog) {
      dialog = ProgressDialog.show(context, null, context.getString(R.string.msg_comment_sending));
      dialog.setCancelable(true);
      dialog.setOnCancelListener(onCancelListener);
    }
  }
Ejemplo n.º 19
0
 /*
  * (non-Javadoc)加载之前的回调方法
  *
  * @see android.os.AsyncTask#onPreExecute()
  */
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   mProgress = new ProgressDialog(WeiboWriteImage.this);
   mProgress.setIndeterminate(true);
   mProgress.setCancelable(true);
   mProgress.setMessage("加载图片...");
   mProgress.setOnCancelListener(this);
   mProgress.show();
 }
Ejemplo n.º 20
0
 @Override
 protected void onPreExecute() {
   progressdialogInit = new ProgressDialog(TvChannelViewPagerActivity.this);
   progressdialogInit.setTitle("Load");
   progressdialogInit.setMessage("Loading…");
   progressdialogInit.setOnCancelListener(cancelListener);
   progressdialogInit.setCanceledOnTouchOutside(false);
   progressdialogInit.show();
   super.onPreExecute();
 }
Ejemplo n.º 21
0
 @Override
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case DIALOG_MAP_VERSION_UPDATE:
       AlertDialog.Builder builder = new AlertDialog.Builder(this);
       builder.setMessage(R.string.map_version_changed_info);
       builder.setPositiveButton(
           R.string.button_upgrade_osmandplus,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               Intent intent =
                   new Intent(
                       Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:net.osmand.plus"));
               try {
                 startActivity(intent);
               } catch (ActivityNotFoundException e) {
               }
             }
           });
       builder.setNegativeButton(
           R.string.default_buttons_cancel,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               removeDialog(DIALOG_MAP_VERSION_UPDATE);
             }
           });
       return builder.create();
     case DIALOG_PROGRESS_LIST:
       ProgressDialog dialog = new ProgressDialog(this);
       dialog.setTitle(R.string.downloading);
       dialog.setMessage(getString(R.string.downloading_list_indexes));
       dialog.setCancelable(true);
       return dialog;
     case DIALOG_PROGRESS_FILE:
       ProgressDialogImplementation progress =
           ProgressDialogImplementation.createProgressDialog(
               DownloadIndexActivity.this,
               getString(R.string.downloading),
               getString(R.string.downloading_file),
               ProgressDialog.STYLE_HORIZONTAL);
       progressFileDlg = progress.getDialog();
       progressFileDlg.setOnCancelListener(
           new DialogInterface.OnCancelListener() {
             @Override
             public void onCancel(DialogInterface dialog) {
               downloadFileHelper.setInterruptDownloading(true);
             }
           });
       return progress.getDialog();
   }
   return null;
 }
Ejemplo n.º 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    handler = new Handler();
    Util.getDisplayDpi(getContext());

    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mSpinner.setCancelable(true);

    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();

    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    int orientation = getContext().getResources().getConfiguration().orientation;
    float[] dimensions =
        (orientation == Configuration.ORIENTATION_LANDSCAPE)
            ? DIMENSIONS_DIFF_LANDSCAPE
            : DIMENSIONS_DIFF_PORTRAIT;

    addContentView(
        mContent,
        new LinearLayout.LayoutParams(
            display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)),
            display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));

    mSpinner.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialogInterface) {
            mWebView.stopLoading();
            mListener.onBack();
            SocialAuthDialog.this.dismiss();
          }
        });

    this.setOnKeyListener(
        new OnKeyListener() {
          @Override
          public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
              mWebView.stopLoading();
              dismiss();
              mListener.onBack();
              return true;
            }
            return false;
          }
        });
  }
Ejemplo n.º 23
0
 protected void performSearch(String user) {
   try {
     progressDialog =
         ProgressDialog.show(
             SyncActivity.this, "Silakan tunggu", "Proses sedang berjalan", true, true);
     PerformUserSearchTask task = new PerformUserSearchTask();
     task.execute(user);
     progressDialog.setOnCancelListener(new CancelTaskOnCancelListener(task));
   } catch (Exception e) {
     longToast("Login Failure " + e.getMessage());
   }
 }
Ejemplo n.º 24
0
  @Override
  protected void onPreExecute() {
    super.onPreExecute();

    if (isShowDialog) {
      dialog =
          ProgressDialog.show(
              context, null, context.getString(R.string.msg_profile_photo_uploading));
      dialog.setCancelable(true);
      dialog.setOnCancelListener(onCancelListener);
      dialog.setOwnerActivity((Activity) context);
    }
  }
Ejemplo n.º 25
0
 private Dialog createProgressDialog() {
   ProgressDialog pd = new ProgressDialog(this);
   pd.setMessage(getResources().getString(R.string.loading_oauth_page));
   pd.setCanceledOnTouchOutside(false);
   pd.setOnCancelListener(
       new OnCancelListener() {
         @Override
         public void onCancel(DialogInterface dialog) {
           finish();
         }
       });
   return pd;
 }
Ejemplo n.º 26
0
 @Override
 protected void onPreExecute() {
   mDialog.setCancelable(true);
   mDialog.setIndeterminate(true);
   mDialog.setMessage(mActivity.getString(R.string.im_resolving_recipient));
   mDialog.setOnCancelListener(
       new OnCancelListener() {
         public void onCancel(DialogInterface dialog) {
           LookupNameTask.this.cancel(true);
         }
       });
   mDialog.show();
 }
Ejemplo n.º 27
0
    protected void onPreExecute() {

      progressDialog.setMessage("Logging in...");
      progressDialog.show();
      progressDialog.setOnCancelListener(
          new OnCancelListener() {

            @Override
            public void onCancel(DialogInterface arg0) {
              LoginTask.this.cancel(true);
            }
          });
    }
Ejemplo n.º 28
0
  public Controller(Context ctx, DaumAuthView authView) {
    this.ctx = ctx;
    this.authView = authView;

    // creating uiHandler into the UI Thread (because controller must be called in it)
    this.uiHandler = new Handler(callback);

    // creating loading dialog
    pDialog = new ProgressDialog(ctx);
    pDialog.setIndeterminate(true);
    pDialog.setMessage(TEXT_LOADING);
    pDialog.setOnCancelListener(cancelListener);
    pDialog.setCanceledOnTouchOutside(false);
  }
Ejemplo n.º 29
0
 @Override
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case PROGRESS_DIALOG_ID:
       ProgressDialog dialog = new ProgressDialog(this);
       dialog.setMessage(getString(R.string.maps__obtaining_location));
       dialog.setIndeterminate(true);
       dialog.setCancelable(true);
       dialog.setOnCancelListener(this);
       return dialog;
     default:
       return super.onCreateDialog(id);
   }
 }
 @Override
 protected Dialog onCreateDialog(int id) {
   final ProgressDialog dialog = new ProgressDialog(this);
   dialog.setMessage(getText(string.message_signing_in));
   dialog.setIndeterminate(true);
   dialog.setCancelable(true);
   dialog.setOnCancelListener(
       new DialogInterface.OnCancelListener() {
         public void onCancel(DialogInterface dialog) {
           if (authenticationTask != null) authenticationTask.cancel(true);
         }
       });
   return dialog;
 }