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.example.hana.rentcostumes.RegisterActivity.java

public void signup() {
    Log.d(TAG, "Signup");

    if (!validate()) {
        onSignupFailed();//from   w w  w. j  a v  a 2 s . co m
        return;
    }

    //btnRegister.setEnabled(false);

    final ProgressDialog progressDialog = new ProgressDialog(RegisterActivity.this,
            R.style.MyTheme_ProgressDialog_);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Creating Account...");
    progressDialog.show();

    String fname = inputFirstName.getText().toString();
    String lname = inputLastName.getText().toString();
    String email = inputEmail.getText().toString();
    String uname = inputUsername.getText().toString();
    String password = inputPassword.getText().toString();

    // TODO: Implement your own signup logic here.
    firebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this,
            new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());
                    if (task.isSuccessful()) {
                        Toast.makeText(RegisterActivity.this, R.string.auth_success, Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getApplicationContext(), MainActivity.class));
                    }
                    progressDialog.dismiss();
                }
            });
}

From source file:com.androidquery.simplefeed.base.BaseActivity.java

public ProgressDialog makeProgressDialog(String message) {

    ProgressDialog dialog = new ProgressDialog(this);
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);//from   w ww  . j ava  2 s .  co m
    dialog.setInverseBackgroundForced(false);
    dialog.setCanceledOnTouchOutside(true);
    dialog.setMessage(message);

    return dialog;

}

From source file:com.ame.armymax.SettingsActivity.java

private ProgressDialog getProgressDialog() {

    ProgressDialog progress = null;//  w  w  w .  j  ava 2s . com

    if (progress == null) {
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setIndeterminate(true);
        dialog.setCancelable(true);
        dialog.setInverseBackgroundForced(false);
        dialog.setCanceledOnTouchOutside(true);
        progress = dialog;
    }
    return progress;
}

From source file:com.softminds.matrixcalculator.OperationFragments.InverseFragment.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 w  w  . j a v  a 2 s  .  co  m*/
    progress = progressDialog;

    if (SquareList.get(position).getJamaMatrix().det() != 0) {
        if (ENABLED_NO_DECIMAL)
            RunAndGetDeterminantWithAdjoint(position, progressDialog);
        else
            RunNewGetInverse(position, progressDialog);
    } else {
        new AlertDialog.Builder(getContext())
                .setMessage("The Determinant of the matrix was Zero and Hence its Inverse does not exist")
                .setTitle("No Inverse Exist")
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                }).show();
        progressDialog.dismiss();
    }

}

From source file:com.fabernovel.alertevoirie.HomeActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:
        ProgressDialog pd = new ProgressDialog(this);
        pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pd.setIndeterminate(true);
        pd.setOnDismissListener(new OnDismissListener() {
            @Override/*from   www. j a  v a 2 s . co m*/
            public void onDismiss(DialogInterface dialog) {
                if (dialog_shown)
                    removeDialog(DIALOG_PROGRESS);
            }
        });
        pd.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                AVService.getInstance(HomeActivity.this).cancelTask();
                finish();
            }
        });
        pd.setMessage(getString(R.string.ui_message_loading));
        return pd;

    default:
        return super.onCreateDialog(id);
    }
}

From source file:net.kazzz.NFCTagReader.java

public void onClick(final View v) {
    try {//from  ww  w .ja v  a2  s  .c o  m
        final int id = v.getId();

        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setIndeterminate(true);

        AsyncTask<Void, Void, String> task = new AsyncTask<Void, Void, String>() {
            @Override
            protected void onPreExecute() {
                switch (id) {
                case R.id.btn_read:
                    dialog.setMessage("?????...");
                    break;
                case R.id.btn_write:
                    dialog.setMessage("???????...");
                    break;
                case R.id.btn_hitory:
                    dialog.setMessage("????...");
                    break;
                }
                dialog.show();
            }

            @Override
            protected String doInBackground(Void... arg0) {
                switch (id) {
                case R.id.btn_read:
                    try {
                        return mLastFragment.dumpTagData();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
                case R.id.btn_write:
                    try {
                        Intent intent = new Intent(NFCTagReader.this, NFCTagWriter.class);
                        intent.putExtra("nfcTag", mLastFragment.getNfcTag());
                        startActivity(intent);
                        return "";
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
                case R.id.btn_hitory:
                    try {
                        if (mLastFragment != null && mLastFragment instanceof NfcFeliCaTagFragment) {
                            NfcFeliCaTagFragment nfcf = (NfcFeliCaTagFragment) mLastFragment;
                            return nfcf.dumpFeliCaHistoryData();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
                default:
                    break;
                }
                return "";
            }

            /* (non-Javadoc)
             * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
             */
            @Override
            protected void onPostExecute(String result) {
                dialog.dismiss();
                TextView tv_tag = (TextView) findViewById(R.id.result_tv);
                if (result != null && result.length() > 0)
                    tv_tag.setText(result);
            }
        };

        task.execute();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.mythdroid.activities.MDActivity.java

@Override
public Dialog onCreateDialog(int id) {

    switch (id) {

    case FRONTEND_CHOOSER:
        final Dialog d = createFrontendDialog();
        d.setOnDismissListener(dismissListener);
        d.setOnCancelListener(cancelListener);
        return d;

    case DIALOG_LOAD:
        final ProgressDialog prog = new ProgressDialog(this);
        prog.setIndeterminate(true);
        prog.setMessage(getResources().getText(R.string.loading));
        prog.setCanceledOnTouchOutside(false);
        prog.setOnCancelListener(new OnCancelListener() {
            @Override// w w  w.j  av  a 2  s .  c o m
            public void onCancel(DialogInterface arg0) {
                finish();
            }
        });
        return prog;

    }

    return null;

}

From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java

/**
 * Delete beer on server//from   w ww  .j  a va2s.c  o  m
 */
private void deleteBeer() {
    final ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMessage(getString(R.string.connecting));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();

    APIService.get().deleteBeer(beerResponseEdit.getId(),
            new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) {
                @Override
                public void onResults(BeerResponse beerResponse) {
                    progressDialog.dismiss();
                    Toast.makeText(BeerActivity.this, R.string.beerDeleted, Toast.LENGTH_SHORT).show();
                    setResult(RESULT_OK);
                    finish();
                }

                @Override
                public void onError(Throwable e) {
                    progressDialog.dismiss();
                    Toast.makeText(BeerActivity.this, R.string.error, Toast.LENGTH_SHORT).show();
                }
            });
}

From source file:at.bitfire.davdroid.ui.CreateCollectionFragment.java

@NonNull
@Override//w  ww .j  av a2s  .  c  o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progress = new ProgressDialog(getContext());
    progress.setTitle(R.string.create_collection_creating);
    progress.setMessage(getString(R.string.please_wait));
    progress.setIndeterminate(true);
    progress.setCanceledOnTouchOutside(false);
    setCancelable(false);
    return progress;
}

From source file:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java

/**
 * Add beer on server//from  w  w w .  j av a  2 s. c o m
 */
private void addBeer() {
    if (TextUtils.isEmpty(etAlcohol.getText().toString()) || TextUtils.isEmpty(etName.getText().toString())) {
        Toast.makeText(BeerActivity.this, R.string.fieldsEmpty, Toast.LENGTH_SHORT).show();
        return;
    }
    final ProgressDialog progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMessage(getString(R.string.connecting));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();

    BeerRequest beerRequest = new BeerRequest();
    beerRequest.setAvb(Double.parseDouble(etAlcohol.getText().toString()));
    beerRequest.setName(etName.getText().toString());
    beerRequest.setDescription(etDescription.getText().toString());
    APIService.get().addBeer(beerRequest, new ContextAwareAPIDelegate<BeerResponse>(this, BeerResponse.class) {
        @Override
        public void onResults(BeerResponse beerResponse) {
            progressDialog.dismiss();
            Toast.makeText(BeerActivity.this, R.string.beerSaved, Toast.LENGTH_SHORT).show();
            setResult(RESULT_OK);
            finish();
        }

        @Override
        public void onError(Throwable e) {
            progressDialog.dismiss();
            Toast.makeText(BeerActivity.this, R.string.error, Toast.LENGTH_SHORT).show();
        }
    });
}