List of usage examples for android.app ProgressDialog show
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate)
From source file:au.com.wallaceit.reddinator.SubredditSelectActivity.java
private void refreshMultireddits() { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);//from w ww .j a v a2 s. com final ProgressDialog sdialog = ProgressDialog.show(SubredditSelectActivity.this, "Refreshing Multis", "One moment...", true); Thread t = new Thread() { public void run() { final int listLength; try { listLength = global.loadAccountMultis(); } catch (final RedditData.RedditApiException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { sdialog.dismiss(); // check login required if (e.isAuthError()) global.mRedditData.initiateLogin(SubredditSelectActivity.this); // show error Toast.makeText(SubredditSelectActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } }); return; } runOnUiThread(new Runnable() { public void run() { sdialog.dismiss(); if (listLength == 0) { Toast.makeText(SubredditSelectActivity.this, "No multis in your account \nClick the add multi button to create some", Toast.LENGTH_LONG).show(); } mMultiAdapter.refreshMultis(); } }); } }; t.start(); }
From source file:com.microsoft.live.sample.skydrive.SkyDriveActivity.java
private void loadFolder(String folderId) { assert folderId != null; mCurrentFolderId = folderId;/* ww w. j a v a 2 s . co m*/ final ProgressDialog progressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", true); mClient.getAsync(folderId + "/files", new LiveOperationListener() { @Override public void onComplete(LiveOperation operation) { progressDialog.dismiss(); JSONObject result = operation.getResult(); if (result.has(JsonKeys.ERROR)) { JSONObject error = result.optJSONObject(JsonKeys.ERROR); String message = error.optString(JsonKeys.MESSAGE); String code = error.optString(JsonKeys.CODE); showToast(code + ": " + message); return; } ArrayList<SkyDriveObject> skyDriveObjs = mPhotoAdapter.getSkyDriveObjs(); skyDriveObjs.clear(); JSONArray data = result.optJSONArray(JsonKeys.DATA); for (int i = 0; i < data.length(); i++) { SkyDriveObject skyDriveObj = SkyDriveObject.create(data.optJSONObject(i)); if (skyDriveObj != null) { skyDriveObjs.add(skyDriveObj); } } mPhotoAdapter.notifyDataSetChanged(); } @Override public void onError(LiveOperationException exception, LiveOperation operation) { progressDialog.dismiss(); showToast(exception.getMessage()); } }); }
From source file:com.ibuildapp.romanblack.WebPlugin.WebPlugin.java
private void showProgress() { if (state == states.LOAD_START) { state = states.LOAD_PROGRESS;/*w w w. ja v a 2s . com*/ } if (progressDialog == null || !progressDialog.isShowing()) { progressDialog = ProgressDialog.show(this, null, getString(R.string.romanblack_html_loading), true); progressDialog.setCancelable(false); progressDialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { handler.sendEmptyMessage(LOADING_ABORTED); } }); } }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
private void onExportMachines() { progDialog = ProgressDialog.show(activity, "Please Wait", "Exporting Machines...", true); ExportMachines exporter = new ExportMachines(); exporter.execute();/*from w w w. j av a2 s . c om*/ }
From source file:com.microsoft.live.sample.skydrive.SkyDriveActivity.java
private ProgressDialog showProgressDialog(String title, String message, boolean indeterminate) { return ProgressDialog.show(this, title, message, indeterminate); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
private void promptImportMachines() { // TODO Auto-generated method stub final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Import Machines"); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222);//from ww w.j a v a2 s . c o m TextView imageNameView = new TextView(activity); imageNameView.setVisibility(View.VISIBLE); imageNameView.setId(201012010); imageNameView.setText( "Step 1: Place the machine.CSV file you export previously under \"limbo\" directory in your SD card.\n" + "Step 2: WARNING: Any machine with the same name will be replaced!\n" + "Step 3: Press \"OK\".\n"); RelativeLayout.LayoutParams searchViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); mLayout.addView(imageNameView, searchViewParams); alertDialog.setView(mLayout); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // For each line create a Machine progDialog = ProgressDialog.show(activity, "Please Wait", "Importing Machines...", true); ImportMachines importer = new ImportMachines(); importer.execute(); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { return; } }); alertDialog.show(); }
From source file:net.phase.wallet.Currency.java
private void showTransactions(Wallet wallet, int style) { if (progress == null && wallet.transactions.length > 10) { progress = ProgressDialog.show(this, "Building Transaction List", "Please wait...", true); }/*from ww w . ja v a 2 s . c o m*/ Intent intent = new Intent(this, TransactionsActivity.class); intent.putExtra(WALLETNAME, wallet.name); intent.putExtra(TRANSACTIONSTYLE, style); intent.putExtra(DECIMALPOINTS, decimalpoints); Arrays.sort(wallet.transactions); if (style == TransactionAdapter.STYLE_NORMAL) { Transaction[] compressedTransactions = Transaction.compressTransactions(wallet.transactions); intent.putExtra(TRANSACTIONS, compressedTransactions); } else { intent.putExtra(TRANSACTIONS, wallet.transactions); } startActivity(intent); }
From source file:com.guardtrax.ui.screens.HomeScreen.java
@Override public void onBackPressed() { AlertDialog.Builder dialog = new AlertDialog.Builder(this); if (GTConstants.sendData) { dialog.setTitle("Warning"); dialog.setMessage("You must end shift before exit!"); dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override//w ww . j av a 2 s. c om public void onClick(DialogInterface dialog, int which) { return; } }); dialog.show(); } else { dialog.setTitle("Exit?"); dialog.setMessage("Are you sure you want to exit?"); dialog.setNegativeButton(android.R.string.no, null); dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); // Create a Dialog to let the User know that we're waiting for a GPS Fix pdialog = ProgressDialog.show(HomeScreen.this, "Please wait", "Exiting GT Android ...", true); Runnable showWaitDialog = new Runnable() { @Override public void run() { try { Looper.prepare(); MainService.closeLocationListener(); //close out GPS //only send 92 if online if (Utility.isOnline(HomeScreen.this)) { GTConstants.sendData = true; //allow the exit event to be sent send_event("92"); //send the event Utility.Sleep(4000); //give time for the event to be sent before exiting } stopService(); Utility.Sleep(1000); pdialog.dismiss(); Utility.Sleep(1000); //terminating the running threads and finishing program must be run on the main thread HomeScreen.this.runOnUiThread(new Runnable() { public void run() { if (pdialog.isShowing()) pdialog.dismiss(); HomeScreen.super.onBackPressed(); android.os.Process.killProcess(android.os.Process.myPid()); finish(); } }); } catch (Exception e) { //terminating the running threads and finishing program must be run on the main thread HomeScreen.this.runOnUiThread(new Runnable() { public void run() { if (pdialog.isShowing()) pdialog.dismiss(); HomeScreen.super.onBackPressed(); android.os.Process.killProcess(android.os.Process.myPid()); finish(); } }); } } }; Thread t = new Thread(showWaitDialog); t.start(); } }); dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (!Utility.deviceRegistered()) { //send_data = true; scan_click(false); } } }); dialog.show(); } }
From source file:com.xgf.inspection.qrcode.google.zxing.client.CaptureActivity.java
private void uploadData() { if (NetUtils.networkStatusOK(mContext)) { mIsHasUpload = !mIsHasUpload;/*www .j a va2 s .c o m*/ mQrUploadTv.setTextColor(getResources().getColor(R.color.gray_character)); mProgressDialog = ProgressDialog.show(mContext, " ", "", true); mProgressDialog.show(); mUploadFailList.clear(); mUploadValueFailList.clear(); uploadNum = 0; new Thread(new Runnable() { @Override public void run() { try { JSONArray jsonArray = new JSONArray(); Log.e("xxx_jsonArrayStr", "jsonArrayStr:" + mUploadJsonData); if (!TextUtils.isEmpty(mUploadJsonData)) { jsonArray = new JSONArray(mUploadJsonData); int size = jsonArray.length(); mUploadValueList.clear(); for (int i = 0; i < size; i++) { JSONObject uploadJsonObject = jsonArray.getJSONObject(i); UploadValue upload = (UploadValue) JsonUtils.fromJsonToJava(uploadJsonObject, UploadValue.class); BitmapUtils.setSize(480, 720); Bitmap bitmap = BitmapUtils.getBitmap(upload.getFileLocalUrl()); if (null != bitmap) { mBitmapList.add(bitmap); upload.setFileContent(ImageUtils.Bitmap2StrByBase64(bitmap)); String filePath = upload.getFileLocalUrl(); if (filePath.contains("/ins/")) { filePath = filePath.replace("/ins/", "/ins/fail/"); BitmapUtils.saveFile(bitmap, filePath); } } else { FileHelper.deleteSDFile("insnoupload.txt"); return; } mUploadValueList.add(upload); Log.e("xxx_upload", "upload" + upload.getSerialNumber()); AppLogic.SendWirePoleCheckRecordByHttp(mContext, mUploadHandler, upload.getUserPhoneCode(), upload.getQRcode(), upload.getSerialNumber(), upload.getFileSN(), upload.getFileContent()); mTimeHandler.sendEmptyMessageDelayed(TIME_UPDATE, 1000 * 30); } } FileHelper.deleteSDFile("insnoupload.txt"); } catch (Exception e) { e.printStackTrace(); } } }).start(); } else { Toast.makeText(mContext, "?? ", Toast.LENGTH_SHORT).show(); } }
From source file:com.piggate.sdk.Piggate.java
public boolean validateCard(String cardNumber, int cardExpMonth, int cardExpYear, String cardCVC, String token, Context context) {// ww w.jav a 2s . c om final PiggateCard creditCard = new PiggateCard(cardNumber, cardCVC, cardExpMonth, cardExpYear); Card card = new Card(cardNumber, cardExpMonth, cardExpYear, cardCVC); //Create the Card object for Stripe validator if (card.validateCard()) { //Validate the credit card final ProgressDialog loadingDialog = ProgressDialog.show(context, "Validating", "Creating token...", true); //Create the Stripe token new Stripe().createToken(card, token, new TokenCallback() { public void onSuccess(Token token) { //If create the token successfully creditCard.setTokenID(token.getId()); //Set the token ID in the PiggateCard object addCreditCard(creditCard); //Add the credit card to the ArrayList loadingDialog.dismiss(); } public void onError(Exception error) { //If there's an error creating the token //Handle the error loadingDialog.dismiss(); } }); return true; //Return true if card is validated } else return false; //Return false if card is not validated }