List of usage examples for android.app ProgressDialog setTitle
@Override public void setTitle(CharSequence title)
From source file:com.pansapiens.occyd.Search.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_SEARCHING: { ProgressDialog dialog = new ProgressDialog(this); dialog.setTitle("Searching ..."); dialog.setMessage("Searching ..."); dialog.setIndeterminate(true);//from www .ja v a2 s. com dialog.setCancelable(false); return dialog; } } return null; }
From source file:com.koushikdutta.superuser.MainActivity.java
void doSystemInstall() { final ProgressDialog dlg = new ProgressDialog(this); dlg.setTitle(R.string.installing); dlg.setMessage(getString(R.string.installing_superuser)); dlg.setIndeterminate(true);// www .ja v a2 s . c o m dlg.show(); new Thread() { public void run() { boolean _error = false; try { final File su = extractSu(); final String command = "mount -orw,remount /system\n" + "rm /system/xbin/su\n" + "rm /system/bin/su\n" + "rm /system/app/Supersu.*\n" + "rm /system/app/superuser.*\n" + "rm /system/app/supersu.*\n" + "rm /system/app/SuperUser.*\n" + "rm /system/app/SuperSU.*\n" + String.format("cat %s > /system/xbin/su\n", su.getAbsolutePath()) + "chmod 6755 /system/xbin/su\n" + "ln -s /system/xbin/su /system/bin/su\n" + "mount -oro,remount /system\n" + "sync\n"; Process p = Runtime.getRuntime().exec("su"); p.getOutputStream().write(command.getBytes()); p.getOutputStream().close(); if (p.waitFor() != 0) throw new Exception("non zero result"); SuHelper.checkSu(MainActivity.this); } catch (Exception ex) { _error = true; Log.e("Superuser", "error upgrading", ex); } dlg.dismiss(); final boolean error = _error; runOnUiThread(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setPositiveButton(android.R.string.ok, null); builder.setTitle(R.string.install); if (error) { builder.setMessage(R.string.install_error); } else { builder.setMessage(R.string.install_success); } builder.create().show(); } }); }; }.start(); }
From source file:it.scoppelletti.mobilepower.app.ProgressDialogFragment.java
/** * Crea il dialogo.//from w ww. j a v a 2 s . c om * * @param savedInstanceState Stato dell’istanza. * @return Dialogo. */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { int max, resId; ProgressDialog dlg; Bundle args = getArguments(); dlg = new ProgressDialog(getActivity(), AppUtils.getDialogTheme()); resId = args.getInt(ProgressDialogFragment.ARG_TITLEID); dlg.setTitle(getString(resId)); max = args.getInt(ProgressDialogFragment.ARG_MAX, -1); if (max > 0) { dlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dlg.setIndeterminate(false); dlg.setMax(max); } else { dlg.setIndeterminate(true); dlg.setProgressStyle(ProgressDialog.STYLE_SPINNER); } dlg.setCancelable(args.getBoolean(ProgressDialogFragment.ARG_CANCELABLE)); dlg.setCanceledOnTouchOutside(false); return dlg; }
From source file:com.pixmob.r2droid.SelectAccountActivity.java
@Override protected Dialog onCreateDialog(int id) { if (AUTH_PENDING_DIALOG == id) { return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.auth_pending) .setIcon(R.drawable.alert_dialog_icon).create(); }//from ww w. j a v a 2 s . co m if (AUTH_ERROR_DIALOG == id) { return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.auth_failed_error) .setIcon(R.drawable.alert_dialog_icon).create(); } if (NETWORK_ERROR_DIALOG == id) { return new AlertDialog.Builder(this).setTitle(R.string.error).setMessage(R.string.network_error) .setIcon(R.drawable.alert_dialog_icon).create(); } if (PROGRESS_DIALOG == id) { final ProgressDialog d = new ProgressDialog(this); d.setTitle(R.string.please_wait); d.setMessage(getString(R.string.checking_account)); d.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { accountVerifier.cancel(true); accountVerifier = null; } }); return d; } return super.onCreateDialog(id); }
From source file:fm.smart.r1.CreateExampleActivity.java
public void onClick(View v) { EditText exampleInput = (EditText) findViewById(R.id.create_example_sentence); EditText translationInput = (EditText) findViewById(R.id.create_example_translation); EditText exampleTransliterationInput = (EditText) findViewById(R.id.sentence_transliteration); EditText translationTransliterationInput = (EditText) findViewById(R.id.translation_transliteration); final String example = exampleInput.getText().toString(); final String translation = translationInput.getText().toString(); if (TextUtils.isEmpty(example) || TextUtils.isEmpty(translation)) { Toast t = Toast.makeText(this, "Example and translation are required fields", 150); t.setGravity(Gravity.CENTER, 0, 0); t.show();/*from w w w . jav a 2s.c om*/ } else { final String example_language_code = Utils.LANGUAGE_MAP.get(example_language); final String translation_language_code = Utils.LANGUAGE_MAP.get(translation_language); final String example_transliteration = exampleTransliterationInput.getText().toString(); final String translation_transliteration = translationTransliterationInput.getText().toString(); if (LoginActivity.isNotLoggedIn(this)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(this, LoginActivity.class.getName()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // avoid // navigation // back to this? LoginActivity.return_to = CreateExampleActivity.class.getName(); LoginActivity.params = new HashMap<String, String>(); LoginActivity.params.put("goal_id", goal_id); LoginActivity.params.put("item_id", item_id); LoginActivity.params.put("example", example); LoginActivity.params.put("translation", translation); LoginActivity.params.put("example_language", example_language); LoginActivity.params.put("translation_language", translation_language); LoginActivity.params.put("example_transliteration", example_transliteration); LoginActivity.params.put("translation_transliteration", translation_transliteration); startActivity(intent); } else { final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Creating Example ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread create_example = new Thread() { public void run() { // TODO make this interruptable .../*if // (!this.isInterrupted())*/ try { // TODO failures here could derail all ... CreateExampleActivity.add_item_goal_result = new AddItemResult( Main.lookup.addItemToGoal(Main.transport, goal_id, item_id, null)); Result result = null; try { result = Main.lookup.createExample(Main.transport, translation, translation_language_code, translation, null, null, null); JSONObject json = new JSONObject(result.http_response); String text = json.getString("text"); String translation_id = json.getString("id"); result = Main.lookup.createExample(Main.transport, example, example_language_code, example_transliteration, translation_id, item_id, goal_id); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } CreateExampleActivity.create_example_result = new CreateExampleResult(result); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } myOtherProgressDialog.dismiss(); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { create_example.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { create_example.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); myOtherProgressDialog.show(); create_example.start(); } } }
From source file:com.rastating.droidbeard.MainActivity.java
private void restartSickbeard(boolean prompt) { if (prompt) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Confirmation").setMessage("Are you sure you want to restart SickBeard?") .setCancelable(true).setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override/*from w ww. j a v a 2 s. com*/ public void onClick(DialogInterface dialogInterface, int i) { restartSickbeard(false); } }).setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).create().show(); } else { final ProgressDialog dialog = new ProgressDialog(this); dialog.setTitle("Restarting"); dialog.setMessage("Please wait..."); dialog.setCancelable(false); dialog.setIndeterminate(true); dialog.show(); RestartTask task = new RestartTask(this); task.addResponseListener(new ApiResponseListener<Boolean>() { @Override public void onApiRequestFinished(SickbeardAsyncTask sender, Boolean result) { dialog.dismiss(); } }); task.start(); } }
From source file:org.protocoder.appApi.ProtoScripts.java
public void shareProtoFileDialog(String folder, String name) { final ProgressDialog progress = new ProgressDialog(mProtocoder.a); progress.setTitle("Exporting .proto"); progress.setMessage("Your project will be ready soon!"); progress.setCancelable(true);//w w w. j a v a 2 s . c o m progress.setCanceledOnTouchOutside(false); progress.show(); String zipFilePath = exportProto(folder, name); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(zipFilePath))); shareIntent.setType("application/zip"); progress.dismiss(); mProtocoder.a.startActivity( Intent.createChooser(shareIntent, mProtocoder.a.getResources().getText(R.string.share_proto_file))); }
From source file:com.koushikdutta.superuser.MainActivity.java
void doRecoveryInstall() { final ProgressDialog dlg = new ProgressDialog(this); dlg.setTitle(R.string.installing); dlg.setMessage(getString(R.string.installing_superuser)); dlg.setIndeterminate(true);/*ww w .j a v a 2 s . c o m*/ dlg.show(); new Thread() { void doEntry(ZipOutputStream zout, String entryName, String dest) throws IOException { ZipFile zf = new ZipFile(getPackageCodePath()); ZipEntry ze = zf.getEntry(entryName); zout.putNextEntry(new ZipEntry(dest)); InputStream in; StreamUtility.copyStream(in = zf.getInputStream(ze), zout); zout.closeEntry(); in.close(); zf.close(); } public void run() { try { File zip = getFileStreamPath("superuser.zip"); ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zip)); doEntry(zout, "assets/update-binary", "META-INF/com/google/android/update-binary"); doEntry(zout, "assets/install-recovery.sh", "install-recovery.sh"); zout.close(); ZipFile zf = new ZipFile(getPackageCodePath()); ZipEntry ze = zf.getEntry("assets/" + getArch() + "/reboot"); InputStream in; FileOutputStream reboot; StreamUtility.copyStream(in = zf.getInputStream(ze), reboot = openFileOutput("reboot", MODE_PRIVATE)); reboot.close(); in.close(); final File su = extractSu(); String command = String.format("cat %s > /cache/superuser.zip\n", zip.getAbsolutePath()) + String.format("cat %s > /cache/su\n", su.getAbsolutePath()) + String.format("cat %s > /cache/Superuser.apk\n", getPackageCodePath()) + "mkdir /cache/recovery\n" + "echo '--update_package=CACHE:superuser.zip' > /cache/recovery/command\n" + "chmod 644 /cache/superuser.zip\n" + "chmod 644 /cache/recovery/command\n" + "sync\n" + String.format("chmod 755 %s\n", getFileStreamPath("reboot").getAbsolutePath()) + "reboot recovery\n"; Process p = Runtime.getRuntime().exec("su"); p.getOutputStream().write(command.getBytes()); p.getOutputStream().close(); File rebootScript = getFileStreamPath("reboot.sh"); StreamUtility.writeFile(rebootScript, "reboot recovery ; " + getFileStreamPath("reboot").getAbsolutePath() + " recovery ;"); p.waitFor(); Runtime.getRuntime().exec(new String[] { "su", "-c", ". " + rebootScript.getAbsolutePath() }); if (p.waitFor() != 0) throw new Exception("non zero result"); } catch (Exception ex) { ex.printStackTrace(); dlg.dismiss(); runOnUiThread(new Runnable() { @Override public void run() { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setPositiveButton(android.R.string.ok, null); builder.setTitle(R.string.install); builder.setMessage(R.string.install_error); builder.create().show(); } }); } } }.start(); }
From source file:com.esri.arcgisruntime.sample.editandsyncfeatures.MainActivity.java
/** * Create a progress dialog to show sync state */// w ww . j a v a 2 s. c o m private void createProgressDialog(Job job) { ProgressDialog syncProgressDialog = new ProgressDialog(this); syncProgressDialog.setTitle("Sync Geodatabase Job"); syncProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); syncProgressDialog.setCanceledOnTouchOutside(false); syncProgressDialog.show(); job.addProgressChangedListener(() -> syncProgressDialog.setProgress(job.getProgress())); job.addJobDoneListener(syncProgressDialog::dismiss); }
From source file:de.schaeuffelhut.android.openvpn.tun.ShareTunActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_UPLOAD_DEVICE_DETAILS: { ProgressDialog dialog = new ProgressDialog(this); dialog.setTitle("Uploading Device Details"); return dialog; }/*from w ww. j ava2 s.co m*/ case DIALOG_UPLOAD_SUCCESS: { return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_info) .setTitle("Thank you for sharing!").setMessage("The upload was succesfull.") .setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_UPLOAD_SUCCESS); finish(); } }).create(); } case DIALOG_UPLOAD_FAILED: { return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert) .setTitle("Upload failed!").setMessage("Please be so kind and try again later.") .setPositiveButton("Hmm...", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_UPLOAD_SUCCESS); } }).create(); } default: return super.onCreateDialog(id); } }