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.digitalarx.android.ui.activity.FileDisplayActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;//  ww  w  . ja  v  a  2  s. co  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:cn.ucai.yizhesale.activity.ChatActivity.java

/**
 * ???/*from   www  .ja  v  a  2 s  .  c o  m*/
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(cn.ucai.yizhesale.R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.ucai.yizhesale.R.string.Move_into_blacklist_success, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.ucai.yizhesale.R.string.Move_into_blacklist_failure, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            }
        }
    }).start();
}

From source file:org.sickstache.fragments.ShowsFragment.java

@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    if (actionMode == null) {
        actionMode = getSherlockActivity().startActionMode(new ActionMode.Callback() {

            @Override//from   w  w  w  .j  a  v  a2 s.c o m
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) {
                showAdapter.notifyDataSetChanged();
                selected.clear();
                actionMode = null;
            }

            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                MenuInflater inflate = getSherlockActivity().getSupportMenuInflater();
                inflate.inflate(R.menu.shows_cab_menu, menu);
                return true;
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                switch (item.getItemId()) {
                case R.id.pauseMenuItem:
                    final PauseDialog pDialog = new PauseDialog();
                    pDialog.setTitle("Set Pause");
                    pDialog.setOnOkClick(new OnClickListener() {
                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            final ProgressDialog dialog = ProgressDialog.show(
                                    ShowsFragment.this.getSherlockActivity(), "",
                                    "Pausing Shows. Please wait...", true);
                            dialog.setCancelable(true);
                            dialog.show();
                            String[] tvdbids = new String[selected.size()];
                            for (int i = 0; i < selected.size(); i++) {
                                tvdbids[i] = showAdapter.getItem(selected.get(i)).id;
                            }
                            Preferences pref = Preferences
                                    .getSingleton(ShowsFragment.this.getSherlockActivity());
                            PauseTask pause = new PauseTask(pref, tvdbids, pDialog.getPause()) {
                                @Override
                                protected void onPostExecute(Boolean result) {
                                    if (dialog != null && dialog.isShowing())
                                        dialog.dismiss();
                                    if (error != null && getFragmentManager() != null) {
                                        ErrorDialog dialog = new ErrorDialog();
                                        dialog.setMessage("Error pausing show.\nERROR: " + error.getMessage());
                                        dialog.show(getFragmentManager(), "pauseError");
                                    }
                                }
                            };
                            pause.execute();
                        }
                    });
                    pDialog.show(getFragmentManager(), "update");
                    return true;
                case R.id.refreshMenuItem: {
                    final ProgressDialog dialog = ProgressDialog.show(ShowsFragment.this.getSherlockActivity(),
                            "", "Refreshing Shows. Please wait...", true);
                    dialog.setCancelable(true);
                    dialog.show();
                    String[] tvdbids = new String[selected.size()];
                    for (int i = 0; i < selected.size(); i++) {
                        tvdbids[i] = showAdapter.getItem(selected.get(i)).id;
                    }
                    Preferences pref = Preferences.getSingleton(ShowsFragment.this.getSherlockActivity());
                    RefreshTask refresh = new RefreshTask(pref, tvdbids) {
                        @Override
                        protected void onPostExecute(Boolean result) {
                            if (dialog != null && dialog.isShowing())
                                dialog.dismiss();
                            if (error != null && getFragmentManager() != null) {
                                ErrorDialog dialog = new ErrorDialog();
                                dialog.setMessage("Error refreshing show.\nERROR: " + error.getMessage());
                                dialog.show(getFragmentManager(), "refreshError");
                            }
                        }
                    };
                    refresh.execute();
                }
                    return true;
                case R.id.updateMenuItem: {
                    final ProgressDialog dialog = ProgressDialog.show(ShowsFragment.this.getSherlockActivity(),
                            "", "Updating Shows. Please wait...", true);
                    dialog.setCancelable(true);
                    dialog.show();
                    String[] tvdbids = new String[selected.size()];
                    for (int i = 0; i < selected.size(); i++) {
                        tvdbids[i] = showAdapter.getItem(selected.get(i)).id;
                    }
                    Preferences pref = Preferences.getSingleton(ShowsFragment.this.getSherlockActivity());
                    UpdateTask update = new UpdateTask(pref, tvdbids) {
                        @Override
                        protected void onPostExecute(Boolean result) {
                            if (dialog != null && dialog.isShowing())
                                dialog.dismiss();
                            if (error != null && getFragmentManager() != null) {
                                ErrorDialog dialog = new ErrorDialog();
                                dialog.setMessage("Error updating show.\nERROR: " + error.getMessage());
                                dialog.show(getFragmentManager(), "updateError");
                            }
                        }
                    };
                    update.execute();
                }
                    return true;
                //               case R.id.editMenuItem:
                //                  // get all selected items and create the edit show activity passing all of them
                //                  actionMode.finish();
                //                  return true;
                }
                return false;
            }
        });
    }
    ImageView overlay = (ImageView) arg1.findViewById(R.id.showSelectedOverlay);
    int i = selected.indexOf(arg2);
    if (i >= 0) {
        selected.remove(i);
        overlay.setVisibility(View.INVISIBLE);
    } else {
        selected.add(arg2);
        overlay.setVisibility(View.VISIBLE);
    }
    actionMode.setTitle(selected.size() + " Items Selected");
    if (selected.size() == 0) {
        actionMode.finish();
    }
    return true;
}

From source file:com.dcy.psychology.ChatActivity.java

/**
 * ????/*from  w ww .j  av a 2s .com*/
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, 0).show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.techscl.ichat.activity.ChatActivity.java

/**
 * ???/*  w ww .ja v a2s.c  o m*/
 *
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        To.show(getString(R.string.Move_into_blacklist_success));
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        To.show(getString(R.string.Move_into_blacklist_failure));
                    }
                });
            }
        }
    }).start();
}

From source file:cmu.cconfs.instantMessage.activities.ChatActivity.java

/**
 * ???//from   www . ja  v a  2 s.c  om
 *
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, 0).show();
                    }
                });
            }
        }
    }).start();
}

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

@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;/*from www  .  j  a  v  a  2s  .  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_SSL_VALIDATOR: {
        dialog = SslValidatorDialog.newInstance(this, mLastSslUntrustedServerResult, this);
        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:cn.gen.superwechat.activity.ChatActivity.java

/**
 * ???/* w ww. j a v a2  s  .c om*/
 * 
 * @param username
 */
private void addUserToBlacklist(final String username) {
    final ProgressDialog pd = new ProgressDialog(this);
    pd.setMessage(getString(cn.gen.superwechat.R.string.Is_moved_into_blacklist));
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                EMContactManager.getInstance().addUserToBlackList(username, false);
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.gen.superwechat.R.string.Move_into_blacklist_success, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            } catch (EaseMobException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getApplicationContext(),
                                cn.gen.superwechat.R.string.Move_into_blacklist_failure, Toast.LENGTH_SHORT)
                                .show();
                    }
                });
            }
        }
    }).start();
}

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

private Dialog buildCheckDirectorySizeDialog(final Bundle extras) {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage(getString(R.string.dialog_checking_size_message));
    dialog.setIndeterminate(true);/*from ww w  .  java  2s.  com*/
    dialog.setCancelable(true);
    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);//from ww w .  j  ava2s.  c o m
    dialog.setCancelable(false);
    return dialog;
}