Example usage for android.app ProgressDialog setIndeterminate

List of usage examples for android.app ProgressDialog setIndeterminate

Introduction

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

Prototype

public void setIndeterminate(boolean indeterminate) 

Source Link

Document

Change the indeterminate mode for this ProgressDialog.

Usage

From source file:com.almarsoft.GroundhogReader.MessageListActivity.java

@Override
protected Dialog onCreateDialog(int id) {

    ProgressDialog dialog = null;
    if (id == ID_DIALOG_CATCHUP) {
        dialog = new ProgressDialog(this);
        dialog.setMessage(getString(R.string.catchingup_server));
        dialog.setIndeterminate(true);
        dialog.setCancelable(false);//w  ww . j a  v  a 2 s  .  com
        return dialog;

    }

    return super.onCreateDialog(id);
}

From source file:com.arantius.tivocommander.SeasonPass.java

public void reorderApply(View unusedView) {
    Utils.log("SeasonPass::reorderApply() " + Boolean.toString(mInReorderMode));

    boolean noChange = true;
    ArrayList<String> subIds = new ArrayList<String>();
    for (int i = 0; i < mSubscriptionIds.size(); i++) {
        if (mSubscriptionIds.get(i) != mSubscriptionIdsBeforeReorder.get(i)) {
            noChange = false;//from ww  w . j  a v a 2  s  .  c  om
        }
        subIds.add(mSubscriptionData.get(i).path("subscriptionId").asText());
    }

    final ProgressDialog d = new ProgressDialog(this);
    final MindRpcResponseListener onReorderComplete = new MindRpcResponseListener() {
        public void onResponse(MindRpcResponse response) {
            if (d.isShowing()) {
                d.dismiss();
            }

            // Flip the buttons.
            findViewById(R.id.reorder_enable).setVisibility(View.VISIBLE);
            findViewById(R.id.reorder_apply).setVisibility(View.GONE);
            // Turn off the drag handles.
            mInReorderMode = false;
            mListAdapter.notifyDataSetChanged();
        }
    };

    if (noChange) {
        // If there was no change, switch the UI back immediately.
        onReorderComplete.onResponse(null);
    } else {
        // Otherwise show a dialog while we do the RPC.
        d.setIndeterminate(true);
        d.setTitle("Saving ...");
        d.setMessage("Saving new season pass order.  " + "Patience please, this takes a while.");
        d.setCancelable(false);
        d.show();

        SubscriptionsReprioritize req = new SubscriptionsReprioritize(subIds);
        MindRpc.addRequest(req, onReorderComplete);
    }
}

From source file:com.andrewshu.android.reddit.submit.SubmitLinkActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;/*from ww w  .j  a va 2  s .c  o m*/
    ProgressDialog pdialog;
    switch (id) {
    case Constants.DIALOG_LOGIN:
        dialog = new LoginDialog(this, mSettings, true) {
            @Override
            public void onLoginChosen(String user, String password) {
                removeDialog(Constants.DIALOG_LOGIN);
                new MyLoginTask(user, password).execute();
            }
        };
        break;

    // "Please wait"
    case Constants.DIALOG_LOGGING_IN:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Logging in...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    case Constants.DIALOG_SUBMITTING:
        pdialog = new ProgressDialog(new ContextThemeWrapper(this, mSettings.getDialogTheme()));
        pdialog.setMessage("Submitting...");
        pdialog.setIndeterminate(true);
        pdialog.setCancelable(true);
        dialog = pdialog;
        break;
    default:
        break;
    }
    return dialog;
}

From source file:id.ridon.keude.AppDetailsData.java

private void updateProgressDialog(int progress, int total) {
    if (downloadHandler != null) {
        ProgressDialog pd = getProgressDialog(downloadHandler.getRemoteAddress());
        if (total > 0) {
            pd.setIndeterminate(false);
            pd.setProgress(progress);/*w  w w.  ja  v  a2s . c  o m*/
            pd.setMax(total);
        } else {
            pd.setIndeterminate(true);
            pd.setProgress(progress);
            pd.setMax(0);
        }
        if (!pd.isShowing()) {
            Log.d(TAG, "Showing progress dialog for download.");
            pd.show();
        }
    }
}

From source file:com.arantius.tivocommander.SeasonPass.java

public void reorderEnable(View unusedView) {
    Utils.log("SeasonPass::reorderEnable() " + Boolean.toString(mInReorderMode));

    final ArrayList<String> subscriptionIds = new ArrayList<String>();
    final ArrayList<Integer> slots = new ArrayList<Integer>();
    int i = 0;// w  w w.ja  v a2s. co  m
    while (i < mSubscriptionData.size()) {
        if (mSubscriptionStatus.get(i) == SubscriptionStatus.MISSING) {
            String subscriptionId = mSubscriptionIds.get(i);
            subscriptionIds.add(subscriptionId);
            slots.add(i);
            mSubscriptionStatus.set(i, SubscriptionStatus.LOADING);
        }
        i++;
    }

    final ProgressDialog d = new ProgressDialog(this);
    final MindRpcResponseListener onAllPassesLoaded = new MindRpcResponseListener() {
        public void onResponse(MindRpcResponse response) {
            if (response != null) {
                mDetailCallback.onResponse(response);
            }
            d.dismiss();

            // Save the state before ordering.
            mSubscriptionIdsBeforeReorder.clear();
            mSubscriptionIdsBeforeReorder.addAll(mSubscriptionIds);
            // Flip the buttons.
            findViewById(R.id.reorder_enable).setVisibility(View.GONE);
            findViewById(R.id.reorder_apply).setVisibility(View.VISIBLE);
            // Show the drag handles.
            mInReorderMode = true;
            mListAdapter.notifyDataSetChanged();
        }
    };

    if (subscriptionIds.size() == 0) {
        // No subscriptions need loading? Proceed immediately.
        onAllPassesLoaded.onResponse(null);
    } else {
        // Otherwise, show dialog and start loading.
        d.setIndeterminate(true);
        d.setTitle("Preparing ...");
        d.setMessage("Loading all season pass data.");
        d.setCancelable(false);
        d.show();

        final SubscriptionSearch req = new SubscriptionSearch(subscriptionIds);
        mRequestSlotMap.put(req.getRpcId(), slots);
        MindRpc.addRequest(req, onAllPassesLoaded);
    }
}

From source file:org.odk.collect.android.activities.GoogleDriveActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case PROGRESS_DIALOG:
        Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG", "show");

        ProgressDialog progressDialog = new ProgressDialog(this);
        DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() {
            @Override/*from www  .  j  a v  a2 s.c o  m*/
            public void onClick(DialogInterface dialog, int which) {
                Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG",
                        "cancel");
                dialog.dismiss();
                getFileTask.cancel(true);
                getFileTask.setGoogleDriveFormDownloadListener(null);
            }
        };
        progressDialog.setTitle(getString(R.string.downloading_data));
        progressDialog.setMessage(alertMsg);
        progressDialog.setIndeterminate(true);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setCancelable(false);
        progressDialog.setButton(getString(R.string.cancel), loadingButtonListener);
        return progressDialog;
    case GOOGLE_USER_DIALOG:
        AlertDialog.Builder gudBuilder = new AlertDialog.Builder(this);

        gudBuilder.setTitle(getString(R.string.no_google_account));
        gudBuilder.setMessage(getString(R.string.google_set_account));
        gudBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        gudBuilder.setCancelable(false);
        return gudBuilder.create();
    }
    return null;
}

From source file:id.ridon.keude.AppDetailsData.java

private ProgressDialog getProgressDialog(String file) {
    if (progressDialog == null) {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        pd.setMessage(getString(R.string.download_server) + ":\n " + file);
        pd.setCancelable(true);/*w w  w . j  ava 2s.  c om*/
        pd.setCanceledOnTouchOutside(false);

        // The indeterminate-ness will get overridden on the first progress event we receive.
        pd.setIndeterminate(true);

        pd.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                Log.d(TAG, "User clicked 'cancel' on download, attempting to interrupt download thread.");
                if (downloadHandler != null) {
                    downloadHandler.cancel();
                    cleanUpFinishedDownload();
                } else {
                    Log.e(TAG, "Tried to cancel, but the downloadHandler doesn't exist.");
                }
                progressDialog = null;
                Toast.makeText(AppDetails.this, getString(R.string.download_cancelled), Toast.LENGTH_LONG)
                        .show();
            }
        });
        pd.setButton(DialogInterface.BUTTON_NEUTRAL, getString(R.string.cancel),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        pd.cancel();
                    }
                });
        progressDialog = pd;
    }
    return progressDialog;
}

From source file:com.digitalarx.android.ui.activity.FileDisplayActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;/*from   w  ww. j  a  va 2 s.  c o m*/
    AlertDialog.Builder builder;
    switch (id) {
    case DIALOG_SHORT_WAIT: {
        ProgressDialog working_dialog = new ProgressDialog(this);
        working_dialog.setMessage(getResources().getString(R.string.wait_a_moment));
        working_dialog.setIndeterminate(true);
        working_dialog.setCancelable(false);
        dialog = working_dialog;
        break;
    }
    case DIALOG_CHOOSE_UPLOAD_SOURCE: {

        String[] items = null;

        String[] allTheItems = { getString(R.string.actionbar_upload_files),
                getString(R.string.actionbar_upload_from_apps),
                getString(R.string.actionbar_failed_instant_upload) };

        String[] commonItems = { getString(R.string.actionbar_upload_files),
                getString(R.string.actionbar_upload_from_apps) };

        if (InstantUploadActivity.IS_ENABLED)
            items = allTheItems;
        else
            items = commonItems;

        builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.actionbar_upload);
        builder.setItems(items, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                if (item == 0) {
                    // if (!mDualPane) {
                    Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class);
                    action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT, FileDisplayActivity.this.getAccount());
                    startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES);
                    // } else {
                    // TODO create and handle new fragment
                    // LocalFileListFragment
                    // }
                } else if (item == 1) {
                    Intent action = new Intent(Intent.ACTION_GET_CONTENT);
                    action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
                    startActivityForResult(
                            Intent.createChooser(action, getString(R.string.upload_chooser_title)),
                            ACTION_SELECT_CONTENT_FROM_APPS);
                } else if (item == 2 && InstantUploadActivity.IS_ENABLED) {
                    Intent action = new Intent(FileDisplayActivity.this, InstantUploadActivity.class);
                    action.putExtra(FileUploader.KEY_ACCOUNT, FileDisplayActivity.this.getAccount());
                    startActivity(action);
                }
            }
        });
        dialog = builder.create();
        break;
    }
    case DIALOG_CERT_NOT_SAVED: {
        builder = new AlertDialog.Builder(this);
        builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved));
        builder.setCancelable(false);
        builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            };
        });
        dialog = builder.create();
        break;
    }
    default:
        dialog = null;
    }

    return dialog;
}

From source file:com.ubuntuone.android.files.activity.FilesActivity.java

private Dialog buildCreatePublicLinkDialog() {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage(getString(R.string.dialog_creating_link));
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);//from  w ww.  j a  va 2  s. co  m
    return dialog;
}