List of usage examples for android.app ProgressDialog setMessage
@Override public void setMessage(CharSequence message)
From source file:com.anandbibek.notifyme.MainActivity.java
@Override protected void onResume() { super.onResume(); if (!access) { ProgressDialog pDialog = new ProgressDialog(this); pDialog.setMessage(getResources().getString(R.string.main_check_checking)); pDialog.setMax(3000);/*from w w w . j ava 2s . co m*/ pDialog.setCancelable(false); pDialog.show(); stuff = new CheckAccessibilityTask(); stuff.execute(pDialog); return; } ListView mainFilterList = (ListView) this.findViewById(R.id.main_filter_list); String[] filterApps = new String[prefs.getNumberOfFilters() + 1]; for (int i = 0; i < filterApps.length; i++) { if (i == prefs.getNumberOfFilters()) { filterApps[i] = "JOKER"; } else { filterApps[i] = prefs.getFilterApp(i); } } ArrayAdapter<String> adapter = new MainFilterAdapter(this, filterApps); mainFilterList.setAdapter(adapter); mainFilterList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent editFilterIntent = new Intent(parent.getContext(), EditFilterActivity.class); if (position == prefs.getNumberOfFilters()) { editFilterIntent.setAction("new"); } else { editFilterIntent.setAction("edit"); editFilterIntent.putExtra("filter", position); } startActivity(editFilterIntent); } }); mainFilterList.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { final int filter = position; if (filter == prefs.getNumberOfFilters()) return true; final View finalView = view; AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); try { builder.setTitle(getResources().getString(R.string.main_remove_title1) + " " + ((TextView) ((RelativeLayout) view).getChildAt(1)).getText() + " " + getResources().getString(R.string.main_remove_title2)); builder.setIcon(((ImageView) ((RelativeLayout) view).getChildAt(0)).getDrawable()); } catch (Exception e) { } builder.setPositiveButton(R.string.main_remove_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { prefs.removeFilter(filter); startActivity(new Intent(finalView.getContext(), MainActivity.class).setAction("redraw")); } }); builder.setNegativeButton(R.string.main_remove_cancel, null); builder.show(); return true; } }); }
From source file:com.ntsync.android.sync.activities.ImportProgressDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage(getText(R.string.import_activity_progress)); dialog.setIndeterminate(false);//from w ww. jav a 2 s.c o m if (acInfo != null) { dialog.setMax(acInfo.getContactCount()); } return dialog; }
From source file:com.esri.arcgisruntime.generateofflinemap.MainActivity.java
/** * Use the generate offline map job to generate an offline map. *//*from w ww . j av a 2 s . co m*/ private void generateOfflineMap() { // create a progress dialog to show download progress ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setTitle("Generate Offline Map Job"); progressDialog.setMessage("Taking map offline..."); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setIndeterminate(false); progressDialog.setProgress(0); // when the button is clicked, start the offline map task job mTakeMapOfflineButton.setOnClickListener(v -> { progressDialog.show(); // delete any offline map already in the cache String tempDirectoryPath = getCacheDir() + File.separator + "offlineMap"; deleteDirectory(new File(tempDirectoryPath)); // specify the extent, min scale, and max scale as parameters double minScale = mMapView.getMapScale(); double maxScale = mMapView.getMap().getMaxScale(); // minScale must always be larger than maxScale if (minScale <= maxScale) { minScale = maxScale + 1; } GenerateOfflineMapParameters generateOfflineMapParameters = new GenerateOfflineMapParameters( mDownloadArea.getGeometry(), minScale, maxScale); // create an offline map offlineMapTask with the map OfflineMapTask offlineMapTask = new OfflineMapTask(mMapView.getMap()); // create an offline map job with the download directory path and parameters and start the job GenerateOfflineMapJob job = offlineMapTask.generateOfflineMap(generateOfflineMapParameters, tempDirectoryPath); // replace the current map with the result offline map when the job finishes job.addJobDoneListener(() -> { if (job.getStatus() == Job.Status.SUCCEEDED) { GenerateOfflineMapResult result = job.getResult(); mMapView.setMap(result.getOfflineMap()); mGraphicsOverlay.getGraphics().clear(); mTakeMapOfflineButton.setEnabled(false); Toast.makeText(this, "Now displaying offline map.", Toast.LENGTH_LONG).show(); } else { String error = "Error in generate offline map job: " + job.getError().getAdditionalMessage(); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } progressDialog.dismiss(); }); // show the job's progress with the progress dialog job.addProgressChangedListener(() -> progressDialog.setProgress(job.getProgress())); // start the job job.start(); }); }
From source file:org.mobisocial.corral.BackgroundableDownloadDialogFragment.java
@Override public void onProgress(final DownloadState state, final DownloadChannel channel, final int progress) { Dialog dl = getDialog();// w w w.j a va 2s .c o m if (dl != null) { final ProgressDialog d = (ProgressDialog) dl; getActivity().runOnUiThread(new Runnable() { @Override public void run() { switch (state) { case DOWNLOAD_PENDING: d.setMessage("Download pending..."); break; case PREPARING_CONNECTION: d.setMessage("Preparing connection..."); break; case TRANSFER_IN_PROGRESS: if (progress > 0) { d.setMessage("Downloading file... (" + progress + "%)"); } else { d.setMessage("Downloading file..."); } break; case TRANSFER_COMPLETE: try { mResult = mFuture.getResult(); } catch (InterruptedException e) { Log.e(getClass().getSimpleName(), "impossible interrupt exception", e); } d.dismiss(); break; } } }); } }
From source file:org.androidpn.demoapp.MessageListActivity.java
private void checkIfAnyNewData() { final ProgressDialog checkDialog = new ProgressDialog(this); checkDialog.setMessage(getString(R.string.check_new_data)); checkDialog.show();/* w w w. j av a 2 s . co m*/ getSupportLoaderManager().restartLoader(LOADER_ONLINE_ID, null, new LoaderManager.LoaderCallbacks<MessageListResponse>() { @Override public Loader<MessageListResponse> onCreateLoader(int id, Bundle args) { String identity = MobilePushApp.getInstance().getUserIdentity(); String url = Constants.getMessageList(identity, ""); LoadContext<MessageListResponse> loadContext = new LoadContext<MessageListResponse>(); loadContext.setFlag(LoadContext.FLAG_HTTP_ONLY); loadContext.setClazz(MessageListResponse.class); loadContext.setParam(url); return new JsonLoaderJeallyBean<MessageListResponse>(MessageListActivity.this, loadContext, new Configuration.CREATOR().setExpiration(Constants.EXPIRATION_TIME) .setCacheDir(getCacheDir().toString()).create()); } @Override public void onLoadFinished(Loader<MessageListResponse> loader, MessageListResponse data) { if (data != null && data.getResultCode().equals("1") && data.getList().size() > 0) { if (!((SingleMessage) mAdapter.getItem(0)).getId().equals(data.getList().get(0).getId()) || manualRefresh) { getContentResolver().delete(ServerMessage.CONTENT_URI, null, null); saveData(data.getList()); mAdapter = new MessageListAdapter(MessageListActivity.this, data.getList()); mListView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); latestId = ((SingleMessage) (mAdapter.getItem(mAdapter.getCount() - 1))).getId(); } } if (checkDialog.isShowing()) checkDialog.dismiss(); manualRefresh = false; mListView.onRefreshComplete(); } @Override public void onLoaderReset(Loader<MessageListResponse> loader) { } }); }
From source file:com.callba.phone.ui.GroupSimpleDetailActivity.java
public void addToGroup(View view) { String st1 = getResources().getString(R.string.Is_sending_a_request); final String st2 = getResources().getString(R.string.Request_to_join); final String st3 = getResources().getString(R.string.send_the_request_is); final String st4 = getResources().getString(R.string.Join_the_group_chat); final String st5 = getResources().getString(R.string.Failed_to_join_the_group_chat); final ProgressDialog pd = new ProgressDialog(this); // getResources().getString(R.string) pd.setMessage(st1); pd.setCanceledOnTouchOutside(false); pd.show();/*from w ww . j av a2s.c o m*/ new Thread(new Runnable() { public void run() { try { //membersOnly??join if (group.isMembersOnly()) { runOnUiThread(new Runnable() { @Override public void run() { showDialog(); } }); } else { EMClient.getInstance().groupManager().joinGroup(groupid); LocalBroadcastManager.getInstance(GroupSimpleDetailActivity.this) .sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED)); } runOnUiThread(new Runnable() { public void run() { pd.dismiss(); btn_add_group.setEnabled(false); if (!group.isMembersOnly()) { Toast.makeText(GroupSimpleDetailActivity.this, st4, Toast.LENGTH_SHORT).show(); finish(); } } }); } catch (final HyphenateException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(GroupSimpleDetailActivity.this, st5 + e.getMessage(), Toast.LENGTH_SHORT) .show(); btn_add_group.setEnabled(true); } }); } } }).start(); }
From source file:com.example.hana.rentcostumes.RegisterActivity.java
public void signup() { Log.d(TAG, "Signup"); if (!validate()) { onSignupFailed();/*from w w w. j a va2 s . c o m*/ return; } //btnRegister.setEnabled(false); final ProgressDialog progressDialog = new ProgressDialog(RegisterActivity.this, R.style.MyTheme_ProgressDialog_); progressDialog.setIndeterminate(true); progressDialog.setMessage("Creating Account..."); progressDialog.show(); String fname = inputFirstName.getText().toString(); String lname = inputLastName.getText().toString(); String email = inputEmail.getText().toString(); String uname = inputUsername.getText().toString(); String password = inputPassword.getText().toString(); // TODO: Implement your own signup logic here. firebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful()); if (task.isSuccessful()) { Toast.makeText(RegisterActivity.this, R.string.auth_success, Toast.LENGTH_SHORT).show(); startActivity(new Intent(getApplicationContext(), MainActivity.class)); } progressDialog.dismiss(); } }); }
From source file:com.licenta.android.licenseapp.location.MapFragment.java
private void makeRequest() { String tag_json_obj = "json_obj_req"; String url = "http://api.bandsintown.com/artists/Metallica/events/search.json?api_version=2.0" + "&app_id=" + MyApplication.TAG;/*from www. j a v a 2 s. co m*/ final ProgressDialog pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Loading..."); pDialog.show(); JsonObjectRequest jsonObjReq; jsonObjReq = new JsonObjectRequest(Request.Method.GET, url, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Log.d(MyApplication.TAG, response.toString()); pDialog.hide(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d(MyApplication.TAG, "Error: " + error.getMessage()); // hide the progress dialog pDialog.hide(); } }); // Adding request to request queue MyApplication.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj); }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.EditFragment.java
/** * Sets the text of the comment being edited to the new text entered by the user, * sets the value of EditCommentFragment.oldText and EditCommentFragment.oldThumbnail * to null so that the state isn't preserved across comment edits, and returns the * user to their previous fragment.//w ww .j av a 2 s. c o m * * @param view The button that was pressed to call makeEdit. */ public void makeEdit(View view) { EditFragment.oldText = null; EditFragment.oldThumbnail = null; editComment.setTextPost(newTextPost.getText().toString()); ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage("Posting to Server"); if (isThread) { String threadTitle = thread.getTitle(); thread.setBodyComment(editComment); ThreadManager.startPost(editComment, threadTitle, editComment.getLocation(), dialog, true); CacheManager.getInstance().serializeThreadList(ThreadList.getThreads()); } else { ThreadManager.startPost(editComment, null, editComment.getLocation(), dialog, true); } InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); getFragmentManager().popBackStackImmediate(); }
From source file:com.inaetics.demonstrator.MainActivity.java
/** * Method to start a progress dialog and a download task. * @param url Url where to download from *///from w w w . ja v a 2 s .co m private void download(String url) { ProgressDialog progress = new ProgressDialog(this); progress.setTitle("Downloading"); progress.setMessage("Wait while downloading"); progress.show(); DownloadTask task = new DownloadTask(this, progress); task.execute(url); }