List of usage examples for android.app ProgressDialog setMessage
@Override public void setMessage(CharSequence message)
From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java
/** * Add beer on server//from www. j a va 2 s .c om */ private void addBeer() { if (TextUtils.isEmpty(etAlcohol.getText().toString()) || TextUtils.isEmpty(etName.getText().toString())) { Toast.makeText(BeerActivity.this, R.string.fieldsEmpty, Toast.LENGTH_SHORT).show(); return; } final ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setMessage(getString(R.string.connecting)); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); BeerRequest beerRequest = new BeerRequest(); beerRequest.setAvb(Double.parseDouble(etAlcohol.getText().toString())); beerRequest.setName(etName.getText().toString()); beerRequest.setDescription(etDescription.getText().toString()); APIService.get().addBeer(beerRequest, new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) { @Override public void onResults(BeerResponse beerResponse) { progressDialog.dismiss(); Toast.makeText(BeerActivity.this, R.string.beerSaved, Toast.LENGTH_SHORT).show(); setResult(RESULT_OK); finish(); } @Override public void onError(Throwable e) { progressDialog.dismiss(); Toast.makeText(BeerActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); } }); }
From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java
/** * Update beer on server//from w w w.j a va 2 s.c om */ private void updateBeer() { if (TextUtils.isEmpty(etAlcohol.getText().toString()) || TextUtils.isEmpty(etName.getText().toString())) { Toast.makeText(BeerActivity.this, R.string.fieldsEmpty, Toast.LENGTH_SHORT).show(); return; } final ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setMessage(getString(R.string.connecting)); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); BeerRequest beerRequest = new BeerRequest(); beerRequest.setAvb(Double.parseDouble(etAlcohol.getText().toString())); beerRequest.setName(etName.getText().toString()); beerRequest.setDescription(etDescription.getText().toString()); APIService.get().updateBeer(beerResponseEdit.getId(), beerRequest, new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) { @Override public void onResults(BeerResponse beerResponse) { progressDialog.dismiss(); Toast.makeText(BeerActivity.this, R.string.beerSaved, Toast.LENGTH_SHORT).show(); setResult(RESULT_OK); finish(); } @Override public void onError(Throwable e) { progressDialog.dismiss(); Toast.makeText(BeerActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); } }); }
From source file:com.example.levelup.core.app.ProgressFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog progressDialog = new ProgressDialog(getActivity()); progressDialog.setIndeterminate(true); progressDialog.setCancelable(mLoaderId != LOADER_ID_NOT_SPECIFIED); progressDialog.setTitle(mTitle);// w w w . ja va2 s . c om progressDialog.setMessage(getText(mMessage)); if (mLoaderId != LOADER_ID_NOT_SPECIFIED) { progressDialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { getLoaderManager().destroyLoader(mLoaderId); } }); } return progressDialog; }
From source file:com.lauszus.dronedraw.DroneDrawActivity.java
private void uploadFileToDropbox(File file) { DbxClientV2 client;/*from w ww . jav a2s . c om*/ try { client = DropboxClientFactory.getClient(); } catch (IllegalStateException e) { Toast.makeText(DroneDrawActivity.this, "Please setup your Dropbox account", Toast.LENGTH_SHORT).show(); return; } final ProgressDialog dialog = new ProgressDialog(this); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setCancelable(false); dialog.setMessage("Uploading to Dropbox"); dialog.show(); new UploadFileTask(client, new UploadFileTask.Callback() { @Override public void onUploadComplete(FileMetadata result) { dialog.dismiss(); Toast.makeText(DroneDrawActivity.this, "Path uploaded to Dropbox", Toast.LENGTH_SHORT).show(); } @Override public void onError(Exception e) { dialog.dismiss(); if (D) Log.e(TAG, "Failed to upload file: ", e); Toast.makeText(DroneDrawActivity.this, "Failed to upload path to Dropbox", Toast.LENGTH_SHORT) .show(); } }).execute(Uri.fromFile(file).toString(), ""); }
From source file:app.view.chat.ContactListFragment.java
/** * ?/* w ww .jav a 2 s. c om*/ * * @param tobeDeleteUser */ 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(), Toast.LENGTH_LONG) .show(); } }); } } }).start(); }
From source file:at.bitfire.davdroid.ui.CreateCollectionFragment.java
@NonNull @Override/*from www. j a va 2 s . co m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog progress = new ProgressDialog(getContext()); progress.setTitle(R.string.create_collection_creating); progress.setMessage(getString(R.string.please_wait)); progress.setIndeterminate(true); progress.setCanceledOnTouchOutside(false); setCancelable(false); return progress; }
From source file:com.lnpdit.chatuidemo.activity.ContactlistFragment.java
/** * ?//from w w w . j a v a 2 s .c om * * @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()); CydlApplication.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.ame.armymax.SettingsActivity.java
private void progress2(boolean show, String message) { if (show) {/*from w w w . ja v a 2 s . c o m*/ ProgressDialog dia = getProgressDialog(); dia.setMessage(message); aq.show(dia); } else { aq.dismiss(); } }
From source file:niltor.net.chatuidemo.activity.ContactlistFragment.java
/** * ?//from w w w. j av a2s . c o 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(), Toast.LENGTH_SHORT) .show(); } }); } } }).start(); }
From source file:com.almarsoft.GroundhogReader.SubscribeActivity.java
@Override protected Dialog onCreateDialog(int id) { if (id == ID_DIALOG_SEARCHING) { ProgressDialog searchDialog = new ProgressDialog(this); searchDialog.setMessage("Searching matching groups..."); searchDialog.setIndeterminate(true); searchDialog.setCancelable(true); return searchDialog; }//w ww. j a v a2s .c om return super.onCreateDialog(id); }