Example usage for android.app ProgressDialog setIndeterminate

List of usage examples for android.app ProgressDialog setIndeterminate

Introduction

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

Prototype

public void setIndeterminate(boolean indeterminate) 

Source Link

Document

Change the indeterminate mode for this ProgressDialog.

Usage

From source file:com.jaanussiim.slimtimer.android.activities.LoginActivity.java

@Override
protected Dialog onCreateDialog(final int id) {
    switch (id) {
    case DIALOG_LOGGING_IN: {
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setMessage(getText(R.string.logging_in_message));
        dialog.setIndeterminate(true);
        dialog.setCancelable(true);//www  .  ja  v  a2  s .co m
        dialog.setOnCancelListener(this);
        return dialog;
    }
    case DIALOG_AUTHENTICATION_ERROR:
    case DIALOG_NETWORK_ERROR:
    case DIALOG_UNKNOWN_ERROR:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.login_error_dialog_title);
        if (id == DIALOG_AUTHENTICATION_ERROR) {
            builder.setMessage(R.string.login_error_authentication_error);
        } else if (id == DIALOG_NETWORK_ERROR) {
            builder.setMessage(R.string.login_error_network_error);
        } else {
            builder.setMessage(R.string.login_error_network_error);
        }
        builder.setIcon(android.R.drawable.ic_dialog_alert);
        builder.setPositiveButton(R.string.button_title_ok, null);
        return builder.create();
    default:
        return super.onCreateDialog(id);
    }
}

From source file:com.google.android.gms.samples.wallet.LoginFragment.java

private ProgressDialog initializeProgressDialog() {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setIndeterminate(true);
    dialog.setMessage(getString(R.string.loading));
    return dialog;
}

From source file:com.haseebelahi.usman.UserProfile.java

public void getUserDetails() {

    String url = "http://asfand.danglingpixels.com/taxi/app/get_user.php?user_id=" + logged_in;

    //showing dialog box
    final ProgressDialog progressDialog = new ProgressDialog(this.getActivity(), R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Updating...");
    progressDialog.show();//from  w w w.j  a va 2 s . c om

    // Request a string response
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {

            // Result handling
            System.out.println(response);
            progressDialog.dismiss();

            try {
                JSONArray jsonArray = new JSONArray(response);
                JSONObject jsonObject = jsonArray.getJSONObject(0);
                name.setText("Name: " + jsonObject.getString("name"));
                username.setText("Username: " + jsonObject.getString("username"));
                email.setText("Email: " + jsonObject.getString("email"));
                cnic.setText("CNIC: " + jsonObject.getString("cnic"));

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

            // Error handling
            System.out.println("Something went wrong!");
            error.printStackTrace();
            progressDialog.dismiss();
            Toast.makeText(getContext(), "FAILED TO CONNECT", Toast.LENGTH_LONG).show();
        }
    });
    // Add the request to the queue
    int socketTimeout = 30000;//30 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    stringRequest.setRetryPolicy(policy);
    Volley.newRequestQueue(this.getContext()).add(stringRequest);
}

From source file:com.haseebelahi.usman.UserProfile.java

public void getDriverDetails() {

    String url = "http://asfand.danglingpixels.com/taxi/app/get_driver.php?user_id=" + logged_in;

    //showing dialog box
    final ProgressDialog progressDialog = new ProgressDialog(this.getActivity(), R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Updating...");
    progressDialog.show();//w  w w  .  j a  va  2 s .  c o  m

    // Request a string response
    StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {

            // Result handling
            System.out.println(response);
            progressDialog.dismiss();

            try {
                JSONArray jsonArray = new JSONArray(response);
                JSONObject jsonObject = jsonArray.getJSONObject(0);
                name.setText("Name: " + jsonObject.getString("name"));
                username.setText("License: " + jsonObject.getString("license"));
                email.setText("Mobile: " + jsonObject.getString("mobile"));
                cnic.setText("");

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

            // Error handling
            System.out.println("Something went wrong!");
            error.printStackTrace();
            progressDialog.dismiss();
            Toast.makeText(getContext(), "FAILED TO CONNECT", Toast.LENGTH_LONG).show();
        }
    });
    // Add the request to the queue
    int socketTimeout = 30000;//30 seconds - change to what you want
    RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
    stringRequest.setRetryPolicy(policy);
    Volley.newRequestQueue(this.getContext()).add(stringRequest);
}

From source file:com.softminds.matrixcalculator.OperationFragments.AdjointFragment.java

@Override
public void onListItemClick(ListView L, View V, int position, long id) {
    ProgressDialog progressDialog = new ProgressDialog(getContext());
    progressDialog.setMessage(getString(R.string.Calculating));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();/* w  ww  . j a v a  2s  . c o  m*/
    RunToGetDeterminant(position, progressDialog);
}

From source file:net.evendanan.android.thumbremote.ui.FragmentAlertDialogSupport.java

private Dialog creatDiscoveryProgressDialog() {
    ProgressDialog p = new ProgressDialog(getActivity());
    p.setTitle(R.string.discoverying_dialog_title);
    p.setMessage(getString(R.string.discoverying_dialog_message));
    p.setIndeterminate(true);
    p.setCancelable(false);/*from   w  ww . j  a  v a  2s. c  o  m*/

    return p;
}

From source file:org.totschnig.myexpenses.dialog.ProgressDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ProgressDialog dialog = new ProgressDialog(getActivity());
    int message = getArguments().getInt("message");
    if (message != 0)
        dialog.setMessage(getString(message));
    else// w w  w .  jav a 2  s . co m
        dialog.setMessage("");
    dialog.setIndeterminate(true);
    dialog.setCancelable(false);

    // Disable the back button
    OnKeyListener keyListener = new OnKeyListener() {

        @Override
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
                return true;
            }
            return false;
        }

    };
    dialog.setOnKeyListener(keyListener);
    return dialog;
}

From source file:com.manning.androidhacks.hack023.authenticator.AuthenticatorActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage("Login in");
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);/*from ww w  . j a  va  2 s  .c  o  m*/
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface dialog) {
            if (mAuthThread != null) {
                mAuthThread.interrupt();
                finish();
            }
        }
    });
    return dialog;
}

From source file:com.softminds.matrixcalculator.OperationFragments.TraceFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    ProgressDialog progressDialog = new ProgressDialog(getContext());
    progressDialog.setMessage(getString(R.string.Calculating));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();//  w  w w .j a va 2 s  .  c om
    RunToGetTrace(position, progressDialog);
}

From source file:at.bitfire.davdroid.ui.setup.DetectConfigurationFragment.java

@NonNull
@Override//w ww  .  j a  v a 2s . c  om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progress = new ProgressDialog(getActivity());
    progress.setTitle(R.string.login_configuration_detection);
    progress.setMessage(getString(R.string.login_querying_server));
    progress.setIndeterminate(true);
    progress.setCanceledOnTouchOutside(false);
    setCancelable(false);
    return progress;
}