Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

In this page you can find the example usage for android.app ProgressDialog ProgressDialog.

Prototype

public ProgressDialog(Context context) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:com.project.merauke.CustomItemizedOverlay.java

public CustomItemizedOverlay(Drawable defaultMarker, MapView mapView) {
    super(boundCenter(defaultMarker), mapView);
    maps = mapView;/* w  w w .ja va2 s .  c  o  m*/
    c = mapView.getContext();

    whellProgress = new ProgressDialog(c);
    whellProgress.setIndeterminate(true);
    whellProgress.setMessage("Please wait...");

    new FetchDataTask() {
        protected void onPreExecute() {
            whellProgress.show();
        }

        protected void onPostExecute(ArrayList<CustomOverlayItem> result) {
            if (result != null) {
                storeAll(result);
                whellProgress.dismiss();

                maps.invalidate();
            }
        }
    }.execute();
    // TODO
}

From source file:com.groupme.sdk.activity.PinEntryActivity.java

@Override
protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {
    case DIALOG_LOADING:
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setMessage(getString(R.string.validation_waiting_message));
        return dialog;
    default:/*w w  w  .  j a  v  a 2  s .c o m*/
        throw new IllegalArgumentException("Unknown dialog id: " + id);
    }
}

From source file:com.dmsl.anyplace.tasks.FetchPoiByPuidTask.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(mCtx);
    dialog.setIndeterminate(true);/*  w ww.  j a v  a  2s. c  o  m*/
    dialog.setTitle("Fetching POI Info");
    dialog.setMessage("Please be patient...");
    dialog.setCancelable(true);
    dialog.setCanceledOnTouchOutside(false);
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            FetchPoiByPuidTask.this.cancel(true);
        }
    });
    dialog.show();
}

From source file:com.raywenderlich.reposearch.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//w w w  .  j a v  a2s  .  c  o  m
    if (findViewById(R.id.fragment_container) != null) {
        if (savedInstanceState != null) {
            return;
        }
        if (isNetworkConnected()) {
            mProgressDialog = new ProgressDialog(this);
            mProgressDialog.setMessage("Please wait...");
            mProgressDialog.setCancelable(false);
            mProgressDialog.show();

            startDownload();
        } else {
            new AlertDialog.Builder(this).setTitle("No Internet Connection")
                    .setMessage("It looks like your internet connection is off. Please turn it "
                            + "on and try again")
                    .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    }).setIcon(android.R.drawable.ic_dialog_alert).show();
        }

    }
}

From source file:cl.mmoscoso.geocomm.sync.GeoCommGetRoutesOwnerAsyncTask.java

/**
 * /*w  ww. j  a  va2  s .  c o m*/
 * @param cont
 * @param url
 * @param username
 * @param password
 */
public GeoCommGetRoutesOwnerAsyncTask(Context cont, String host, List<GeoCommRoute> routes, ListView listview,
        int id_user) {
    this.context = cont;
    this.list_routes = routes;
    this.listview = listview;
    this.hostname = host;
    this.id_user = id_user;
    this.mProgressDialog = new ProgressDialog(context);
    this.mProgressDialog.setMessage(context.getResources().getString(R.string.mssg_loading_routes));
    this.mProgressDialog.setIndeterminate(false);
    this.mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    this.mProgressDialog.setCancelable(true);

}

From source file:cl.mmoscoso.geocomm.sync.GeoCommCreatePointAsyncTask.java

public GeoCommCreatePointAsyncTask(Context context, String hn, String name, String desc, String latitude,
        String longitude, int id_route) {
    this.context = context;
    this.hostname = hn;
    this.desc = desc;
    this.name = name;
    this.id_route = id_route;
    this.latitude = latitude;
    this.longitude = longitude;
    this.mProgressDialog = new ProgressDialog(context);
    this.mProgressDialog.setMessage(this.context.getResources().getString(R.string.Loading));
    this.mProgressDialog.setIndeterminate(false);
    this.mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    this.mProgressDialog.setCancelable(true);
}

From source file:com.nextgis.metroaccess.MetaDownloader.java

@Override
protected void onPreExecute() {
    super.onPreExecute();

    if (mbShowProgress) {
        moDownloadDialog = new ProgressDialog(moContext);
        moDownloadDialog.setMessage(msDownloadDialogMsg);
        moDownloadDialog.show();//from ww  w  .j av a 2s.  c  o m
    }
}

From source file:net.networksaremadeofstring.cyllell.ViewEnvironments_Fragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    list = (ListView) this.getActivity().findViewById(R.id.environmentsListView);
    settings = this.getActivity().getSharedPreferences("Cyllell", 0);
    try {/*  www.j  a  v  a2s  . c  o  m*/
        Cut = new Cuts(getActivity());
    } catch (Exception e) {
        e.printStackTrace();
    }

    dialog = new ProgressDialog(getActivity());
    dialog.setTitle("Contacting Chef");
    dialog.setMessage("Please wait: Prepping Authentication protocols");
    dialog.setIndeterminate(true);
    if (listOfEnvironments.size() < 1) {
        dialog.show();
    }

    updateListNotify = new Handler() {
        public void handleMessage(Message msg) {
            int tag = msg.getData().getInt("tag", 999999);

            if (msg.what == 0) {
                if (tag != 999999) {
                    listOfEnvironments.get(tag).SetSpinnerVisible();
                }
            } else if (msg.what == 1) {
                //Get rid of the lock
                CutInProgress = false;

                //the notifyDataSetChanged() will handle the rest
            } else if (msg.what == 99) {
                if (tag != 999999) {
                    Toast.makeText(ViewEnvironments_Fragment.this.getActivity(),
                            "An error occured during that operation.", Toast.LENGTH_LONG).show();
                    listOfEnvironments.get(tag).SetErrorState();
                }
            }
            EnvironmentAdapter.notifyDataSetChanged();
        }
    };

    final Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                OnClickListener listener = new OnClickListener() {
                    public void onClick(View v) {
                        //Log.i("OnClick","Clicked");
                        GetMoreDetails((Integer) v.getTag());
                    }
                };

                OnLongClickListener listenerLong = new OnLongClickListener() {
                    public boolean onLongClick(View v) {
                        selectForCAB((Integer) v.getTag());
                        return true;
                    }
                };

                EnvironmentAdapter = new EnvironmentListAdaptor(getActivity().getBaseContext(),
                        listOfEnvironments, listener, listenerLong);
                list = (ListView) getView().findViewById(R.id.environmentsListView);
                if (list != null) {
                    if (EnvironmentAdapter != null) {
                        list.setAdapter(EnvironmentAdapter);
                    } else {
                        //Log.e("EnvironmentAdapter","EnvironmentAdapter is null");
                    }
                } else {
                    //Log.e("List","List is null");
                }

                dialog.dismiss();
            } else if (msg.what == 200) {
                dialog.setMessage("Sending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("Back", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        getActivity().finish();
                    }
                });
                alertDialog.setIcon(R.drawable.icon);
                alertDialog.show();
            }
        }
    };

    Thread dataPreload = new Thread() {
        public void run() {
            if (listOfEnvironments.size() > 0) {
                handler.sendEmptyMessage(0);
            } else {
                try {
                    handler.sendEmptyMessage(200);
                    Environments = Cut.GetEnvironments();
                    handler.sendEmptyMessage(201);

                    JSONArray Keys = Environments.names();

                    for (int i = 0; i < Keys.length(); i++) {
                        listOfEnvironments.add(
                                new Environment(Keys.getString(i), Environments.getString(Keys.getString(i))
                                        .replaceFirst("^(https://|http://).*/environments/", "")));
                    }

                    handler.sendEmptyMessage(202);
                    handler.sendEmptyMessage(0);
                } catch (Exception e) {
                    Message msg = new Message();
                    Bundle data = new Bundle();
                    data.putString("exception", e.getMessage());
                    msg.setData(data);
                    msg.what = 1;
                    handler.sendMessage(msg);
                }
            }
            return;
        }
    };

    dataPreload.start();
    return inflater.inflate(R.layout.environments_landing, container, false);
}

From source file:weavebytes.com.futureerp.activities.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    login = (Button) findViewById(R.id.btnlogin);
    register = (Button) findViewById(R.id.btnregister);
    name = (EditText) findViewById(R.id.edtusername);
    pass = (EditText) findViewById(R.id.edtpassword);
    progress = new ProgressDialog(LoginActivity.this);

    login.setOnClickListener(this);
    register.setOnClickListener(this);

}

From source file:com.example.okano.simpleroutesearch.MapsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //        setContentView(R.layout.activity_maps);
    setContentView(R.layout.activity_main);
    t = new TkyJavaLibs();
    setUpMapIfNeeded();/* w  w w  .  ja  v  a  2  s .c om*/

    //
    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("");
    progressDialog.hide();

    Button showRouteInfoBtn = (Button) findViewById(R.id.routeInfo);
    showRouteInfoBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showMapInfo();
        }
    });

    Button dismissRouteInfoBtn = (Button) findViewById(R.id.dismissRouteInfo);
    dismissRouteInfoBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mPopupWindow.dismiss();
        }
    });
}