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:jp.co.rakuten.rakutenvideoplayer.base.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    createDataBase();/*from  www .j a  va 2  s  . c  o  m*/
    progressDialog = new ProgressDialog(this);
}

From source file:ing.rbi.poc.ResolveConnection.java

@Override
protected void onPreExecute() {
    dialog = new ProgressDialog(context);
    dialog.setMessage("Please wait...");
    dialog.setIndeterminate(true);/*  ww w. ja  v a  2 s .  co m*/
    dialog.show();
    super.onPreExecute();
}

From source file:br.ufg.inf.es.fs.contpatri.mobile.webservice.Autenticar.java

/**
 * Construtor que ir instanciar a classe e inicializar as variveis
 * necessrias para poder realizar o processo de autenticao no
 * <b>WebService</b>.//from   www. ja va  2 s  .  c  o  m
 * 
 * @param actv
 *            <code>Activity</code> necessria para instanciar a
 *            <code>ProgressDialog</code> e iniciar a tela de lista de
 *            coletas de tombamentos caso a autenticao seja bem sucedida
 * @param user
 *            usurio da aplicao que tentar logar pelo <b>WebService</b>
 */
public Autenticar(final Activity actv, final Usuario user) {
    dialog = new ProgressDialog(actv);
    usuario = user;
    activity = actv;
}

From source file:org.quizpoll.net.HttpHelper.java

/**
 * Starts the HTTP request-response//  w  w w.  ja v  a  2  s . co m
 */
public void start() {
    if (showDialog) {
        progressDialog = new ProgressDialog(activity);
        progressDialog.setOwnerActivity(activity);
        int message = getDialogMessage();
        progressDialog.setMessage(activity.getString(message));
        progressDialog.show();
    }
    new NetworkTask().execute();
}

From source file:com.ankit.touchreview.ActionsActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.actions);/*from  w  ww.j a v a2s .  c o m*/

    logo = (ImageView) findViewById(R.id.logo);

    LinearLayout1 = (LinearLayout) findViewById(R.id.LinearLayout1);
    mContext = this;

    message = (TextView) findViewById(R.id.message);

    DisplayMetrics metrics = this.getResources().getDisplayMetrics();
    int width = metrics.widthPixels;
    //int height = metrics.heightPixels;
    logo.getLayoutParams().width = width / 2;
    Button goodReview = (Button) findViewById(R.id.goodreview);
    goodReview.getLayoutParams().width = width / 3;
    Button badReview = (Button) findViewById(R.id.badreview);
    badReview.getLayoutParams().width = width / 3;

    mProcessing = new ProgressDialog(mContext);
    mProcessing.setCancelable(true);
    mProcessing.setMessage("Please Wait");
    mProcessing.setTitle("Fetching Details");
    setLogoImage();
    setThemeImage();
    setMessage();

    if (Utility.appmode != null && Utility.appmode > 1) {
        goodReview.setText("Give FeedBack");
        badReview.setText("Give Feedback");
        if (Utility.appmode == 2)
            badReview.setVisibility(View.GONE);
        if (Utility.appmode == 3)
            goodReview.setVisibility(View.GONE);
    }
}

From source file:in.codehex.arrow.LoginActivity.java

/**
 * Initialize the objects/*w  w  w .  j a  v a  2s .c  o  m*/
 */
private void initObjects() {
    editName = (EditText) findViewById(R.id.name);
    editPhone = (EditText) findViewById(R.id.phone);
    fab = (FloatingActionButton) findViewById(R.id.fab);

    userPreferences = getSharedPreferences(Config.PREF_USER, MODE_PRIVATE);
    telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    progressDialog = new ProgressDialog(this);
}

From source file:com.arquitetaweb.restaurantes.fragment.CardapioFragment.java

private void carregarDadosJson(final View view) {

    handler = new Handler();

    progressDialog = new ProgressDialog(contexto);
    progressDialog.setCancelable(false);
    progressDialog.setMessage("atualizando mapa das mesas...");
    progressDialog.show();/*from www.ja v a  2  s . co m*/

    Thread thread = new Thread() {
        public void run() {
            if (Utils.isConnected(contexto)) {
                String url = Utils.getUrlServico(contexto) + "/Api/SituacaoMesas";
                JSONParser jParser = new JSONParser();
                json = jParser.getJSONFromUrl(url);

                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        ArrayList<HashMap<String, String>> mesasLista = new ArrayList<HashMap<String, String>>();
                        for (int i = 0; i < json.length(); i++) {
                            try {
                                JSONObject c = json.getJSONObject(i);

                                HashMap<String, String> map = new HashMap<String, String>();

                                map.put(KEY_ID, c.getString(KEY_ID));
                                map.put(KEY_NUMEROMESA, c.getString(KEY_NUMEROMESA));
                                map.put(KEY_CODIGOEXTERNO, c.getString(KEY_CODIGOEXTERNO));
                                map.put(KEY_SITUACAO, c.getString(KEY_SITUACAO));

                                mesasLista.add(map);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        mesas = (GridView) view.findViewById(R.id.list);
                        adapter = new MesaAdapter(contexto, mesasLista);
                        mesas.setAdapter(adapter);

                        // Click event for single list row
                        mesas.setOnItemClickListener(new OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                TextView idItem = (TextView) view.findViewById(R.id.idItem);

                                Bundle bun = new Bundle();
                                bun.putString("id", (String) idItem.getText());

                                abrirDetalhes(view, bun);
                            }

                            private void abrirDetalhes(View view, Bundle bun) {
                                Intent intent = new Intent(view.getContext(), DetailsActivity.class);
                                intent.putExtras(bun);
                                startActivityForResult(intent, 100);
                            }
                        });
                        progressDialog.dismiss();
                    }
                });

            } else {
                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        progressDialog.dismiss();
                        new Alerta(contexto, "", "No Foi Localizado o Servidor!" + "\nCausas:"
                                + "\nConexo OK?" + "\nServidor correto?");
                        //                          Toast.makeText(contexto, "No Foi Localizado o Servidor!",
                        //                            Toast.LENGTH_LONG).show();                          
                        //Intent intent = new Intent("settings://sandbox");
                        //startActivity(intent);
                    }
                });
            }
        }
    };
    thread.start();
}

From source file:com.nextgis.uikobserver.HttpSendData.java

public HttpSendData(Context c, int nType, String sMsg, Handler eventReceiver, boolean bShowProgress) {
    super();//  w  w w .  j  a va  2s . co  m
    mbShowProgress = bShowProgress;
    mContext = c;
    if (mbShowProgress) {
        mDownloadDialog = new ProgressDialog(mContext);
    }
    mnType = nType;
    mEventReceiver = eventReceiver;
    mDownloadDialogMsg = sMsg;
}

From source file:com.ntsync.android.sync.activities.LoginProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.ui_activity_authenticating));
    dialog.setIndeterminate(true);/*ww  w. j av  a  2  s.  c om*/
    return dialog;
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    list = (ListView) this.getActivity().findViewById(R.id.rolesListView);
    settings = this.getActivity().getSharedPreferences("Cyllell", 0);
    try {/*from w  w  w . j av  a  2  s.  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 (listOfRoles.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) {
                    listOfRoles.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(ViewRoles_Fragment.this.getActivity(),
                            "An error occured during that operation.", Toast.LENGTH_LONG).show();
                    listOfRoles.get(tag).SetErrorState();
                }
            }
            RoleAdapter.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) {
                        GetMoreDetails((Integer) v.getTag());
                    }
                };

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

                RoleAdapter = new RoleListAdaptor(getActivity(), listOfRoles, listener, listenerLong);
                list = (ListView) getView().findViewById(R.id.rolesListView);
                if (list != null) {
                    if (RoleAdapter != null) {
                        list.setAdapter(RoleAdapter);
                    } else {
                        //Log.e("CookbookAdapter","CookbookAdapter 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 (listOfRoles.size() > 0) {
                handler.sendEmptyMessage(0);
            } else {
                try {
                    handler.sendEmptyMessage(200);
                    Roles = Cut.GetRoles();
                    handler.sendEmptyMessage(201);

                    JSONArray Keys = Roles.names();

                    for (int i = 0; i < Keys.length(); i++) {
                        listOfRoles.add(new Role(Keys.getString(i), Roles.getString(Keys.getString(i))
                                .replaceFirst("^(https://|http://).*/roles/", "")));
                    }

                    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.roles_landing, container, false);
}