List of usage examples for android.app ProgressDialog setMessage
@Override public void setMessage(CharSequence message)
From source file:com.ubuntuone.android.files.fragment.ProgressDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final ProgressDialog dialog = new ProgressDialog(getActivity()); if (savedInstanceState != null) { title = savedInstanceState.getInt("title", -1); message = savedInstanceState.getInt("message", -1); }// ww w . ja v a 2 s.c om if (title != -1) dialog.setTitle(title); if (message != -1) dialog.setMessage(getString(message)); setCancelable(false); return dialog; }
From source file:com.ccxt.whl.activity.ContactlistFragment.java
/** * ?/*from w ww. j a v a2 s . co m*/ * * @param toDeleteUser */ public void deleteContact(final User tobeDeleteUser) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("..."); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername()); // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); DemoApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), ": " + e.getMessage(), 1).show(); } }); } } }).start(); }
From source file:com.safeness.im.activity.ContactlistFragment.java
/** * ?//from w ww . j a v a 2s . c o m * * @param */ public void deleteContact(final User tobeDeleteUser) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("..."); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().deleteContact(tobeDeleteUser.getUsername()); // db? UserDao dao = new UserDao(getActivity()); dao.deleteContact(tobeDeleteUser.getUsername()); PatientApplication.getInstance().getContactList().remove(tobeDeleteUser.getUsername()); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); } }); } catch (final Exception e) { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), ": " + e.getMessage(), Toast.LENGTH_LONG) .show(); } }); } } }).start(); }
From source file:com.tpb.projects.repo.fragments.RepoInfoFragment.java
@OnClick({ R.id.repo_license, R.id.repo_license_drawable, R.id.repo_license_text }) void showLicense() { if (mRepo.hasLicense()) { final ProgressDialog pd = new ProgressDialog(getContext()); pd.setTitle(R.string.title_loading_license); pd.setMessage(mRepo.getLicenseName()); pd.show();//from w ww. j a v a2s.co m mLoader.loadLicenseBody(new Loader.ItemLoader<String>() { @Override public void loadComplete(String data) { pd.dismiss(); new AlertDialog.Builder(getContext()).setTitle(mRepo.getLicenseName()).setMessage(data) .setPositiveButton(R.string.action_ok, null).create().show(); } @Override public void loadError(APIHandler.APIError error) { pd.dismiss(); Toast.makeText(getContext(), R.string.error_loading_license, Toast.LENGTH_SHORT).show(); } }, mRepo.getLicenseUrl()); } }
From source file:org.dash.wallet.integration.uphold.ui.UpholdWithdrawalDialog.java
private ProgressDialog showLoading() { ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.setIndeterminate(true); progressDialog.setMessage(getString(R.string.loading)); progressDialog.show();/*from ww w.j a v a2 s . c o m*/ return progressDialog; }
From source file:net.palacesoft.cngstation.client.StationActivity.java
public ProgressDialog createProgressDialog(String message) { ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage(message); progressDialog.setCancelable(true);//from w w w.jav a 2 s . co m return progressDialog; }
From source file:net.zionsoft.obadiah.ui.fragments.ProgressDialogFragment.java
@Override @NonNull/*w w w .j a va2 s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final ProgressDialog dialog = new ProgressDialog(getActivity()); final Bundle args = getArguments(); if (args.containsKey(KEY_MAX_PROGRESS)) { dialog.setIndeterminate(false); dialog.setMax(args.getInt(KEY_MAX_PROGRESS)); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); } dialog.setMessage(getString(args.getInt(KEY_MESSAGE))); dialog.show(); return dialog; }
From source file:me.kartikarora.transfersh.activities.TransferActivity.java
private void uploadFile(Uri uri) throws IOException { final ProgressDialog dialog = new ProgressDialog(TransferActivity.this); dialog.setMessage(getString(R.string.uploading_file)); dialog.setCancelable(false);// w w w .j a va 2s . c o m dialog.show(); Cursor cursor = getContentResolver().query(uri, null, null, null, null); if (cursor != null) { cursor.moveToFirst(); int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); final String name = cursor.getString(nameIndex); final String mimeType = getContentResolver().getType(uri); Log.d(this.getClass().getSimpleName(), cursor.getString(0)); Log.d(this.getClass().getSimpleName(), name); Log.d(this.getClass().getSimpleName(), mimeType); InputStream inputStream = getContentResolver().openInputStream(uri); OutputStream outputStream = openFileOutput(name, MODE_PRIVATE); if (inputStream != null) { IOUtils.copy(inputStream, outputStream); final File file = new File(getFilesDir(), name); TypedFile typedFile = new TypedFile(mimeType, file); TransferClient.getInterface().uploadFile(typedFile, name, new ResponseCallback() { @Override public void success(Response response) { BufferedReader reader; StringBuilder sb = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(response.getBody().in())); String line; try { while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } String result = sb.toString(); Snackbar.make(mCoordinatorLayout, name + " " + getString(R.string.uploaded), Snackbar.LENGTH_SHORT).show(); ContentValues values = new ContentValues(); values.put(FilesContract.FilesEntry.COLUMN_NAME, name); values.put(FilesContract.FilesEntry.COLUMN_TYPE, mimeType); values.put(FilesContract.FilesEntry.COLUMN_URL, result); values.put(FilesContract.FilesEntry.COLUMN_SIZE, String.valueOf(file.getTotalSpace())); getContentResolver().insert(FilesContract.BASE_CONTENT_URI, values); getSupportLoaderManager().restartLoader(BuildConfig.VERSION_CODE, null, TransferActivity.this); FileUtils.deleteQuietly(file); if (dialog.isShowing()) dialog.hide(); } @Override public void failure(RetrofitError error) { error.printStackTrace(); if (dialog.isShowing()) dialog.hide(); Snackbar.make(mCoordinatorLayout, R.string.something_went_wrong, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.report, new View.OnClickListener() { @Override public void onClick(View view) { // TODO add feedback code } }).show(); } }); } else Snackbar.make(mCoordinatorLayout, R.string.unable_to_read, Snackbar.LENGTH_SHORT).show(); } }
From source file:com.todoroo.astrid.gtasks.GtasksListFragment.java
private void clearCompletedTasks() { final ProgressDialog pd = new ProgressDialog(getActivity()); final TodorooCursor<Task> tasks = taskService.fetchFiltered(filter.getSqlQuery(), null, Task.ID, Task.COMPLETION_DATE);/*from w ww . j a v a 2 s.com*/ pd.setMessage(this.getString(R.string.gtasks_GTA_clearing)); pd.show(); new Thread() { @Override public void run() { String listId = null; try { for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) { Task t = new Task(tasks); if (t.isCompleted()) { if (listId == null) { listId = gtasksMetadataService.getTaskMetadata(t.getId()) .getValue(GtasksMetadata.LIST_ID); } t.setValue(Task.DELETION_DATE, DateUtilities.now()); taskService.save(t); } } } finally { tasks.close(); DialogUtilities.dismissDialog(getActivity(), pd); } if (listId != null) { gtasksTaskListUpdater.correctMetadataForList(listId); } Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(new Runnable() { public void run() { loadTaskListContent(true); } }); } } }.start(); }
From source file:itstudio.instructor.fragment.ContactlistFragment.java
/** * user???//from w w w . j a v a 2 s . c o m */ private void moveToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(getActivity()); pd.setMessage("???..."); 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(), "????", 0).show(); refresh(); } }); } catch (EaseMobException e) { e.printStackTrace(); getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getActivity(), "???", 0).show(); } }); } } }).start(); }