Commit a47efe0e authored by Becky Zhou's avatar Becky Zhou Committed by Commit Bot

[ModalDialog] Fix cancel on touch outside

After the custom scrim is removed from the app modal dialog, we should
handle cancel on touch outside on the dialog instead of the custom
scrim.

Bug: 870292
Change-Id: Ie4a4bb4f0c78b503d236eb1e1775953d734c446b
Reviewed-on: https://chromium-review.googlesource.com/1161199Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Becky Zhou <huayinz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580347}
parent 104d9bf8
......@@ -38,12 +38,7 @@ public class AppModalPresenter extends ModalDialogManager.Presenter {
ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);
dialogView.setBackgroundResource(R.drawable.popup_bg);
container.addView(dialogView, params);
if (getModalDialog().getCancelOnTouchOutside()) {
mDialog.setCanceledOnTouchOutside(true);
// The dialog container covers the entire screen. To achieve the cancel on touch outside
// behavior cancel the dialog if the container is touched.
container.setOnClickListener((v) -> mDialog.cancel());
}
mDialog.setCanceledOnTouchOutside(getModalDialog().getCancelOnTouchOutside());
mDialog.show();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment