List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable)
From source file:com.lge.friendsCamera.CameraFileListViewActivity.java
/** * Get full-size video or full-size image from camera * API: /osc/commands/execute (camera.getFile) * * @param position a position of the selected row *///from w ww . j av a 2 s. com private void getFullFile(final int position) { currentDownloadFile = adapter.getInfo(position, OSCParameterNameMapper.FileInfo.NAME); JSONObject parameters = new JSONObject(); try { String url = adapter.getInfo(position, OSCParameterNameMapper.FileInfo.URL); parameters.put(OSCParameterNameMapper.FILEURL, url); OSCCommandsExecute commandsExecute; //Set the data type for request (image or video) //It will set different http request header property if (mediaType.equals(IMAGE)) { commandsExecute = new OSCCommandsExecute("camera.getFile", parameters, OSCCommandsExecute.CommandType.IMAGE); } else if (mediaType.equals(VIDEO)) { commandsExecute = new OSCCommandsExecute("camera.getFile", parameters, OSCCommandsExecute.CommandType.VIDEO); } else { Log.d(TAG, "Media type should be image or video"); return; } commandsExecute.setListener(new HttpAsyncTask.OnHttpListener() { @Override public void onResponse(OnHttpListener.OSCReturnType type, Object response) { if (type == OSCReturnType.SUCCESS) { //Get binary data from camera and save successfully //Response of getFile is the fileUri of the saved file String name = adapter.getInfo(position, OSCParameterNameMapper.FileInfo.NAME); handleResponse(name, (String) response); } else { Utils.showTextDialog(mContext, getString(R.string.response), Utils.parseString(response)); } } }); commandsExecute.execute(); //Set downloading flag as true startDownloading = true; mProgressDialog = ProgressDialog.show(mContext, "", "Downloading...", true, false); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.lge.friendsCamera.CameraFileListViewActivity.java
/** * Delete selected files/* w w w.jav a 2 s .co m*/ * API: /osc/commands/execute (camera.delete) * * @param positions positions of the selected row * @param removeAll removeAll flag. True = remove All / False = remove only selected items */ private void deleteFilesFromCamera(final int[] positions, final boolean removeAll) { String[] fileUrls; if (removeAll) { //Set parameter for remove all fileUrls = new String[1]; if (mediaType.equals(IMAGE)) fileUrls[0] = "image"; else if (mediaType.equals(VIDEO)) fileUrls[0] = "video"; } else { //Set fileUrls parameter with file urls of selected items int len = positions.length; fileUrls = new String[len]; for (int i = 0; i < len; i++) { fileUrls[i] = adapter.getInfo(positions[i], OSCParameterNameMapper.FileInfo.URL); } } JSONObject parameters = new JSONObject(); try { JSONArray urlsParameter = new JSONArray(fileUrls); parameters.put(OSCParameterNameMapper.FILEURLS, urlsParameter); } catch (JSONException e) { e.printStackTrace(); } final OSCCommandsExecute cmdExecute = new OSCCommandsExecute("camera.delete", parameters); cmdExecute.setListener(new HttpAsyncTask.OnHttpListener() { @Override public void onResponse(OnHttpListener.OSCReturnType type, Object response) { if (type == OSCReturnType.SUCCESS) { //Update adapter if (removeAll) { adapter.removeAllItems(); } else { adapter.removeItems(positions); } adapter.notifyDataSetChanged(); } if (mProgressDialog.isShowing()) { mProgressDialog.cancel(); } Utils.showTextDialog(mContext, getString(R.string.response), Utils.parseString(response)); } }); cmdExecute.execute(); mProgressDialog = ProgressDialog.show(mContext, "", "Processing...", true, false); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void waitForSettings(boolean waitForUUID, boolean waitForHistoryFilters, boolean forceWait) { final boolean haveUuid = haveUuid(); if (forceWait || (waitForUUID && !haveUuid) || (waitForHistoryFilters && !haveHistoryFilters())) { if (loadingDialog != null) loadingDialog.dismiss();//from ww w . ja va2 s. com if (settingsTask != null && settingsTask.getStatus() == AsyncTask.Status.RUNNING) { final CharSequence title = getResources().getText( !haveUuid ? R.string.main_dialog_registration_title : R.string.main_dialog_reload_title); final CharSequence text = getResources().getText( !haveUuid ? R.string.main_dialog_registration_text : R.string.main_dialog_reload_text); loadingDialog = ProgressDialog.show(this, title, text, true, true); loadingDialog.setOnCancelListener(new ProgressDialog.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { onBackPressed(); } }); } } }
From source file:com.TakeTaxi.jy.MainMapScreen.java
public void noNetworkConnection() { //progress dialog for DC pdDC = ProgressDialog.show(MainMapScreen.this, "", "Trying to connect to servers...\nPlease check internet connection.", true, false); }
From source file:org.csware.ee.utils.Tools.java
public static ProgressDialog getDialog(Context context) { ProgressDialog dialog = ProgressDialog.show(context, null, ",,?...", true, true);/* ww w. j av a2 s. c o m*/ // dialog.getWindow().setContentView(R.layout.refresh); return dialog; }
From source file:com.t2.dataouthandler.DataOutHandler.java
/** * Performs traditional login via Drupal services. * /*from w w w . j av a2 s . c o m*/ * @param username - username to use in Drupal login * @param password - password to use in Drupal login */ public void traditionalLogin(String username, String password) { UserServices us; us = new UserServices(mServicesClient); Log.d(TAG, "mServicesClient = " + mServicesClient); mProgressDialog = ProgressDialog.show(mContext, "", "Logging you in", true, false); us.Login(username, password, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.d(TAG, "response = " + response); mLoggedInAsTraditional = true; mAuthenticated = true; mProgressDialog.hide(); mProgressDialog.dismiss(); DrupalRegistrationResponse jsonResponse = new DrupalRegistrationResponse(response); if (jsonResponse != null) { mDrupalUserId = jsonResponse.mUid; } List<Cookie> list = new ArrayList<Cookie>(); list = mInstance.mCookieStore.getCookies(); Log.e(TAG, "CSRFSessionLookie = " + list.get(0).toString()); if (mRequiresCSRF) { if (VERBOSE_LOGGING) { Log.e(TAG, "Requesting CSRF Token"); } getCSRFToken(); } mAuthProvider = "Traditional"; mAuth_info = new JRDictionary(); if (mT2AuthDelegate != null) { mT2AuthDelegate.T2AuthSuccess(mAuth_info, mAuthProvider, null, null); } } @Override public void onFailure(Throwable e, String response) { Log.e(TAG, e.toString()); mProgressDialog.hide(); mProgressDialog.dismiss(); mAuthProvider = "Traditional"; JREngageError error = new JREngageError(response, JREngageError.AuthenticationError.AUTHENTICATION_FAILED, JREngageError.ErrorType.AUTHENTICATION_FAILED); if (mT2AuthDelegate != null) { mT2AuthDelegate.T2AuthFail(error, mAuthProvider); } } @Override public void onFinish() { Log.e(TAG, "traditionalLogin onFinish()"); mProgressDialog.hide(); mProgressDialog.dismiss(); } }); }
From source file:com.chatwing.whitelabel.activities.CommunicationActivity.java
@Override public void logout() { if (mUserManager.getCurrentUser() == null) { return;//from w ww . j a v a 2s . c om } new AsyncTask<Void, Void, Void>() { public ProgressDialog dialog; @Override protected void onPreExecute() { super.onPreExecute(); dialog = ProgressDialog.show(getDialogContext(), "", getString(R.string.logging_out), true, false); } @Override protected Void doInBackground(Void... params) { try { String regId = mGcmManager.getRegistrationId(); mApiManager.updateGcm(mUserManager.getCurrentUser(), regId, ApiManager.GCM_ACTION_REMOVE); } catch (Exception e) { LogUtils.e(e); } mGcmManager.clearRegistrationId(); try { getContentResolver().applyBatch(ChatWingContentProvider.AUTHORITY, ChatWingContentProvider.getClearAllDataBatch()); } catch (Exception e) { LogUtils.e(e); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (dialog.isShowing()) { dialog.dismiss(); } mCurrentCommunicationMode.logout(); mUserManager.removeUsers(); mBus.post(ChatServiceEvent.unsubscribeAllChannels()); mCurrentCommunicationMode.deactivate(); Intent i = new Intent(CommunicationActivity.this, getEntranceActivityClass()); startActivity(i); finish(); } }.execute(); }
From source file:com.t2.dataouthandler.DataOutHandler.java
/** * Performs traditional logout via Drupal Services *///from w ww. ja v a 2 s .c o m void traditionalLogout() { UserServices us; us = new UserServices(mServicesClient); Log.d(TAG, "mServicesClient = " + mServicesClient); mServicesClient.setCookieStore(mCookieStore); mProgressDialog = ProgressDialog.show(mContext, "", "Logging you out", true, false); us.Logout(new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.d(TAG, "response = " + response); mLoggedInAsTraditional = false; mAuthenticated = false; mProgressDialog.hide(); mProgressDialog.dismiss(); new AlertDialog.Builder(mContext).setMessage("Logout was successful.").setPositiveButton("OK", null) .setCancelable(true).create().show(); } @Override public void onFailure(Throwable e, String response) { Log.e(TAG, e.toString()); mProgressDialog.hide(); mProgressDialog.dismiss(); new AlertDialog.Builder(mContext).setMessage("Logout failed.").setPositiveButton("OK", null) .setCancelable(true).create().show(); } @Override public void onFinish() { mProgressDialog.hide(); mProgressDialog.dismiss(); } }); }
From source file:com.samknows.measurement.activity.SamKnowsAggregateStatViewerActivity.java
private ProgressDialog getProgressDialog(String message) { return ProgressDialog.show(SamKnowsAggregateStatViewerActivity.this, "", message, true, true); }
From source file:org.csp.everyaware.offline.Map.java
/******************************* DIALOGS ****************************************************/ public void createProgressDialog(String msg, boolean cancelable) { mProgressDialog = ProgressDialog.show(Map.this, getResources().getString(R.string.app_name), msg, true, true);/*from w w w .j a v a 2s .c o m*/ }