List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:fr.gcastel.freeboxV6GeekIncDownloader.services.FreeboxDownloaderService.java
public void attach(Context inContext) { zeContext = inContext;/*from ww w . j a va 2 s . c om*/ switch (dialogueEnCours) { case PROGRESS: dialog = new ProgressDialog(zeContext); dialog.setCancelable(true); ((ProgressDialog) dialog).setMessage("Connexion la freebox"); ((ProgressDialog) dialog).setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.show(); break; case ALERT: prepareAlertDialog(alertDialogMessage); showAlertDialog(); break; case NONE: default: break; } }
From source file:be.ac.ucl.lfsab1509.llncampus.UCLouvain.java
/** * Launch the download of the courses list and store them in the database. * //from w w w . j a v a2 s .c o m * @param context * Application context. * @param username * UCL global user identifier. * @param password * UCL password. * @param end * Runnable to be executed at the end of the download. * @param mHandler * Handler to manage messages and threads. * */ public static void downloadCoursesFromUCLouvain(final LLNCampusActivity context, final String username, final String password, final Runnable end, final Handler mHandler) { Time t = new Time(); t.setToNow(); int year = t.year; // A new academic year begin in September (8th month on 0-based count). if (t.month < 8) { year--; } final int academicYear = year; mHandler.post(new Runnable() { public void run() { final ProgressDialog mProgress = new ProgressDialog(context); mProgress.setCancelable(false); mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgress.setMax(100); mProgress.setMessage(context.getString(R.string.connection)); mProgress.show(); new Thread(new Runnable() { /** * Set the progress to the value n and show the message nextStep * @param n * The progress value. * @param nextStep * The message to show (indicate the next step to be processed). */ public void progress(final int n, final String nextStep) { mHandler.post(new Runnable() { public void run() { mProgress.setProgress(n); mProgress.setMessage(nextStep); } }); Log.d("UCLouvain", nextStep); } /** * Notify to the user an error. * * @param msg * The message to show to the user. */ public void sendError(String msg) { notify(context.getString(R.string.error) + " :" + msg); mProgress.cancel(); } /** * Notify to the user a message. * * @param msg * The message to show to the user. */ public void notify(final String msg) { mHandler.post(new Runnable() { public void run() { context.notify(msg); } }); } public void run() { progress(0, context.getString(R.string.connection_ucl)); UCLouvain uclouvain = new UCLouvain(username, password); progress(20, context.getString(R.string.fetch_info)); ArrayList<Offer> offers = uclouvain.getOffers(academicYear); if (offers == null || offers.isEmpty()) { sendError(context.getString(R.string.error_academic_year) + academicYear); return; } int i = 40; ArrayList<Course> courses = new ArrayList<Course>(); for (Offer o : offers) { progress(i, context.getString(R.string.get_courses) + o.getOfferName()); ArrayList<Course> offerCourses = uclouvain.getCourses(o); if (offerCourses != null && !offerCourses.isEmpty()) { courses.addAll(offerCourses); } else { Log.e("CoursListEditActivity", "Error : No course for offer [" + o.getOfferCode() + "] " + o.getOfferName()); } i += (int) (30. / offers.size()); } if (courses.isEmpty()) { sendError(context.getString(R.string.courses_empty)); return; } // Remove old courses. progress(70, context.getString(R.string.cleaning_db)); LLNCampus.getDatabase().delete("Courses", "", null); LLNCampus.getDatabase().delete("Horaire", "", null); // Add new data. i = 80; for (Course c : courses) { progress(i, context.getString(R.string.add_courses_db)); ContentValues cv = new ContentValues(); cv.put("CODE", c.getCourseCode()); cv.put("NAME", c.getCoursName()); LLNCampus.getDatabase().insert("Courses", cv); i += (int) (20. / courses.size()); } progress(100, context.getString(R.string.end)); mProgress.cancel(); mHandler.post(end); } }).start(); } }); }
From source file:com.attentec.Login.java
@Override protected final Dialog onCreateDialog(final int id) { if (id == LOGIN_DIALOG) { pd = new ProgressDialog(this); pd.setMessage(res.getString(R.string.logging_in)); pd.setTitle(res.getString(R.string.contacting_server)); }//from ww w . j a v a2 s . co m return pd; }
From source file:com.liquid.wallpapers.free.ScroidWallpaperGallery.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setTheme(android.R.style.Theme_NoTitleBar); this.setContentView(R.layout.main); // initializing gallery this.initGallery(); // filling gallery ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage(this.getString(R.string.loadingText)); if (this.wallpaperGalleryAdapter != null) { this.updateGalleryAdapter(); return;/* ww w . java 2 s . co m*/ } new FillGalleryTask(progressDialog, this).start(); }
From source file:fm.smart.r1.activity.ItemActivity.java
public void addToList(final String item_id) { final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Adding item to study list ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread add = new Thread() { public void run() { ItemActivity.add_item_result = addItemToList(Main.default_study_list_id, item_id, ItemActivity.this); myOtherProgressDialog.dismiss(); ItemActivity.this.runOnUiThread(new Thread() { public void run() { final AlertDialog dialog = new AlertDialog.Builder(ItemActivity.this).create(); dialog.setTitle(ItemActivity.add_item_result.getTitle()); dialog.setMessage(ItemActivity.add_item_result.getMessage()); ItemActivity.add_item_result = null; dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { }//from w ww . j a va 2 s. c o m }); dialog.show(); } }); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { add.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { add.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); closeMenu(); myOtherProgressDialog.show(); add.start(); }
From source file:com.probam.updater.activity.GooActivity.java
private void search(String path) { DIALOG = new ProgressDialog(this); DIALOG.setIndeterminate(true);/*w w w. j a v a 2s . c om*/ DIALOG.setMessage(getResources().getString(R.string.goo_browse_searching)); DIALOG.setCancelable(true); DIALOG.setCanceledOnTouchOutside(true); DIALOG.show(); new URLStringReader(this).execute(path); }
From source file:com.phonegap.Notification.java
/** * Show the progress dialog.//from www . j a v a2 s. c o m * * @param title Title of the dialog * @param message The message of the dialog */ public synchronized void progressStart(final String title, final String message) { if (this.progressDialog != null) { this.progressDialog.dismiss(); this.progressDialog = null; } final Notification notification = this; final PhonegapActivity ctx = this.ctx; Runnable runnable = new Runnable() { public void run() { notification.progressDialog = new ProgressDialog(ctx); notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); notification.progressDialog.setTitle(title); notification.progressDialog.setMessage(message); notification.progressDialog.setCancelable(true); notification.progressDialog.setMax(100); notification.progressDialog.setProgress(0); notification.progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.progressDialog = null; } }); notification.progressDialog.show(); } }; this.ctx.runOnUiThread(runnable); }
From source file:fm.smart.r1.ItemActivity.java
public void addToList(final String item_id) { final ProgressDialog myOtherProgressDialog = new ProgressDialog(this); myOtherProgressDialog.setTitle("Please Wait ..."); myOtherProgressDialog.setMessage("Adding item to study goal ..."); myOtherProgressDialog.setIndeterminate(true); myOtherProgressDialog.setCancelable(true); final Thread add = new Thread() { public void run() { ItemActivity.add_item_result = new AddItemResult( Main.lookup.addItemToGoal(Main.transport, Main.default_study_goal_id, item_id, null)); myOtherProgressDialog.dismiss(); ItemActivity.this.runOnUiThread(new Thread() { public void run() { final AlertDialog dialog = new AlertDialog.Builder(ItemActivity.this).create(); dialog.setTitle(ItemActivity.add_item_result.getTitle()); dialog.setMessage(ItemActivity.add_item_result.getMessage()); ItemActivity.add_item_result = null; dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { }/*from www.j a va2s .co m*/ }); dialog.show(); } }); } }; myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { add.interrupt(); } }); OnCancelListener ocl = new OnCancelListener() { public void onCancel(DialogInterface arg0) { add.interrupt(); } }; myOtherProgressDialog.setOnCancelListener(ocl); closeMenu(); myOtherProgressDialog.show(); add.start(); }
From source file:se.anyro.tagtider.TransferActivity.java
private void setupDialogs() { final AlertDialog smsDialog = createSmsDialog(); Button sendSmsButton = (Button) findViewById(R.id.sms); sendSmsButton.setOnClickListener(new OnClickListener() { @Override//from www . j a va 2s.c o m public void onClick(View v) { smsDialog.show(); } }); final AlertDialog c2dmDialog = createC2dmDialog(); Button sendC2dmButton = (Button) findViewById(R.id.c2dm); sendC2dmButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { c2dmDialog.show(); } }); mProgressDialog = new ProgressDialog(this); mDialog = new AlertDialog.Builder(this).setNeutralButton("Ok", null).create(); }