List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message)
From source file:com.rvl.android.getnzb.LocalNZB.java
public void uploadLocalFileFTP(String filename) { UPLOADFILENAME = filename;//from w ww . j a v a 2s.c om UPLOADDIALOG = ProgressDialog.show(this, "Please wait...", "Uploading '" + filename + "' to FTP server."); SharedPreferences prefs = GetNZB.preferences; if (prefs.getString("FTPHostname", "") == "") { uploadDialogHandler.sendEmptyMessage(0); Toast.makeText(this, "Upload to FTP server not possible. Please check FTP preferences.", Toast.LENGTH_LONG).show(); return; } new Thread() { public void run() { SharedPreferences prefs = GetNZB.preferences; FTPClient ftp = new FTPClient(); String replycode = ""; String FTPHostname = prefs.getString("FTPHostname", ""); String FTPUsername = prefs.getString("FTPUsername", "anonymous"); String FTPPassword = prefs.getString("FTPPassword", "my@email.address"); String FTPPort = prefs.getString("FTPPort", "21"); String FTPUploadPath = prefs.getString("FTPUploadPath", "~/"); if (!FTPUploadPath.matches("$/")) { Log.d(Tags.LOG, "Adding trailing slash"); FTPUploadPath += "/"; } String targetFile = FTPUploadPath + UPLOADFILENAME; try { ftp.connect(FTPHostname, Integer.parseInt(FTPPort)); if (ftp.login(FTPUsername, FTPPassword)) { ftp.setFileType(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); File file = new File(getFilesDir() + "/" + UPLOADFILENAME); BufferedInputStream buffIn = new BufferedInputStream(new FileInputStream(file)); Log.d(Tags.LOG, "Saving file to:" + targetFile); if (ftp.storeFile(targetFile, buffIn)) { Log.d(Tags.LOG, "FTP: File should be uploaded. Replycode: " + Integer.toString(ftp.getReplyCode())); isUploadedFTP = true; } else { Log.d(Tags.LOG, "FTP: Could not upload file Replycode: " + Integer.toString(ftp.getReplyCode())); FTPErrorCode = Integer.toString(ftp.getReplyCode()); isUploadedFTP = false; } buffIn.close(); ftp.logout(); ftp.disconnect(); } else { Log.d(Tags.LOG, "No ftp login"); } } catch (SocketException e) { Log.d(Tags.LOG, "ftp(): " + e.getMessage()); return; } catch (IOException e) { Log.d(Tags.LOG, "ftp(): " + e.getMessage()); return; } if (isUploadedFTP) { removeLocalNZBFile(UPLOADFILENAME); } UPLOADFILENAME = ""; uploadDialogHandlerFTP.sendEmptyMessage(0); } }.start(); }
From source file:gr.scify.newsum.ui.ViewActivity.java
private void showWaitingDialog() { if (!bShowWaiting) { return;//from w ww . jav a2 s. co m } runOnUiThread(new Runnable() { @Override public void run() { if (pd == null) // show progress dialog pd = ProgressDialog.show(ViewActivity.this, "", getResources().getText(R.string.wait_msg)); else pd.show(); } }); }
From source file:hr.fg.mobile.plugins.ImageDownloader.java
/** * Same as download but the image is always downloaded and the cache is not * used. Kept private at the moment as its interest is not clear. *///from ww w .j a va 2s . c o m private void forceDownload(String url, ImageView imageView, String cookie) { // State sanity: url is guaranteed to never be null in // DownloadedDrawable and cache keys. if (url == null) { imageView.setImageDrawable(null); return; } if (cancelPotentialDownload(url, imageView)) { /* * dodatak by: strewk dialog dok se ucitava */ ProgressDialog dialog = null; if (dial) { dialog = ProgressDialog.show(c, "", "Slika se uitava.."); } BitmapDownloaderTask task = new BitmapDownloaderTask(imageView); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); task.execute(new Object[] { url, cookie, dialog }); } }
From source file:net.reichholf.dreamdroid.activities.DreamDroidShareActivity.java
@SuppressWarnings("unchecked") public void execSimpleResultTask(ArrayList<NameValuePair> params) { if (mSimpleResultTask != null) { mSimpleResultTask.cancel(true);/* w w w . ja v a 2 s. c o m*/ } mProgress = ProgressDialog.show(this, getString(R.string.loading), getString(R.string.loading)); SimpleResultRequestHandler handler = new SimpleResultRequestHandler(URIStore.MEDIA_PLAYER_PLAY); mSimpleResultTask = new SimpleResultTask(handler); mSimpleResultTask.execute(params); }
From source file:ch.eitchnet.android.mabea.activity.SettingsFragment.java
private void checkConnection() { Logger.i(TAG, "checkConnection", "called"); try {//from ww w.j a va2 s . co m String msg = updateModel(); if (msg != null) { DialogUtil.showErrorDialog(getActivity(), "Missing input", msg); return; } // show progress dialog SyncExec action = new SyncExec() { @Override protected void execute() { Setting setting = MabeaApplication.getContext().getSetting(); progressDlg = ProgressDialog.show(getActivity(), "Checking input", "Connecting to " + setting.getUrl() + " for user " + setting.getUsername() + "..."); } }; action.runOnUiThread(getActivity()); Logger.i(TAG, "run", "Starting..."); MabeaConnection connection = MabeaApplication.getContext().getConnection(); connection.checkConnection(); if (!connection.hasError()) { persist(); } String statusMsg = createStatusMsg(connection); MabeaApplication.getContext().setConnectionStateMsg(statusMsg); getActivity().runOnUiThread(new Runnable() { @Override public void run() { updateUi(); if (progressDlg != null) progressDlg.dismiss(); } }); Logger.i(TAG, "checkConnection", "Done."); } catch (Exception e) { Logger.e(TAG, "checkConnection", e.getMessage(), e); DialogUtil.showExceptionDialog(getActivity(), TAG, e); } }
From source file:be.vbsteven.bmtodesk.SendAllCurrentBookmarksActivity.java
private void showProgress() { if (progress != null) { progress.dismiss();/*from www .jav a 2 s. co m*/ } progress = ProgressDialog.show(this, "Bookmark to Desktop", "Sending " + queue.size() + " bookmarks to server"); }
From source file:dk.kasperbaago.JSONHandler.JSONHandler.java
@Override protected void onPreExecute() { this.prossDiag = ProgressDialog.show(this.context, this.diagTitle, this.diagMsg); super.onPreExecute(); }
From source file:com.github.ajasmin.telususageandroidwidget.ReportAccountErrorActivity.java
private void showPostState() { switch (postDataThread.result) { case IN_PROGRESS: if (progressDialog == null) { progressDialog = ProgressDialog.show(this, null, getString(R.string.sending_data)); }/*ww w . j a va2 s . c om*/ break; case COMPLETE: dismissDialogs(); if (completeDialog == null) { completeDialog = new AlertDialog.Builder(this).setMessage(R.string.report_sent).setCancelable(false) .setPositiveButton(R.string.okay, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { postDataThreadsMap.remove(appWidgetId); finish(); } }).show(); } break; case ERROR: dismissDialogs(); if (errorDialog == null) { errorDialog = new AlertDialog.Builder(this).setMessage(R.string.unable_to_send_data) .setCancelable(false).setPositiveButton(R.string.okay, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { postDataThreadsMap.remove(appWidgetId); dismissDialogs(); } }).show(); } break; } }
From source file:com.microsoft.live.sample.ExplorerActivity.java
private ProgressDialog showProgressDialog(String message) { return ProgressDialog.show(this, "", message); }
From source file:com.cianmcgovern.android.ShopAndShare.Share.java
/** * Calls upload() in a separate thread and displays a progress dialog while * it's executing/* w w w. j av a 2s .c o m*/ * * @param instance * The results instance to use * @param location * The location as specified by the user * @param store * The store as specified by the user * */ private void runUpload(final Results instance, final String location, final String store) { mDialog = ProgressDialog.show(this, "", "Uploading. Please wait..."); new Thread(new Runnable() { @Override public void run() { try { message = upload(instance, location, store); mDialog.dismiss(); // If we get a response that contains data then something // went wrong so we prompt the user to try again // An empty response signals a successful upload if (message.length() > 1) { Intent in = new Intent(ShopAndShare.sContext, FailedUpload.class); startActivity(in); } else { if (mLocationListener != null) mLocationManager.removeUpdates(mLocationListener); finish(); } } catch (ClientProtocolException e) { Log.e(Constants.LOG_TAG, "Encountered exception when uploading results"); e.printStackTrace(); } catch (IOException e) { Log.e(Constants.LOG_TAG, "Encountered exception when uploading results"); e.printStackTrace(); } } }).start(); }