List of usage examples for android.app ProgressDialog setOnCancelListener
public void setOnCancelListener(@Nullable OnCancelListener listener)
From source file:Main.java
public static ProgressDialog showProgressDialog(Activity context, int message, ProgressDialog.OnCancelListener cancelListener) { ProgressDialog mDialog = new ProgressDialog(context); mDialog.setCancelable(cancelListener != null); mDialog.setOnCancelListener(cancelListener); mDialog.setMessage(context.getString(message)); mDialog.setIndeterminate(true);/*from w w w . ja va 2s . c om*/ mDialog.show(); return mDialog; }
From source file:Main.java
/** * Shows the ProgressDialog.//from ww w .j a v a 2s.c om * * @param context -The Activity which needs the ProgressDialog. * @param title -The title. * @param message -The message. * @param cancelListener -The OnCancelListener. * @return - A progress dialog. */ public static ProgressDialog showPrgressDialog(Context context, String title, String message, OnCancelListener cancelListener) { ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true); progressDialog.setCancelable(true); progressDialog.setOnCancelListener(cancelListener); return progressDialog; }
From source file:Main.java
/** * Shows the ProgressDialog.// ww w . j a v a 2s . c om * * @param context -The Activity which needs the ProgressDialog. * @param title -The title. * @param message -The message. * @param cancelListener -The OnCancelListener. * @return - A progress dialog. */ public static ProgressDialog showProgressDialog(Context context, String title, String message, OnCancelListener cancelListener) { ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true); progressDialog.setCancelable(true); progressDialog.setOnCancelListener(cancelListener); return progressDialog; }
From source file:Main.java
/** * Shows the ProgressDialog.//from ww w.j a v a 2 s .c o m * * @param context -The Activity which needs the ProgressDialog. * @param title -The title. * @param message -The message. * @param cancelListener -The OnCancelListener. * @return - A progress dialog. */ public static ProgressDialog showProgressDialog(Context context, String title, String message, OnCancelListener cancelListener) { ProgressDialog progressDialog = ProgressDialog.show(context, title, message, true); progressDialog.setCancelable(false); progressDialog.setOnCancelListener(cancelListener); return progressDialog; }
From source file:ru.georgeee.android.gfeedreader.SFBaseActivity.java
@Override protected Dialog onCreateDialog(int id) { ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage("Processing"); progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override/* w w w . java 2s . com*/ public void onCancel(DialogInterface dialog) { getServiceHelper().cancelCommand(requestId); } }); return progressDialog; }
From source file:ru.evilduck.framework.ui.DemoActivity.java
@Override protected Dialog onCreateDialog(int id) { ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setMessage("Processing"); progressDialog.setOnCancelListener(new OnCancelListener() { @Override/*from w w w. jav a 2 s . c o m*/ public void onCancel(DialogInterface dialog) { getServiceHelper().cancelCommand(requestId); } }); return progressDialog; }
From source file:com.mobicage.rogerthat.util.ui.UIUtils.java
public static ProgressDialog showProgressDialog(final Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, DialogInterface.OnCancelListener onCancelListener, int progressStyle, boolean show) { ProgressDialog dialog = new ProgressDialog(context); dialog.setTitle(title);//from w w w.j av a 2 s.c om dialog.setMessage(message); dialog.setIndeterminate(indeterminate); dialog.setCancelable(cancelable); dialog.setProgressNumberFormat(null); dialog.setProgressPercentFormat(null); dialog.setOnCancelListener(onCancelListener); dialog.setProgressStyle(progressStyle); dialog.setOnShowListener(new ProgressDialog.OnShowListener() { @Override public void onShow(DialogInterface dialog) { ProgressDialog progressDialog = (ProgressDialog) dialog; ProgressBar progressBar = (ProgressBar) progressDialog.findViewById(android.R.id.progress); UIUtils.setColors(context, progressBar); } }); if (show) { dialog.show(); } return dialog; }
From source file:net.sourceforge.servestream.utils.LoadingDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the Builder class for convenient dialog construction ProgressDialog loadingDialog = null; loadingDialog = new ProgressDialog(getActivity()); loadingDialog.setMessage(mDialogText); loadingDialog.setCancelable(true);//from ww w.ja va 2s.c om loadingDialog.setOnCancelListener(this); return loadingDialog; }
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);//from w w w . j a v a 2 s . co m dialog.setCancelable(true); 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.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);//from w ww . jav a 2s .c om dialog.setCancelable(true); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { if (mAuthThread != null) { mAuthThread.interrupt(); finish(); } } }); return dialog; }