avast / android-styled-dialogs

Backport of Material dialogs with easy-to-use API based on DialogFragment
Apache License 2.0
2.15k stars 450 forks source link

Need to set DialogInterface.OnCancelListener on a ProgressDialogFragment #85

Closed andreabellitto closed 9 years ago

andreabellitto commented 9 years ago

As in title i need to add an OnCancelListener on a ProgressDialogFragment, what i want to do is something like this:

ProgressDialogFragment.createBuilder(this, getSupportFragmentManager()) .setTitle(appContext.getString(R.string.progressDialogTitle)) .setMessage(appContext.getString(R.string.progressDialogMessage)) .setOnCancelListener(myOnCancelListener) .show(); This will enable me to show a fragment from inside an asynktask and listen there for his cancellation.

davidvavra commented 9 years ago

StyledDialogs have different architecture of listeners which survive rotation. You can listen to them in Activity or Fragment. ProgressDialog already has a support for OnCancelListener. Look into DemoActivity how it's used.