OSDN Git Service

[Network Connection] Correct canceling dialog behavior
authorcosmohsieh <cosmohsieh@google.com>
Tue, 26 Mar 2019 07:22:08 +0000 (15:22 +0800)
committercosmohsieh <cosmohsieh@google.com>
Fri, 29 Mar 2019 02:15:21 +0000 (10:15 +0800)
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

src/com/android/settings/wifi/NetworkRequestDialogFragment.java

index e9057e6..2a7ac17 100644 (file)
@@ -138,9 +138,9 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp
                 .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