Merge "If you tap outside dialog then re-enable" into udc-dev

This commit is contained in:
Becca Hughes
2023-05-10 00:33:11 +00:00
committed by Android (Google) Code Review

View File

@@ -620,6 +620,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
completeEnableProviderDialogBox( completeEnableProviderDialogBox(
whichButton, packageName, setActivityResult); whichButton, packageName, setActivityResult);
} }
@Override
public void onCancel() {}
}; };
return new NewProviderConfirmationDialogFragment(host, packageName, appName); return new NewProviderConfirmationDialogFragment(host, packageName, appName);
@@ -666,6 +669,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
new DialogHost() { new DialogHost() {
@Override @Override
public void onDialogClick(int whichButton) {} public void onDialogClick(int whichButton) {}
@Override
public void onCancel() {}
}; };
return new ErrorDialogFragment(host); return new ErrorDialogFragment(host);
@@ -689,6 +695,12 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
pref.setChecked(true); pref.setChecked(true);
} }
} }
@Override
public void onCancel() {
// If we dismiss the dialog then re-enable.
pref.setChecked(true);
}
}; };
return new ConfirmationDialogFragment(host, packageName, appName); return new ConfirmationDialogFragment(host, packageName, appName);
@@ -705,6 +717,8 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
/** Called when the dialog button is clicked. */ /** Called when the dialog button is clicked. */
private static interface DialogHost { private static interface DialogHost {
void onDialogClick(int whichButton); void onDialogClick(int whichButton);
void onCancel();
} }
/** Called to send messages back to the parent fragment. */ /** Called to send messages back to the parent fragment. */
@@ -754,6 +768,11 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
public DialogHost getDialogHost() { public DialogHost getDialogHost() {
return mDialogHost; return mDialogHost;
} }
@Override
public void onCancel(@NonNull DialogInterface dialog) {
getDialogHost().onCancel();
}
} }
/** Dialog showing error when too many providers are selected. */ /** Dialog showing error when too many providers are selected. */