Example usage for android.app ProgressDialog STYLE_SPINNER

List of usage examples for android.app ProgressDialog STYLE_SPINNER

Introduction

In this page you can find the example usage for android.app ProgressDialog STYLE_SPINNER.

Prototype

int STYLE_SPINNER

To view the source code for android.app ProgressDialog STYLE_SPINNER.

Click Source Link

Document

Creates a ProgressDialog with a circular, spinning progress bar.

Usage

From source file:com.realtek.simpleconfig.SCTest.java

/** ??? */
@SuppressWarnings("deprecation")
public void RenameDevProgressPopUp(final String input_pin, final String ip, final String dev_name) {
    final EditText editText = new EditText(SCTest.this);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(dev_name).setCancelable(false).setMessage("Please input the new name:").setView(editText)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override/*from w  w  w . java 2  s .c  o m*/
                public void onClick(DialogInterface dialog, int id) {
                    ReNameStr = editText.getText().toString();
                    if (ReNameStr.length() > 0) {

                        RenameDevFirstShow = true;
                        renameDevDialog.setTitle(dev_name);
                        if (ip.equals("0.0.0.0")) {
                            renameDevDialog.setMessage("  ?IP......");
                        } else {
                            SendCtlDevPacket(SCCtlOps.Flag.RenameDev, input_pin, ip, ReNameStr);
                            renameDevDialog.setMessage("    ???......");
                        }
                        renameDevDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                        renameDevDialog.setCancelable(false);
                        renameDevDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                            }
                        });
                        renameDevDialog.show();
                    }
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    builder.show();
}

From source file:com.brq.wallet.activity.modern.AccountsFragment.java

private void setCoinapultMail() {

    AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
    b.setTitle(getString(R.string.coinapult_mail_question));
    View diaView = getActivity().getLayoutInflater().inflate(R.layout.ext_coinapult_mail, null);
    final EditText mailField = (EditText) diaView.findViewById(R.id.mail);
    mailField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    String email = _mbwManager.getMetadataStorage().getCoinapultMail();
    if (!email.isEmpty()) {
        mailField.setText(email);/*from   w  ww  . j  a va 2s . c  o  m*/
    }
    b.setView(diaView);
    b.setPositiveButton(getString(R.string.button_done), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String mailText = mailField.getText().toString();
            if (Utils.isValidEmailAddress(mailText)) {
                Optional<String> mail;
                if (mailText.isEmpty()) {
                    mail = Optional.absent();
                } else {
                    mail = Optional.of(mailText);
                }
                _progress.setCancelable(false);
                _progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                _progress.setMessage(getString(R.string.coinapult_setting_email));
                _progress.show();
                _mbwManager.getMetadataStorage().setCoinapultMail(mailText);
                new SetCoinapultMailAsyncTask(mail).execute();
                dialog.dismiss();
            } else {
                new Toaster(AccountsFragment.this).toast("Email address not valid", false);
            }
        }
    });
    b.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    AlertDialog dialog = b.create();
    dialog.show();
}

From source file:com.mobicage.rogerthat.util.ui.UIUtils.java

public static ProgressDialog showProgressDialog(Context context, CharSequence title, CharSequence message,
        boolean indeterminate, boolean cancelable, DialogInterface.OnCancelListener onCancelListener) {
    return UIUtils.showProgressDialog(context, title, message, indeterminate, cancelable, onCancelListener,
            ProgressDialog.STYLE_SPINNER, true);
}

From source file:com.realtek.simpleconfig.SCTest.java

/** ? */
@SuppressWarnings("deprecation")
public void StartConfigPopUp() {
    cfgProgressDialog.setTitle("Wi-Fi: " + SCLib.getConnectedWifiSSID());
    cfgProgressDialog.setMessage("    ?......");
    /* ProgressDialog?: ? */
    cfgProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    cfgProgressDialog.setCancelable(false);
    cfgProgressDialog.setButton("Pause", new DialogInterface.OnClickListener() {
        @Override/*from w  w w.  j a  v a  2 s . c o m*/
        public void onClick(DialogInterface dialog, int which) {
            SCLib.rtk_sc_stop();
            ShowResultPopUp();
            dialog.cancel();
        }
    });
    cfgProgressDialog.show();
}

From source file:com.brq.wallet.activity.modern.AccountsFragment.java

private void verifyCoinapultMail() {
    AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
    b.setTitle(getString(R.string.coinapult_mail_verification));
    final String email = _mbwManager.getMetadataStorage().getCoinapultMail();
    View diaView = getActivity().getLayoutInflater().inflate(R.layout.ext_coinapult_mail_verification, null);
    final EditText verificationTextField = (EditText) diaView.findViewById(R.id.mailVerification);

    // check if there is a probable verification link in the clipboard and if so, pre-fill the textbox
    String clipboardString = Utils.getClipboardString(getActivity());
    if (!Strings.isNullOrEmpty(clipboardString) && clipboardString.contains("coinapult.com")) {
        verificationTextField.setText(clipboardString);
    }/*from ww w  .  j a v  a 2s .c  om*/

    b.setView(diaView);
    b.setPositiveButton(getString(R.string.button_done), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String verification = verificationTextField.getText().toString();
            _progress.setCancelable(false);
            _progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            _progress.setMessage(getString(R.string.coinapult_verifying_email));
            _progress.show();
            new VerifyCoinapultMailAsyncTask(verification, email).execute();
            dialog.dismiss();
        }
    });
    b.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    AlertDialog dialog = b.create();
    dialog.show();
}

From source file:com.mobicage.rogerthat.registration.RegistrationActivity2.java

private void onPinEntered() {

    final String pin = mEnterPinEditText.getText().toString();
    // Validate pin code
    if (!RegexPatterns.PIN.matcher(pin).matches()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(RegistrationActivity2.this);
        builder.setMessage(R.string.registration_invalid_pin);
        builder.setPositiveButton(R.string.rogerthat, null);
        AlertDialog dialog = builder.create();
        dialog.show();//  w  w w.jav  a2 s  .  co  m
        return;
    }
    // Make call to Rogerthat webfarm
    final ProgressDialog progressDialog = new ProgressDialog(RegistrationActivity2.this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog
            .setMessage(getString(R.string.registration_activating_account, getString(R.string.app_name)));
    progressDialog.setCancelable(false);
    progressDialog.show();
    final SafeRunnable showErrorDialog = new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.UI();
            progressDialog.dismiss();
            AlertDialog.Builder builder = new AlertDialog.Builder(RegistrationActivity2.this);
            builder.setMessage(R.string.registration_sending_pin_error);
            builder.setPositiveButton(R.string.rogerthat, null);
            AlertDialog dialog = builder.create();
            dialog.show();
        }
    };
    final String email = mWiz.getEmail();
    final String timestamp = "" + mWiz.getTimestamp();
    final String registrationId = mWiz.getRegistrationId();
    final String deviceId = mWiz.getDeviceId();

    mWorkerHandler.post(new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            T.REGISTRATION();
            String version = "2";
            String pinSignature = Security.sha256(version + " " + email + " " + timestamp + " " + deviceId + " "
                    + registrationId + " " + pin + CloudConstants.REGISTRATION_PIN_SIGNATURE);

            HttpPost httppost = new HttpPost(CloudConstants.REGISTRATION_PIN_URL);
            try {
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(6);
                nameValuePairs.add(new BasicNameValuePair("version", version));
                nameValuePairs.add(new BasicNameValuePair("email", email));
                nameValuePairs.add(new BasicNameValuePair("registration_time", timestamp));
                nameValuePairs.add(new BasicNameValuePair("device_id", deviceId));
                nameValuePairs.add(new BasicNameValuePair("registration_id", registrationId));
                nameValuePairs.add(new BasicNameValuePair("pin_code", pin));
                nameValuePairs.add(new BasicNameValuePair("pin_signature", pinSignature));
                nameValuePairs.add(new BasicNameValuePair("request_id", UUID.randomUUID().toString()));
                nameValuePairs.add(new BasicNameValuePair("app_id", CloudConstants.APP_ID));
                nameValuePairs.add(
                        new BasicNameValuePair("use_xmpp_kick", CloudConstants.USE_XMPP_KICK_CHANNEL + ""));
                nameValuePairs.add(new BasicNameValuePair("GCM_registration_id", mGCMRegistrationId));

                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                HttpResponse response = mHttpClient.execute(httppost);
                int statusCode = response.getStatusLine().getStatusCode();
                HttpEntity entity = response.getEntity();
                if (statusCode != 200 || entity == null) {
                    mUIHandler.post(showErrorDialog);
                    return;
                }
                @SuppressWarnings("unchecked")
                final Map<String, Object> responseMap = (Map<String, Object>) org.json.simple.JSONValue
                        .parse(new InputStreamReader(entity.getContent()));
                if ("success".equals(responseMap.get("result"))) {

                    JSONObject account = (JSONObject) responseMap.get("account");
                    final RegistrationInfo info = new RegistrationInfo(email,
                            new Credentials((String) account.get("account"), (String) account.get("password")));

                    mAgeAndGenderSet = (Boolean) responseMap.get("age_and_gender_set");
                    mUIHandler.post(new SafeRunnable() {
                        @Override
                        protected void safeRun() throws Exception {
                            T.UI();
                            hideNotification();
                            tryConnect(progressDialog, 1, getString(R.string.registration_establish_connection,
                                    email, getString(R.string.app_name)) + " ", info);
                        }
                    });
                } else {

                    final long attempts_left = (Long) responseMap.get("attempts_left");
                    mUIHandler.post(new SafeRunnable() {
                        @Override
                        protected void safeRun() throws Exception {
                            T.UI();
                            progressDialog.dismiss();
                            if (attempts_left > 0) {
                                AlertDialog.Builder builder = new AlertDialog.Builder(
                                        RegistrationActivity2.this);
                                builder.setMessage(getString(R.string.registration_incorrect_pin, email));
                                builder.setTitle(getString(R.string.registration_incorrect_pin_dialog_title));
                                builder.setPositiveButton(R.string.rogerthat, null);
                                AlertDialog dialog = builder.create();
                                dialog.show();
                                mEnterPinEditText.setText("");
                            } else {
                                hideNotification();
                                new AlertDialog.Builder(RegistrationActivity2.this)
                                        .setMessage(getString(R.string.registration_no_attempts_left))
                                        .setCancelable(true).setPositiveButton(R.string.try_again, null)
                                        .create().show();
                                mWiz.reInit();
                                mWiz.goBackToPrevious();
                                return;
                            }
                        }
                    });

                }
            } catch (Exception e) {
                L.d(e);
                mUIHandler.post(showErrorDialog);
            }
        }
    });

}

From source file:com.cssweb.android.common.FairyUI.java

private static void loadAllStock(final int paramInt1, final int paramInt2, final String paramString2,
        final String paramString3, final Context paramContext) {
    m_pDialog = new ProgressDialog(paramContext);
    m_pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    m_pDialog.setMessage(paramContext.getResources().getString(R.string.system_update_content));
    m_pDialog.setIndeterminate(false);//from ww  w.ja  v  a 2  s  .c  om
    m_pDialog.show();
    new AsyncTask<Void, Void, Boolean>() {
        /**
         * ?????
         */
        @Override
        protected Boolean doInBackground(Void... arg0) {
            boolean flag = true;
            JSONObject quoteData = null;
            try {
                quoteData = ConnService.getAllStock();
                if (Utils.isHttpStatus(quoteData)) {
                    CssIniFile.saveAllStockData(paramContext, CssIniFile.UserStockFile, quoteData.toString());
                    StockInfo.initAllStock(quoteData);
                    StockInfo.allStock = quoteData;
                } else {
                    flag = Boolean.FALSE;
                }
            } catch (JSONException e) {
                flag = Boolean.FALSE;
            } catch (Exception e) {
                flag = Boolean.FALSE;
            }
            return flag;
        }

        /**
         * ?
         */
        protected void onPostExecute(Boolean result) {
            hiddenProgress();
            if (result != Boolean.TRUE) {
                Toast.makeText(paramContext, R.string.load_data_error, Toast.LENGTH_SHORT).show();
            } else {
                switchToWnd(paramInt1, paramInt2, paramString2, paramString3, paramContext);
            }
        }
    }.execute();
}

From source file:com.ringdroid.RingdroidEditActivity.java

private void saveRingtone(final CharSequence title) {
    final String outPath = makeRingtoneFilename(title, mExtension);

    if (outPath == null) {
        showFinalAlert(new Exception(), R.string.no_unique_filename);
        return;/*from   ww w.ja v  a  2  s.  co m*/
    }

    mDstFilename = outPath;

    double startTime = mWaveformView.pixelsToSeconds(mStartPos);
    double endTime = mWaveformView.pixelsToSeconds(mEndPos);
    final int startFrame = mWaveformView.secondsToFrames(startTime);
    final int endFrame = mWaveformView.secondsToFrames(endTime);
    final int duration = (int) (endTime - startTime + 0.5);

    // Create an indeterminate progress dialog
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setTitle(R.string.progress_dialog_saving);
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setCancelable(false);
    mProgressDialog.show();

    // Save the sound file in a background thread
    new Thread() {
        public void run() {
            final File outFile = new File(outPath);
            try {
                // Write the new file
                mSoundFile.WriteFile(outFile, startFrame, endFrame - startFrame);

                // Try to load the new file to make sure it worked
                final CheapSoundFile.ProgressListener listener = new CheapSoundFile.ProgressListener() {
                    public boolean reportProgress(double frac) {
                        // Do nothing - we're not going to try to
                        // estimate when reloading a saved sound
                        // since it's usually fast, but hard to
                        // estimate anyway.
                        return true; // Keep going
                    }
                };
                CheapSoundFile.create(outPath, listener);
            } catch (Exception e) {
                mProgressDialog.dismiss();

                CharSequence errorMessage;
                if (e.getMessage() != null && e.getMessage().equals("No space left on device")) {
                    errorMessage = getResources().getText(R.string.no_space_error);
                    e = null;
                } else {
                    errorMessage = getResources().getText(R.string.write_error);
                }

                final CharSequence finalErrorMessage = errorMessage;
                final Exception finalException = e;
                Runnable runnable = new Runnable() {
                    public void run() {
                        handleFatalError("WriteError", finalErrorMessage, finalException);
                    }
                };
                mHandler.post(runnable);
                return;
            }

            mProgressDialog.dismiss();

            Runnable runnable = new Runnable() {
                public void run() {
                    afterSavingRingtone(title, outPath, outFile, duration);
                }
            };
            mHandler.post(runnable);
        }
    }.start();
}

From source file:com.example.android.camera2basic.fragments.Camera2BasicFragment.java

public void upload() {

    //Crea y muestra barra de progreso
    final ProgressDialog mProgressDialog = new ProgressDialog(getActivity());

    mProgressDialog.setIndeterminate(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setMessage("Subiendo foto...");

    mProgressDialog.show();/*  ww w.  j av  a2s .c o m*/

    //Retrofit
    Retrofit retrofit = new Retrofit.Builder().baseUrl(FileUploadService.ENDPOINT)
            .addConverterFactory(GsonConverterFactory.create()).build();

    // create upload service client
    FileUploadService service = retrofit.create(FileUploadService.class);

    // create RequestBody instance from file
    RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), mFile);

    // MultipartBody.Part is used to send also the actual file name
    MultipartBody.Part body = MultipartBody.Part.createFormData("fichero", mFile.getName(), requestFile);

    // finally, execute the request
    Call<ResponseBody> call = service.upload(body);
    call.enqueue(new Callback<ResponseBody>() {
        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {

            if (response.isSuccessful()) {
                mProgressDialog.hide();//Oculta progressDialog

                showToast("Upload picture success");

                Log.v(TAG, "success");
            } else {
                mProgressDialog.hide();//Oculta progressDialog

                showToast("Upload error:" + response.code());

                Log.e(TAG, "Code: " + response.code());
            }

        }

        @Override
        public void onFailure(Call<ResponseBody> call, Throwable t) {
            mProgressDialog.hide();//Oculta progressDialog

            showToast("Upload error:" + t.getMessage());

            Log.e(TAG, "onfailure: " + t.getMessage());
        }
    });

}

From source file:com.landenlabs.all_devtool.PackageFragment.java

/**
 * Update Package list, show progress indicator while loading in background.
 *///from   w w w  .  j av  a2 s.  c  om
public void updateList() {
    // Swap colors
    int color = s_rowColor1;
    s_rowColor1 = s_rowColor2;
    s_rowColor2 = color;

    m_progress = new ProgressDialog(m_listView.getContext());
    m_progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    m_progress.setIndeterminate(true);
    m_progress.setMessage("Loading...");
    m_progress.show();

    m_pkgUninstallBtn.setEnabled((updateCheckCnt() > 0));

    // Start lengthy operation loading packages in background thread
    new Thread(new Runnable() {
        public void run() {
            loadPackages();
        }
    }).start();
}