Commit 5ba2fa14 authored by tiger@opera.com's avatar tiger@opera.com

Properly dismiss the InputDialogs in all cases

On newer versions of Android, dismissing a date/time dialog (with hw
back or touch outside of it) will still set the date or time. This is
not the case on older Android versions.

This fix adds an OnDismissListener that makes sure the dialog is always
cancelled unless it already have been cancelled or already have reported
back a new date.

R=bulach@chromium.org,olilan@chromium.org,keishi@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/23533041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222027 0039d316-1c4b-4281-b951-d872f2087c98
parent 596cfef0
...@@ -168,13 +168,7 @@ public class InputDialogContainer { ...@@ -168,13 +168,7 @@ public class InputDialogContainer {
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, mDialog.setButton(DialogInterface.BUTTON_NEGATIVE,
mContext.getText(android.R.string.cancel), mContext.getText(android.R.string.cancel),
new DialogInterface.OnClickListener() { (DialogInterface.OnClickListener) null);
@Override
public void onClick(DialogInterface dialog, int which) {
mDialogAlreadyDismissed = true;
mInputActionDelegate.cancelDateTimeDialog();
}
});
mDialog.setButton(DialogInterface.BUTTON_NEUTRAL, mDialog.setButton(DialogInterface.BUTTON_NEUTRAL,
mContext.getText(R.string.date_picker_dialog_clear), mContext.getText(R.string.date_picker_dialog_clear),
...@@ -186,6 +180,16 @@ public class InputDialogContainer { ...@@ -186,6 +180,16 @@ public class InputDialogContainer {
} }
}); });
mDialog.setOnDismissListener(
new OnDismissListener() {
public void onDismiss(final DialogInterface dialog) {
if (!mDialogAlreadyDismissed) {
mDialogAlreadyDismissed = true;
mInputActionDelegate.cancelDateTimeDialog();
}
}
});
mDialogAlreadyDismissed = false; mDialogAlreadyDismissed = false;
mDialog.show(); 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