List of usage examples for android.app ProgressDialog dismiss
@Override public void dismiss()
From source file:com.haseebelahi.usman.UserProfile.java
public void getDriverDetails() { String url = "http://asfand.danglingpixels.com/taxi/app/get_driver.php?user_id=" + logged_in; //showing dialog box final ProgressDialog progressDialog = new ProgressDialog(this.getActivity(), R.style.AppTheme_Dark_Dialog); progressDialog.setIndeterminate(true); progressDialog.setMessage("Updating..."); progressDialog.show();/*from w w w . ja va 2s .c om*/ // Request a string response StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { // Result handling System.out.println(response); progressDialog.dismiss(); try { JSONArray jsonArray = new JSONArray(response); JSONObject jsonObject = jsonArray.getJSONObject(0); name.setText("Name: " + jsonObject.getString("name")); username.setText("License: " + jsonObject.getString("license")); email.setText("Mobile: " + jsonObject.getString("mobile")); cnic.setText(""); } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // Error handling System.out.println("Something went wrong!"); error.printStackTrace(); progressDialog.dismiss(); Toast.makeText(getContext(), "FAILED TO CONNECT", Toast.LENGTH_LONG).show(); } }); // Add the request to the queue int socketTimeout = 30000;//30 seconds - change to what you want RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); stringRequest.setRetryPolicy(policy); Volley.newRequestQueue(this.getContext()).add(stringRequest); }
From source file:com.rastating.droidbeard.fragments.ShowFragment.java
private void onEpisodeSearchItemSelected() { SickbeardTaskPool<Void> pool = new SickbeardTaskPool<Void>(); for (EpisodeItem episodeItem : mSelectedEpisodes) { Episode episode = episodeItem.getEpisode(); EpisodeSearchTask task = new EpisodeSearchTask(getActivity(), episode.getTVDBID(), episode.getSeasonNumber(), episode.getEpisodeNumber()); pool.addTask(task);/* w ww .j a v a2s.co m*/ } final ProgressDialog dialog = createProgressDialog("Searching for Selected Episodes", "Please wait..."); dialog.show(); pool.setTaskPoolSubscriber(new TaskPoolSubscriber() { @Override public void executionFinished() { dialog.dismiss(); for (int i = mSelectedEpisodes.size() - 1; i >= 0; i--) { EpisodeItem item = mSelectedEpisodes.get(i); item.setChecked(false); } mSelectedEpisodes.clear(); onRefreshButtonPressed(); } }); pool.start(); }
From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.util.FileUtils.java
private static void showMedia(final String localId, final Context ctx, final ProgressDialog dialog) { new AsyncTask<Void, Void, Boolean>() { private boolean noMedia = false; @Override/*from w ww .ja v a 2 s . c o m*/ protected Boolean doInBackground(Void... params) { File file1 = new File(FileUtils.getDir(), localId + ConstantKeys.EXTENSION_JPG); File file2 = new File(FileUtils.getDir(), localId + ConstantKeys.EXTENSION_3GP); Intent mediaPlayer = new Intent(Intent.ACTION_VIEW); if (file1.exists()) { mediaPlayer.setDataAndType(Uri.fromFile(file1), "image/*"); } else if (file2.exists()) { mediaPlayer.setDataAndType(Uri.fromFile(file2), "video/*"); } else { noMedia = true; return false; } ctx.startActivity(mediaPlayer); return true; } @Override protected void onPostExecute(Boolean result) { if (dialog != null) { dialog.dismiss(); } if (noMedia) { Toast.makeText(ctx.getApplicationContext(), ctx.getApplicationContext().getText(R.string.no_media), Toast.LENGTH_SHORT).show(); noMedia = false; } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:com.rastating.droidbeard.fragments.ShowFragment.java
private void onSetStatusItemSelected(MenuItem item) { // Group selected episodes into a list of individual episodes and full seasons... ArrayList<SeasonTable> selectedSeasons = new ArrayList<SeasonTable>(); ArrayList<EpisodeItem> selectedEpisodes = new ArrayList<EpisodeItem>(); for (EpisodeItem episode : mSelectedEpisodes) { SeasonTable seasonTable = episode.getSeasonTable(); if (seasonTable.allEpisodesChecked()) { if (!selectedSeasons.contains(seasonTable)) { selectedSeasons.add(seasonTable); }// ww w .j a va 2s . c o m } else { selectedEpisodes.add(episode); } } String status = ""; if (item.getItemId() == R.id.set_wanted) { status = "wanted"; } else if (item.getItemId() == R.id.set_skipped) { status = "skipped"; } else if (item.getItemId() == R.id.set_ignored) { status = "ignored"; } else { status = "archived"; } SickbeardTaskPool<String> pool = new SickbeardTaskPool<String>(); for (SeasonTable seasonTable : selectedSeasons) { Season season = seasonTable.getSeason(); SetEpisodeStatusTask task = buildEpisodeStatusTask(seasonTable, null, season.getTVDBID(), season.getSeasonNumber(), -1, status); pool.addTask(task); } for (EpisodeItem episodeItem : selectedEpisodes) { Episode episode = episodeItem.getEpisode(); SetEpisodeStatusTask task = buildEpisodeStatusTask(null, episodeItem, episode.getTVDBID(), episode.getSeasonNumber(), episode.getEpisodeNumber(), status); pool.addTask(task); } final ProgressDialog dialog = createProgressDialog("Performing Status Updates", "Please wait..."); dialog.show(); pool.setTaskPoolSubscriber(new TaskPoolSubscriber() { @Override public void executionFinished() { dialog.dismiss(); mSelectedEpisodes.clear(); } }); pool.start(status); }
From source file:net.palacesoft.cngstation.client.StationActivity.java
private void startTrackingMyLocation(final int zoomLevel) { final ProgressDialog progressDialog = createProgressDialog("Trying to find your location..."); progressDialog.show();// w w w .ja v a 2s . co m myLocationOverlay.runOnFirstFix(new Runnable() { @Override public void run() { currentLocation = myLocationOverlay.getLastFix(); runOnUiThread(new Runnable() { public void run() { progressDialog.dismiss(); if (currentLocation != null) { try { currentLocationAddress = lookupAddressFromLocation(currentLocation); new StationLoader(StationActivity.this, currentLocationAddress, zoomLevel, STATIONS_URL).execute(); } catch (AddressEmptyException e) { BugSenseHandler.log("Could not determine the user's location ", e); showInfoMessage("Could not determine your location. Refresh option might help"); } catch (IOException e) { //ignore } } } }); } }); }
From source file:ansteph.com.beecab.view.profile.DriverProfileView.java
private void getProfileData() { final ProgressDialog loading = ProgressDialog.show(this, "Please wait ", "Fetching data...", false, false); String url = String.format(Config.RETRIEVE_DRIVER_PROFILE_URL, taxiID); StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override/*from w ww . j av a2 s. c o m*/ public void onResponse(String response) { loading.dismiss(); JSONObject jsonResponse = null; try { jsonResponse = new JSONObject(response); boolean error = jsonResponse.getBoolean(Config.ERROR_RESPONSE); String serverMsg = jsonResponse.getString(Config.MSG_RESPONSE); if (!error) { //get the user detail from the server (String carModel, String carNumberPlate, String currentCity, String profileRating, // String name, String email, String mobile) { JSONArray profile = jsonResponse.getJSONArray("profile"); JSONObject user = profile.getJSONObject(0); //getString(Config.KEY_ID) // String carModel, String carNumberPlate, String currentCity, String profileRating driverProfile = new DriverProfile(user.getString(Config.KEY_CAR_MODEL), user.getString(Config.KEY_CAR_NUMPLATE), user.getString(Config.KEY_CURRENT_CITY), user.getString(Config.KEY_PRO_RATING), user.getString(Config.KEY_DRIVER_NAME), user.getString(Config.KEY_DRIVER_EMAIL), user.getString(Config.KEY_DRIVER_MOBILE) ); driverProfile.setYearoflicense(user.getString(Config.KEY_DRIVER_YEAR)); driverProfile.setLicense(user.getString(Config.KEY_DRIVER_LICENSE)); } } catch (JSONException e) { e.printStackTrace(); } finally { updateUI(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { loading.dismiss(); Toast.makeText(getApplicationContext(), "Oops! Profile unreachable! Please check your internet connection", Toast.LENGTH_LONG) .show(); } }) { }; //Creating a request queue RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); //Adding our request to the queue requestQueue.add(stringRequest); }
From source file:cn.kangeqiu.kq.activity.SettingsFragment.java
void logout() { final ProgressDialog pd = new ProgressDialog(getActivity()); String st = getResources().getString(R.string.Are_logged_out); pd.setMessage(st);/*from w ww. j a v a 2 s. com*/ pd.setCanceledOnTouchOutside(false); pd.show(); BaseApplication.getInstance().logout(new EMCallBack() { @Override public void onSuccess() { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // ?? ((MainActivity) getActivity()).finish(); startActivity(new Intent(getActivity(), LoginActivity.class)); } }); } @Override public void onProgress(int progress, String status) { } @Override public void onError(int code, String message) { } }); }
From source file:com.avcall.app.ui.SettingsFragment.java
void logout() { final ProgressDialog pd = new ProgressDialog(getActivity()); String st = getResources().getString(R.string.Are_logged_out); pd.setMessage(st);//from w ww . j av a 2s. co m pd.setCanceledOnTouchOutside(false); pd.show(); AvcallHelper.getInstance().logout(false, new EMCallBack() { @Override public void onSuccess() { getActivity().runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // show login screen ((MainActivity) getActivity()).finish(); startActivity(new Intent(getActivity(), LoginActivity.class)); } }); } @Override public void onProgress(int progress, String status) { } @Override public void onError(int code, String message) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub pd.dismiss(); Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show(); } }); } }); }
From source file:com.nxt.njitong.SettingsActivity.java
void logout() { final ProgressDialog pd = new ProgressDialog(SettingsActivity.this); String st = getResources().getString(R.string.Are_logged_out); pd.setMessage(st);/*from www . j av a2s . c om*/ pd.setCanceledOnTouchOutside(false); pd.show(); DemoApplication.getInstance().logout(new EMCallBack() { @Override public void onSuccess() { runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // ?? util.saveToSp("islogin", "false"); SettingsActivity.this.finish(); JPushInterface.stopPush(SettingsActivity.this.getApplication()); startActivity(new Intent(SettingsActivity.this, LoginActivity.class)); } }); } @Override public void onProgress(int progress, String status) { } @Override public void onError(int code, String message) { } }); }
From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java
/** * Delete beer on server/*from ww w.j a va 2s .c om*/ */ private void deleteBeer() { 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(); APIService.get().deleteBeer(beerResponseEdit.getId(), new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) { @Override public void onResults(BeerResponse beerResponse) { progressDialog.dismiss(); Toast.makeText(BeerActivity.this, R.string.beerDeleted, 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(); } }); }