Example usage for android.app ProgressDialog setIcon

List of usage examples for android.app ProgressDialog setIcon

Introduction

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

Prototype

public void setIcon(@DrawableRes int resId) 

Source Link

Document

Set resId to 0 if you don't want an icon.

Usage

From source file:org.alfresco.mobile.android.application.fragments.operations.OperationWaitingDialogFragment.java

public Dialog onCreateDialog(final Bundle savedInstanceState) {
    setRetainInstance(true);/*from w w w.ja  v a 2  s .  c  o  m*/
    if (getArguments() != null) {
        operationType = getArguments().getInt(PARAM_TYPEID);
        intentId = getArguments().getString(PARAM_INTENTID);
        iconId = getArguments().getInt(PARAM_ICONID);
        title = getArguments().getString(PARAM_TITLEID);
        message = getArguments().getString(PARAM_MESSAGEID);
        parent = getArguments().getParcelable(PARAM_NODEID);
        nbItems = getArguments().getInt(PARAM_SIZE);
    }

    ProgressDialog dialog = new ProgressDialog(getActivity());
    if (iconId == 0) {
        iconId = R.drawable.ic_alfresco_logo;
    }
    dialog.setIcon(iconId);
    dialog.setTitle(title);
    if (message == null) {
        message = getString(R.string.waiting_operations);
    }
    dialog.setMessage(message);
    boolean indeterminate = true;
    if (nbItems > 0) {
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setProgress(0);
        dialog.setMax(nbItems);
        indeterminate = false;
    } else {
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    }
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

    getActivity().getLoaderManager().restartLoader(this.hashCode(), null, this);

    return dialog;
}

From source file:org.alfresco.mobile.android.ui.operation.OperationWaitingDialogFragment.java

public Dialog onCreateDialog(final Bundle savedInstanceState) {
    if (getArguments() != null) {
        operationType = getArguments().getInt(ARGUMENT_TYPEID);
        intentId = getArguments().getString(ARGUMENT_INTENTID);
        iconId = getArguments().getInt(ARGUMENT_ICONID);
        title = getArguments().getString(ARGUMENT_TITLEID);
        message = getArguments().getString(ARGUMENT_MESSAGEID);
        parent = getArguments().getParcelable(ARGUMENT_NODEID);
        nbItems = getArguments().getInt(ARGUMENT_SIZE);
        operationId = getArguments().getString(ARGUMENT_OPERATIONID);
    }/*from  w w  w .j  a  v  a 2s .c o m*/

    ProgressDialog dialog = new ProgressDialog(getActivity());
    if (iconId == 0) {
        iconId = R.drawable.ic_application_logo;
    }
    dialog.setIcon(iconId);
    dialog.setTitle(title);
    if (message == null) {
        message = getString(R.string.waiting_operations);
    }
    dialog.setMessage(message);
    boolean indeterminate = true;
    if (nbItems > 0) {
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setProgress(0);
        dialog.setMax(nbItems);
        indeterminate = false;
    } else {
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    }
    dialog.setIndeterminate(indeterminate);
    dialog.setCancelable(false);
    dialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (operationId != null) {
                        Operator.with(getActivity()).cancel(operationId);
                    }
                    dialog.dismiss();
                }
            });

    getActivity().getLoaderManager().restartLoader(this.hashCode(), null, this);

    return dialog;
}

From source file:com.ubuntuone.android.files.activity.StoreActivity.java

/**
 * Builds a simple indeterminate progress dialog.
 * //  w w  w  .  ja  v  a  2  s.  c  o m
 * @param messageResId
 *            the message resource id to use
 * @return a simple progress dialog
 */
private ProgressDialog buildSimpleProgressDialog(int messageResId) {
    final ProgressDialog dialog = new ProgressDialog(StoreActivity.this);
    dialog.setIcon(android.R.drawable.ic_dialog_info);
    dialog.setIndeterminate(true);
    dialog.setMessage(getText(messageResId));
    return dialog;
}