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.cellobject.oikos.FormActivity.java

/**
 * For API level 8 or newer. /*from  www.  j a v a 2 s  . c  om*/
 */
public Dialog onCreateDialog(final int id, final Bundle args) {
    if (id == SUBMITTING_DIALOG) {
        final ProgressDialog dlg = new ProgressDialog(this);
        dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dlg.setMessage(getText(R.string.submitting));
        dlg.setIndeterminate(true);
        return dlg;
    }
    return null;
}

From source file:ac.robinson.mediaphone.MediaPhoneActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case R.id.dialog_importing_in_progress:
        ProgressDialog importDialog = new ProgressDialog(MediaPhoneActivity.this);
        importDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        importDialog.setMessage(getString(R.string.import_progress));
        importDialog.setCancelable(false);
        mImportFramesProgressDialog = importDialog;
        mImportFramesDialogShown = true;
        return importDialog;
    case R.id.dialog_export_narrative_in_progress:
        ProgressDialog exportDialog = new ProgressDialog(MediaPhoneActivity.this);
        exportDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        exportDialog.setMessage(getString(R.string.background_task_progress));
        exportDialog.setCancelable(false);
        exportDialog.setIndeterminate(true);
        mExportNarrativeDialogShown = true;
        return exportDialog;
    case R.id.dialog_mov_creator_in_progress:
        ProgressDialog movDialog = new ProgressDialog(MediaPhoneActivity.this);
        movDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        movDialog.setMessage(getString(R.string.mov_export_task_progress));
        movDialog.setButton(DialogInterface.BUTTON_POSITIVE, getString(R.string.mov_export_run_in_background),
                new DialogInterface.OnClickListener() {
                    @Override/*from   w  w  w  . ja va2 s . co m*/
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        mExportVideoDialogShown = false;
                    }
                });
        movDialog.setCancelable(false);
        movDialog.setIndeterminate(true);
        mExportVideoDialogShown = true;
        return movDialog;
    case R.id.dialog_background_runner_in_progress:
        ProgressDialog runnerDialog = new ProgressDialog(MediaPhoneActivity.this);
        runnerDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        runnerDialog.setMessage(getString(R.string.background_task_progress));
        runnerDialog.setCancelable(false);
        runnerDialog.setIndeterminate(true);
        mBackgroundRunnerDialogShown = true;
        return runnerDialog;
    default:
        return super.onCreateDialog(id);
    }
}

From source file:com.cellobject.oikos.FormActivity.java

/**
 * For API level lower than 8. //from   ww  w  .jav  a2  s.co  m
 */
public Dialog onCreateDialog(final int id) {
    if (id == SUBMITTING_DIALOG) {
        final ProgressDialog dlg = new ProgressDialog(this);
        dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dlg.setMessage(getText(R.string.submitting));
        dlg.setIndeterminate(true);
        return dlg;
    }
    return null;
}

From source file:com.eleybourn.bookcatalogue.utils.SimpleTaskQueueProgressFragment.java

/**
 * Create the underlying dialog// w w w  .j  a v a2s  .  c om
 */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(false);

    int msg = getArguments().getInt("title");
    if (msg != 0)
        dialog.setMessage(getActivity().getString(msg));
    final boolean isIndet = getArguments().getBoolean("isIndeterminate");
    dialog.setIndeterminate(isIndet);
    if (isIndet) {
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    } else {
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    }

    // We can't use "this.requestUpdateProgress()" because getDialog() will still return null
    if (!isIndet) {
        dialog.setMax(mMax);
        dialog.setProgress(mProgress);
        if (mMessage != null)
            dialog.setMessage(mMessage);
        setDialogNumberFormat(dialog);
    }

    return dialog;
}

From source file:gsoc.google.com.byop.utils.PW.BeaconConfigFragment.java

public void setEditCardUrl(String url) {

    //if the fragment is called within BYOP, the fileLink field is not empty and we can set it
    if (fileLink != null && !fileLink.isEmpty()) {
        mEditCardUrl.setText(fileLink);//  w  w w .j ava2 s. c o  m
    } else {
        // Update the url edit text field with the given url
        mEditCardUrl.setText(url);
    }

    // we don't show the beacon configuration card, instead we directly save the URL

    progressDialog = new ProgressDialog(this.getActivity());
    progressDialog.setMessage(getResources().getString(R.string.saving_url));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setIndeterminate(true);
    progressDialog.show();

    final Thread t = new Thread() {
        @Override
        public void run() {
            try {
                sleep(1000);
                progressDialog.dismiss();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    };
    t.start();
    saveEditCardUrlToBeacon();
    // showConfigurableBeaconCard();
}

From source file:bikebadger.RideFragment.java

public void OpenGPXFileOnNewThreadWithDialog(final String path) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    final File gpxFile = new File(path);
    pd.setMessage("Loading \"" + gpxFile.getName() + "\"");
    pd.setIndeterminate(true);//from   w w  w.jav  a 2  s .c o m
    pd.setCancelable(false);
    pd.show();
    Thread mThread = new Thread() {
        @Override
        public void run() {
            mRideManager.OpenGPXFile(path);
            pd.dismiss();
            if (mRideManager.mWaypoints != null) {
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        //Toast.makeText(getActivity(), "Hello", Toast.LENGTH_SHORT).show();
                        MyToast.Show(getActivity(),
                                "\"" + gpxFile.getName() + "\" loaded (" + mRideManager.mWaypoints.size() + ")",
                                Color.BLACK);
                    }
                });
            }
        }
    };
    mThread.start();
}

From source file:com.zia.freshdocs.widget.CMISAdapter.java

protected void startProgressDlg(boolean indeterminate) {
    Context context = getContext();
    Resources res = context.getResources();

    if (_progressDlg == null || !_progressDlg.isShowing()) {
        _progressDlg = new ProgressDialog(context);
        _progressDlg.setProgressStyle(/*  ww  w.  ja v  a2 s.  c  o m*/
                indeterminate ? ProgressDialog.STYLE_SPINNER : ProgressDialog.STYLE_HORIZONTAL);
        _progressDlg.setMessage(res.getString(R.string.loading));
        _progressDlg.setTitle("");
        _progressDlg.setCancelable(true);
        _progressDlg.setIndeterminate(indeterminate);
        _progressDlg.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                interrupt();
            }
        });
        _progressDlg.show();
    }
}

From source file:org.sufficientlysecure.keychain.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *//*  w ww  . ja  v a 2 s.c  om*/
private void startRevokation() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", AppMsg.STYLE_ALERT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_REVOKE_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(KeychainIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in KeychainIntentService
    KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

                AppMsg.makeText(CertifyKeyActivity.this, R.string.key_revokation_success, AppMsg.STYLE_INFO)
                        .show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:com.gimranov.zandy.app.ItemActivity.java

protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_NEW:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getResources().getString(R.string.item_type))
                // XXX i18n
                .setItems(Item.ITEM_TYPES_EN, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int pos) {
                        Item item = new Item(getBaseContext(), Item.ITEM_TYPES[pos]);
                        item.dirty = APIRequest.API_DIRTY;
                        item.save(db);//w ww .j av  a2  s  .  c  o m
                        if (collectionKey != null) {
                            ItemCollection coll = ItemCollection.load(collectionKey, db);
                            if (coll != null) {
                                coll.loadChildren(db);
                                coll.add(item);
                                coll.saveChildren(db);
                            }
                        }
                        Log.d(TAG, "Loading item data with key: " + item.getKey());
                        // We create and issue a specified intent with the necessary data
                        Intent i = new Intent(getBaseContext(), ItemDataActivity.class);
                        i.putExtra("com.gimranov.zandy.app.itemKey", item.getKey());
                        startActivity(i);
                    }
                });
        AlertDialog dialog = builder.create();
        return dialog;
    case DIALOG_SORT:

        // We generate the sort name list for our current locale
        String[] sorts = new String[SORT_NAMES.length];
        for (int j = 0; j < SORT_NAMES.length; j++) {
            sorts[j] = getResources().getString(SORT_NAMES[j]);
        }

        AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
        builder2.setTitle(getResources().getString(R.string.set_sort_order)).setItems(sorts,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int pos) {
                        Cursor cursor;
                        setSortBy(SORTS[pos]);
                        ItemCollection collection;
                        if (collectionKey != null
                                && (collection = ItemCollection.load(collectionKey, db)) != null) {
                            cursor = getCursor(collection);
                        } else {
                            if (query != null) {
                                cursor = getCursor(query);
                            } else {
                                cursor = getCursor();
                            }
                        }
                        ItemAdapter adapter = (ItemAdapter) getListAdapter();
                        adapter.changeCursor(cursor);
                        Log.d(TAG, "Re-sorting by: " + SORTS[pos]);

                        Persistence.write(SORT_CHOICE, SORTS[pos]);
                    }
                });
        AlertDialog dialog2 = builder2.create();
        return dialog2;
    case DIALOG_PROGRESS:
        mProgressDialog = new ProgressDialog(this);
        mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgressDialog.setIndeterminate(true);
        mProgressDialog.setMessage(getResources().getString(R.string.identifier_looking_up));
        return mProgressDialog;
    case DIALOG_IDENTIFIER:
        final EditText input = new EditText(this);
        input.setHint(getResources().getString(R.string.identifier_hint));

        final ItemActivity current = this;

        dialog = new AlertDialog.Builder(this).setTitle(getResources().getString(R.string.identifier_message))
                .setView(input).setPositiveButton(getResources().getString(R.string.menu_search),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                                Editable value = input.getText();
                                // run search
                                Bundle c = new Bundle();
                                c.putString("mode", "isbn");
                                c.putString("identifier", value.toString());
                                removeDialog(DIALOG_PROGRESS);
                                ItemActivity.this.b = c;
                                showDialog(DIALOG_PROGRESS);
                            }
                        })
                .setNeutralButton(getResources().getString(R.string.scan),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                                // If we're about to download from Google play, cancel that dialog
                                // and prompt from Amazon if we're on an Amazon device
                                IntentIntegrator integrator = new IntentIntegrator(current);
                                @Nullable
                                AlertDialog producedDialog = integrator.initiateScan();
                                if (producedDialog != null && "amazon".equals(BuildConfig.FLAVOR)) {
                                    producedDialog.dismiss();
                                    AmazonZxingGlue.showDownloadDialog(current);
                                }
                            }
                        })
                .setNegativeButton(getResources().getString(R.string.cancel),
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                                // do nothing
                            }
                        })
                .create();
        return dialog;
    default:
        return null;
    }
}