Example usage for android.app ProgressDialog setProgressStyle

List of usage examples for android.app ProgressDialog setProgressStyle

Introduction

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

Prototype

public void setProgressStyle(int style) 

Source Link

Document

Sets the style of this ProgressDialog, either #STYLE_SPINNER or #STYLE_HORIZONTAL .

Usage

From source file:com.lauszus.dronedraw.DroneDrawActivity.java

private void uploadFileToDropbox(File file) {
    DbxClientV2 client;/*ww  w . j  a  v  a2  s .  com*/
    try {
        client = DropboxClientFactory.getClient();
    } catch (IllegalStateException e) {
        Toast.makeText(DroneDrawActivity.this, "Please setup your Dropbox account", Toast.LENGTH_SHORT).show();
        return;
    }

    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(false);
    dialog.setMessage("Uploading to Dropbox");
    dialog.show();

    new UploadFileTask(client, new UploadFileTask.Callback() {
        @Override
        public void onUploadComplete(FileMetadata result) {
            dialog.dismiss();
            Toast.makeText(DroneDrawActivity.this, "Path uploaded to Dropbox", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onError(Exception e) {
            dialog.dismiss();
            if (D)
                Log.e(TAG, "Failed to upload file: ", e);
            Toast.makeText(DroneDrawActivity.this, "Failed to upload path to Dropbox", Toast.LENGTH_SHORT)
                    .show();
        }
    }).execute(Uri.fromFile(file).toString(), "");
}

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

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == 500) {
        ProgressDialog progressDialog = new ProgressDialog(getContext());
        progressDialog.setMessage(getString(R.string.Calculating));
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setIndeterminate(false);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.show();//w ww.  j a va2 s  .c  om
        RunAndGetResult(Clicked_pos, data.getIntExtra("QWERTYUIOP", 0), progressDialog);
    }
}

From source file:tv.loilo.promise.samples.progress.SampleProgressBarDialogFragment.java

@NonNull
@Override//from   ww w  . jav  a2 s  . c o m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ProgressDialog progressDialog = new ProgressDialog(getContext(), getTheme());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMax(100);
    progressDialog.setMessage("Loading...");
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    return progressDialog;
}

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

/**
 * Delete beer on server//from www  .  j av  a2s .  co  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:com.fortysevendeg.labs.bbc.rest.android.activities.BeerActivity.java

/**
 * Add beer on server// w w  w.j  a v a2s.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();
        }
    });
}

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

/**
 * Update beer on server/*from   w w  w  .  j a  v a  2s  .  c  om*/
 */
private void updateBeer() {
    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().updateBeer(beerResponseEdit.getId(), 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();
                }
            });
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SystemHelper.initSystem(this);
    mWebView = new WebView(this);

    CharSequence title = getText(R.string.license_activity_title);
    CharSequence msg = getText(R.string.license_activity_loading);

    ProgressDialog pd = ProgressDialog.show(this, title, msg, true, false);
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mSpinnerDlg = pd;//from  w w w  .  jav  a 2  s.co m

    getSupportLoaderManager().initLoader(LOADID_LICENSES, null, this);
}

From source file:org.puder.trs80.InitialSetupDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setCancelable(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    return progressDialog;
}

From source file:com.github.yuukis.businessmap.app.ProgressDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    boolean cancelable = getArguments().getBoolean(CANCELABLE, false);
    setCancelable(cancelable);//from w w  w.  j a  v  a 2  s.  co  m

    String title = getArguments().getString(TITLE);
    String message = getArguments().getString(MESSAGE);
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setTitle(title);
    dialog.setMessage(message);
    dialog.setIndeterminate(false);
    dialog.setCanceledOnTouchOutside(false);

    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setMax(getArguments().getInt(MAX));

    return dialog;
}

From source file:com.esri.arcgisruntime.sample.generateofflinemapwithlocalbasemap.ProgressDialogFragment.java

@NonNull
@Override/*  w  w  w  . j a v a2 s .co  m*/
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    // create a dialog to show progress
    final ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setTitle(mTitle);
    progressDialog.setMessage(mMessage);
    progressDialog.setIndeterminate(false);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setMax(100);
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, mCancel, (dialog, which) -> onDismiss(dialog));
    return progressDialog;
}