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.app.khclub.base.easeim.activity.ContactlistFragment.java

/**
 * user???/*from  w  w w  .  j av a  2 s.  c o m*/
 */
private void moveToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st1 = getResources().getString(R.string.Is_moved_into_blacklist);
    final String st2 = getResources().getString(R.string.Move_into_blacklist_success);
    final String st3 = getResources().getString(R.string.Move_into_blacklist_failure);
    pd.setMessage(st1);
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                // ???
                EMContactManager.getInstance().addUserToBlackList(username, false);
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st2, 0).show();
                        refresh();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st3, 0).show();
                    }
                });
            }
        }
    }).start();

}

From source file:com.android.gallery3d.ingest.IngestActivity.java

private void updateProgressDialog() {
    ProgressDialog dialog = getProgressDialog();
    boolean indeterminate = (mProgressState.max == 0);
    dialog.setIndeterminate(indeterminate);
    dialog.setProgressStyle(indeterminate ? ProgressDialog.STYLE_SPINNER : ProgressDialog.STYLE_HORIZONTAL);
    if (mProgressState.title != null) {
        dialog.setTitle(mProgressState.title);
    }/*from  w  w  w .  j  ava 2  s  .  c  o m*/
    if (mProgressState.message != null) {
        dialog.setMessage(mProgressState.message);
    }
    if (!indeterminate) {
        dialog.setProgress(mProgressState.current);
        dialog.setMax(mProgressState.max);
    }
    if (!dialog.isShowing()) {
        dialog.show();
    }
}

From source file:com.doplgangr.secrecy.views.FilesListFragment.java

public void onEventMainThread(Vault vault) {
    //The vault finishes initializing, is prepared to be populated.
    secret = vault;//w  w  w.  j  av a  2  s  .  com
    if (secret.isEcbVault()) {
        Util.alert(context, getString(R.string.Error__old_vault_format),
                getString(R.string.Error__old_vault_format_message), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        Util.alert(context, getString(R.string.Upgrade__backup_beforehand),
                                getString(R.string.Upgrade__backup_beforehand_message),
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        backUp();
                                        finish();
                                    }
                                }, new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialogInterface, int i) {
                                        ProgressDialog progress = new ProgressDialog(context);
                                        progress.setMessage(getString(R.string.Vault_updating));
                                        progress.setIndeterminate(true);
                                        progress.setCancelable(false);
                                        progress.show();
                                        updateVaultInBackground(progress);
                                    }
                                });
                    }
                }, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        finish();
                    }
                });
        return;
    }

    if (secret.wrongPass) {
        Util.alert(context, getString(R.string.Error__open_vault),
                getString(R.string.Error__open_vault_message), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        finish();
                    }
                }, null);
        return;
    }

    addFiles();
    context.setTitle(secret.getName());
    mInitializeDialog.dismiss();
    setupViews();
}

From source file:bikebadger.RideFragment.java

public void SaveGPXFileOnNewThreadWithDialog(final String path) {
    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    final File gpxFile = new File(path);
    pd.setMessage("Saving \"" + gpxFile.getName() + "\"");
    pd.setIndeterminate(true);//  w ww.j  a  v a2s. c o  m
    pd.setCancelable(false);
    pd.show();
    Thread mThread = new Thread() {
        @Override
        public void run() {
            mRideManager.ExportWaypointsTrack();
            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() + "\" saved", Color.BLACK);
                    }
                });
            }
        }
    };
    mThread.start();
}

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   ww w  .j  a va2s  .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.microsoft.live.sample.skydrive.SkyDriveActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == FilePicker.PICK_FILE_REQUEST) {
        if (resultCode == RESULT_OK) {
            String filePath = data.getStringExtra(FilePicker.EXTRA_FILE_PATH);

            if (TextUtils.isEmpty(filePath)) {
                showToast("No file was choosen.");
                return;
            }/*from w  w  w  .  ja  v  a2  s. c  om*/

            File file = new File(filePath);

            final ProgressDialog uploadProgressDialog = new ProgressDialog(SkyDriveActivity.this);
            uploadProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            uploadProgressDialog.setMessage("Uploading...");
            uploadProgressDialog.setCancelable(true);
            uploadProgressDialog.show();

            final LiveOperation operation = mClient.uploadAsync(mCurrentFolderId, file.getName(), file,
                    new LiveUploadOperationListener() {
                        @Override
                        public void onUploadProgress(int totalBytes, int bytesRemaining,
                                LiveOperation operation) {
                            int percentCompleted = computePrecentCompleted(totalBytes, bytesRemaining);

                            uploadProgressDialog.setProgress(percentCompleted);
                        }

                        @Override
                        public void onUploadFailed(LiveOperationException exception, LiveOperation operation) {
                            uploadProgressDialog.dismiss();
                            showToast(exception.getMessage());
                        }

                        @Override
                        public void onUploadCompleted(LiveOperation operation) {
                            uploadProgressDialog.dismiss();

                            JSONObject result = operation.getResult();
                            if (result.has(JsonKeys.ERROR)) {
                                JSONObject error = result.optJSONObject(JsonKeys.ERROR);
                                String message = error.optString(JsonKeys.MESSAGE);
                                String code = error.optString(JsonKeys.CODE);
                                showToast(code + ": " + message);
                                return;
                            }

                            loadFolder(mCurrentFolderId);
                        }
                    });

            uploadProgressDialog.setOnCancelListener(new OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    operation.cancel();
                }
            });
        }
    }
}

From source file:com.code.android.vibevault.SearchScreen.java

/** Dialog creation method.
*
* Includes Thread bookkeeping to prevent not leaking Views on orientation changes.
*//* w  ww  . j  a  v  a  2  s.c o  m*/
@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case VibeVault.SEARCHING_DIALOG_ID:

        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setMessage("Finding Shows");
        return dialog;
    default:
        return super.onCreateDialog(id);
    }
}

From source file:me.albertonicoletti.latex.activities.EditorActivity.java

/**
 * Routine that searches for the images used in the current document, zips them with the file
 * and sends it to the server.//w ww  .j  a  v a2 s.  co m
 * It will show the response pdf or log.
 */
private void generatePDF() {
    boolean fileNeedsToBeSaved = !saveFile();
    if (!fileNeedsToBeSaved) {
        if (!editor.getTextString().equals("")) {
            final String imagesFolderPath = PreferenceHelper.getImageFolder(getApplicationContext());
            final String outputFolderPath = PreferenceHelper.getOutputFolder(getApplicationContext());
            final File imagesFolder = new File(imagesFolderPath);
            final File outputFolder = new File(outputFolderPath);
            final ProgressDialog asyncDialog = new ProgressDialog(EditorActivity.this);
            asyncDialog.setMessage("Compressing and sending files...");
            asyncDialog.show();
            latexCompiler.generatePDF(editor, imagesFolder, outputFolder, document,
                    new FileAsyncHttpResponseHandler(this) {
                        @Override
                        public void onFailure(int statusCode, cz.msebera.android.httpclient.Header[] headers,
                                Throwable throwable, File file) {
                            asyncDialog.dismiss();
                            // On failure shows an error toast
                            Toast.makeText(getApplicationContext(), "Server Error.", Toast.LENGTH_LONG).show();
                            Log.e("LATEX_NET", throwable.getMessage() + "");
                        }

                        @Override
                        public void onSuccess(int statusCode, cz.msebera.android.httpclient.Header[] headers,
                                File file) {
                            asyncDialog.dismiss();
                            Header header = null;
                            // Retrieves the content-type header
                            for (Header h : headers) {
                                if (h.getName().equals("Content-Type")) {
                                    header = h;
                                    break;
                                }
                            }
                            openResultingFile(header, file);
                        }
                    });
            asyncDialog.setMessage("Waiting for the server to compile...");
        } else {
            // Empty file
            Toast.makeText(getApplicationContext(), "Can't compile an empty file!", Toast.LENGTH_LONG).show();
        }
    }
}

From source file:export.UploadManager.java

private void uploadOK(Uploader uploader, ProgressDialog copySpinner, SQLiteDatabase copyDB, long id) {
    copySpinner.setMessage("Saving");
    ContentValues tmp = new ContentValues();
    tmp.put(Constants.DB.EXPORT.ACCOUNT, uploader.getId());
    tmp.put(Constants.DB.EXPORT.ACTIVITY, id);
    tmp.put(Constants.DB.EXPORT.STATUS, 0);
    copyDB.insert(Constants.DB.EXPORT.TABLE, null, tmp);
}

From source file:com.microsoft.live.sample.skydrive.SkyDriveActivity.java

@Override
protected Dialog onCreateDialog(final int id, final Bundle bundle) {
    Dialog dialog = null;//from  w ww  .  j  a v  a 2  s. c  o m
    switch (id) {
    case DIALOG_DOWNLOAD_ID: {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Download").setMessage("This file will be downloaded to the sdcard.")
                .setPositiveButton("OK", new Dialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        final ProgressDialog progressDialog = new ProgressDialog(SkyDriveActivity.this);
                        progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                        progressDialog.setMessage("Downloading...");
                        progressDialog.setCancelable(true);
                        progressDialog.show();

                        String fileId = bundle.getString(JsonKeys.ID);
                        String name = bundle.getString(JsonKeys.NAME);

                        File file = new File(Environment.getExternalStorageDirectory(), name);

                        final LiveDownloadOperation operation = mClient.downloadAsync(fileId + "/content", file,
                                new LiveDownloadOperationListener() {
                                    @Override
                                    public void onDownloadProgress(int totalBytes, int bytesRemaining,
                                            LiveDownloadOperation operation) {
                                        int percentCompleted = computePrecentCompleted(totalBytes,
                                                bytesRemaining);

                                        progressDialog.setProgress(percentCompleted);
                                    }

                                    @Override
                                    public void onDownloadFailed(LiveOperationException exception,
                                            LiveDownloadOperation operation) {
                                        progressDialog.dismiss();
                                        showToast(exception.getMessage());
                                    }

                                    @Override
                                    public void onDownloadCompleted(LiveDownloadOperation operation) {
                                        progressDialog.dismiss();
                                        showToast("File downloaded.");
                                    }
                                });

                        progressDialog.setOnCancelListener(new OnCancelListener() {
                            @Override
                            public void onCancel(DialogInterface dialog) {
                                operation.cancel();
                            }
                        });
                    }
                }).setNegativeButton("Cancel", new Dialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

        dialog = builder.create();
        break;
    }
    }

    if (dialog != null) {
        dialog.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                removeDialog(id);
            }
        });
    }

    return dialog;
}