OSDN Git Service

Guard double-showing of user credentials dialog
authorRobin Lee <rgl@google.com>
Thu, 7 Apr 2016 12:17:24 +0000 (13:17 +0100)
committerRobin Lee <rgl@google.com>
Thu, 7 Apr 2016 12:20:21 +0000 (13:20 +0100)
Only create & show the dialogfragment if it does not already exist.

Bug: 28058930
Change-Id: Ia48cc8a5fd60a12c3beb6c9263036a449cf8d67c

src/com/android/settings/UserCredentialsSettings.java

index 6438764..a09800b 100644 (file)
@@ -104,10 +104,12 @@ public class UserCredentialsSettings extends OptionsMenuFragment implements OnIt
             final Bundle args = new Bundle();
             args.putParcelable(ARG_CREDENTIAL, item);
 
-            final CredentialDialogFragment frag = new CredentialDialogFragment();
-            frag.setTargetFragment(target, /* requestCode */ -1);
-            frag.setArguments(args);
-            frag.show(target.getFragmentManager(), TAG);
+            if (target.getFragmentManager().findFragmentByTag(TAG) == null) {
+                final DialogFragment frag = new CredentialDialogFragment();
+                frag.setTargetFragment(target, /* requestCode */ -1);
+                frag.setArguments(args);
+                frag.show(target.getFragmentManager(), TAG);
+            }
         }
 
         @Override