Bug 997996 - Make ToolbarComponent.dismissEditingMode use the cancel editing mode button. r=mcomella

This commit is contained in:
vivek 2014-04-21 13:27:00 +02:00
Родитель 7a88b6f747
Коммит 058e3a8dc1
1 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -86,6 +86,13 @@ public class ToolbarComponent extends BaseComponent {
return (ImageButton) getToolbarView().findViewById(R.id.forward);
}
/**
* Returns the View for the edit cancel button in the browser toolbar.
*/
private ImageButton getEditCancelButton() {
return (ImageButton) getToolbarView().findViewById(R.id.edit_cancel);
}
private CharSequence getTitle() {
return getTitleHelper(true);
}
@ -145,14 +152,19 @@ public class ToolbarComponent extends BaseComponent {
public ToolbarComponent dismissEditingMode() {
assertIsEditing();
if (getUrlEditText().isInputMethodTarget()) {
// Drop the soft keyboard.
// TODO: Solo.hideSoftKeyboard() does not clear focus, causing unexpected
// behavior, but we may want to use it over goBack().
mSolo.goBack();
}
// Cancel Button not implemeneted in tablet.
if (DeviceHelper.isTablet()) {
if (getUrlEditText().isInputMethodTarget()) {
// Drop the soft keyboard.
// TODO: Solo.hideSoftKeyboard() does not clear focus, causing unexpected
// behavior, but we may want to use it over goBack().
mSolo.goBack();
}
mSolo.goBack();
mSolo.goBack();
} else {
mSolo.clickOnView(getEditCancelButton());
}
waitForNotEditing();