Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/InputDialogContainer.java

Issue 23533041: Properly dismiss the InputDialogs in all cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.app.AlertDialog; 7 import android.app.AlertDialog;
8 import android.app.DatePickerDialog; 8 import android.app.DatePickerDialog;
9 import android.app.TimePickerDialog; 9 import android.app.TimePickerDialog;
10 import android.app.DatePickerDialog.OnDateSetListener; 10 import android.app.DatePickerDialog.OnDateSetListener;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 mDialog = new WeekPickerDialog(mContext, new MonthOrWeekListener(dia logType), 161 mDialog = new WeekPickerDialog(mContext, new MonthOrWeekListener(dia logType),
162 year, week, minTime, maxTime); 162 year, week, minTime, maxTime);
163 } 163 }
164 164
165 mDialog.setButton(DialogInterface.BUTTON_POSITIVE, 165 mDialog.setButton(DialogInterface.BUTTON_POSITIVE,
166 mContext.getText(R.string.date_picker_dialog_set), 166 mContext.getText(R.string.date_picker_dialog_set),
167 (DialogInterface.OnClickListener) mDialog); 167 (DialogInterface.OnClickListener) mDialog);
168 168
169 mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, 169 mDialog.setButton(DialogInterface.BUTTON_NEGATIVE,
170 mContext.getText(android.R.string.cancel), 170 mContext.getText(android.R.string.cancel),
171 new DialogInterface.OnClickListener() { 171 (DialogInterface.OnClickListener) null);
172 @Override
173 public void onClick(DialogInterface dialog, int which) {
174 mDialogAlreadyDismissed = true;
175 mInputActionDelegate.cancelDateTimeDialog();
176 }
177 });
178 172
179 mDialog.setButton(DialogInterface.BUTTON_NEUTRAL, 173 mDialog.setButton(DialogInterface.BUTTON_NEUTRAL,
180 mContext.getText(R.string.date_picker_dialog_clear), 174 mContext.getText(R.string.date_picker_dialog_clear),
181 new DialogInterface.OnClickListener() { 175 new DialogInterface.OnClickListener() {
182 @Override 176 @Override
183 public void onClick(DialogInterface dialog, int which) { 177 public void onClick(DialogInterface dialog, int which) {
184 mDialogAlreadyDismissed = true; 178 mDialogAlreadyDismissed = true;
185 mInputActionDelegate.replaceDateTime(dialogType, 0, 0, 0 , 0, 0, 0, 0, 0); 179 mInputActionDelegate.replaceDateTime(dialogType, 0, 0, 0 , 0, 0, 0, 0, 0);
186 } 180 }
187 }); 181 });
188 182
183 mDialog.setOnDismissListener(
184 new OnDismissListener() {
185 public void onDismiss(final DialogInterface dialog) {
186 if (!mDialogAlreadyDismissed) {
187 mDialogAlreadyDismissed = true;
188 mInputActionDelegate.cancelDateTimeDialog();
189 }
190 }
191 });
192
189 mDialogAlreadyDismissed = false; 193 mDialogAlreadyDismissed = false;
190 mDialog.show(); 194 mDialog.show();
191 } 195 }
192 196
193 boolean isDialogShowing() { 197 boolean isDialogShowing() {
194 return mDialog != null && mDialog.isShowing(); 198 return mDialog != null && mDialog.isShowing();
195 } 199 }
196 200
197 void dismissDialog() { 201 void dismissDialog() {
198 if (isDialogShowing()) mDialog.dismiss(); 202 if (isDialogShowing()) mDialog.dismiss();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 int year, int month, int monthDay, int hourOfDay, 311 int year, int month, int monthDay, int hourOfDay,
308 int minute, int second, int milli, int week, String dateFormat) { 312 int minute, int second, int milli, int week, String dateFormat) {
309 // Prevents more than one callback being sent to the native 313 // Prevents more than one callback being sent to the native
310 // side when the dialog triggers multiple events. 314 // side when the dialog triggers multiple events.
311 mDialogAlreadyDismissed = true; 315 mDialogAlreadyDismissed = true;
312 316
313 mInputActionDelegate.replaceDateTime( 317 mInputActionDelegate.replaceDateTime(
314 dialogType, year, month, monthDay, hourOfDay, minute, second, milli, week); 318 dialogType, year, month, monthDay, hourOfDay, minute, second, milli, week);
315 } 319 }
316 } 320 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698