Use setCancelable() rather than setCanceledOnTouchOutside() for better
code smell and consisting with general not canceling behavior.
The back key and touching outside will not cancel this dialog for better
UX.
Bug:
128877712
Test: atest NetworkRequestDialogFragmentTest
Change-Id: I19bc5637a7307610e34db15d54c1d80d5b7e379b
.setOnItemClickListener(
(parent, view, position, id) -> this.onClick(dialog, position));
- // Don't dismiss dialog when touching outside. User report it is easy to touch outside.
- // This causes dialog to close. Which is concerned as a bad UX (b/128877712).
- dialog.setCanceledOnTouchOutside(false);
+ // Don't dismiss dialog when touching outside. User reports it is easy to touch outside.
+ // This causes dialog to close.
+ setCancelable(false);
dialog.setOnShowListener((dialogInterface) -> {
// Replace NeutralButton onClickListener to avoid closing dialog