Example usage for android.app ProgressDialog setMessage

List of usage examples for android.app ProgressDialog setMessage

Introduction

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

Prototype

@Override
    public void setMessage(CharSequence message) 

Source Link

Usage

From source file:com.flipzu.flipzu.Recorder.java

protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;/*from   w w  w.  ja  va  2s. co  m*/
    ProgressDialog pDialog;
    AlertDialog aDialog;
    AlertDialog.Builder builder;

    switch (id) {
    case CONNECTING_DIALOG_ID:
        pDialog = new ProgressDialog(Recorder.this);
        pDialog.setTitle(null);
        pDialog.setMessage("Connecting...");
        dialog = pDialog;
        break;
    case DISCONNECTING_DIALOG_ID:
        pDialog = new ProgressDialog(Recorder.this);
        pDialog.setTitle(null);
        pDialog.setMessage("Closing broadcast, please wait...");
        dialog = pDialog;
        break;
    case AUTH_FAILED_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("Auth failed. Please logout and try again.").setCancelable(false)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(AUTH_FAILED_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case CONNECTION_LOST_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("Connection lost :-(").setCancelable(false).setPositiveButton("OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(CONNECTION_LOST_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case NO_INTERNET_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("No Internet connection").setCancelable(false).setPositiveButton("OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(NO_INTERNET_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case MIC_FAILED_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("Microphone initialization failed! Please try restarting the App.")
                .setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(MIC_FAILED_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case SLOW_NETWORK_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("Network speed is too slow! Disconnected.").setCancelable(false)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(SLOW_NETWORK_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case SLOW_CPU_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage("We can't process audio fast enough, so we're disconnecting. Sorry :(")
                .setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(SLOW_CPU_DIALOG_ID);
                        clearNotifications();
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case BIND_FACEBOOK_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage(
                "Please visit http://flipzu.com ('Settings' section) to bind your Facebook account. Then Re-Login on this app.")
                .setCancelable(false).setTitle("Facebook Share")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(BIND_FACEBOOK_DIALOG_ID);
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    case BIND_TWITTER_DIALOG_ID:
        builder = new AlertDialog.Builder(this);
        builder.setMessage(
                "Please visit http://flipzu.com ('Settings' section) to bind your Twitter account. Then Re-Login on this app.")
                .setCancelable(false).setTitle("Twitter Share")
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dismissDialog(BIND_TWITTER_DIALOG_ID);
                    }
                });
        aDialog = builder.create();
        dialog = aDialog;
        break;
    default:
        dialog = null;
    }
    return dialog;
}

From source file:com.cellbots.logger.LoggerActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    if (id != PROGRESS_ID) {
        return super.onCreateDialog(id);
    }// w  w w.  ja  v  a  2s  . c o m
    final ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setCancelable(false);

    // The setMessage call must be in both onCreateDialog and
    // onPrepareDialog otherwise it will
    // fail to update the dialog in onPrepareDialog.
    progressDialog.setMessage("Processing...");

    return progressDialog;
}

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;/*  w  w w  .  j a va  2s .  c  o m*/
        }
        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.easemob.chatuidemo.activity.main.MainActivity.java

void logout() {
    final ProgressDialog pd = new ProgressDialog(this);
    String st = getResources().getString(R.string.Are_logged_out);
    pd.setMessage(st);
    pd.setCanceledOnTouchOutside(false);
    pd.show();/*from   w  w  w  . j av a 2s  . c o  m*/
    DemoHXSDKHelper.getInstance().logout(true, new EMCallBack() {

        @Override
        public void onSuccess() {
            runOnUiThread(new Runnable() {
                public void run() {
                    pd.dismiss();
                    // ??
                    finish();
                    startActivity(new Intent(MainActivity.this, LoginActivity.class));

                }
            });
        }

        @Override
        public void onProgress(int progress, String status) {

        }

        @Override
        public void onError(int code, String message) {
            runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    pd.dismiss();
                    Toast.makeText(MainActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT).show();

                }
            });
        }
    });
}

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);/*from  w  w w .  j  av  a 2s  .com*/
        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:br.com.indigo.android.facebook.SocialFacebook.java

public void commentPost(final Activity activity, final String postId, final NewObjectListener listener) {

    if (!mFacebook.isSessionValid()) {
        login(activity, new SimpleRequestListener() {

            public void onComplete() {
                commentPost(activity, postId, listener);
            }/*from  w  w w. jav a2 s . c o  m*/

            public void onFail(Throwable thr) {
                listener.onFail(thr);
            }

            public void onCancel() {
                listener.onCancel();
            }
        });
    } else {

        final FbTextDialog dialog = new FbTextDialog(activity);
        dialog.setDialogListener(new DialogListener() {

            public void onComplete(Bundle values) {

                final ProgressDialog spinner = new ProgressDialog(activity);
                spinner.setMessage(spinner.getContext().getString(R.string.loading));
                spinner.setCancelable(false);
                spinner.show();

                facebookRequest(activity, postId + "/comments", values, "POST", true, new RequestAdapter() {

                    public void onFail(Throwable thr, Object state) {
                        listener.onFail(thr);
                        spinner.dismiss();
                        dialog.dismiss();
                    }

                    public void onComplete(JSONObject jsonResponse, Object state) {
                        listener.onComplete(jsonResponse.optString("id"));
                        spinner.dismiss();
                        dialog.dismiss();
                    }

                    public void onCancel() {
                        listener.onCancel();
                        spinner.dismiss();
                        dialog.dismiss();
                    }
                });
            }

            public void onFacebookError(FacebookError e) {
                listener.onFail(e);
            }

            public void onError(DialogError e) {
                listener.onFail(e);
            }

            public void onCancel() {
                listener.onCancel();
            }
        });

        dialog.show();
    }
}

From source file:br.com.indigo.android.facebook.SocialFacebook.java

public void publish(final Activity activity, final FbSimplePost post, final String pageId,
        final NewObjectListener listener) {

    if (!mFacebook.isSessionValid()) {

        login(activity, new SimpleRequestListener() {

            public void onFail(Throwable thr) {
                listener.onFail(thr);/*  w  ww . ja  v a  2s . com*/
            }

            public void onCancel() {
                listener.onCancel();
            }

            public void onComplete() {
                publish(activity, post, pageId, listener);
            }
        });
    } else {

        final FbTextDialog dialog = new FbTextDialog(activity);
        dialog.setTitle(R.string.dialog_post_to_wall_title);
        dialog.setPlaceHolder(R.string.dialog_post_to_wall_placeholder);

        dialog.setDialogListener(new DialogListener() {

            public void onComplete(Bundle values) {

                final ProgressDialog spinner = new ProgressDialog(activity);
                spinner.setMessage(spinner.getContext().getString(R.string.loading));
                spinner.setCancelable(false);
                spinner.show();

                Bundle params = paramsForPost(post);
                params.putAll(values);

                facebookRequest(activity, pageId + "/feed", params, "POST", true, new RequestAdapter() {

                    public void onFail(Throwable thr, Object state) {
                        listener.onFail(thr);
                        spinner.dismiss();
                        dialog.dismiss();
                    }

                    public void onComplete(JSONObject jsonResponse, Object state) {
                        listener.onComplete(jsonResponse.optString("id"));
                        spinner.dismiss();
                        dialog.dismiss();
                    }

                    public void onCancel() {
                        listener.onCancel();
                        spinner.dismiss();
                        dialog.dismiss();
                    }
                });
            }

            public void onFacebookError(FacebookError e) {
                listener.onFail(e);
            }

            public void onError(DialogError e) {
                listener.onFail(e);
            }

            public void onCancel() {
                listener.onCancel();
            }
        });

        dialog.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;/*from ww  w.  ja  v  a  2 s  .  c o 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 w  w w . ja v a 2  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;
}