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
parent b6f37f1c1c
commit 4411fd40e8

View File

@ -86,6 +86,13 @@ public class ToolbarComponent extends BaseComponent {
return (ImageButton) getToolbarView().findViewById(R.id.forward); 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() { private CharSequence getTitle() {
return getTitleHelper(true); return getTitleHelper(true);
} }
@ -145,14 +152,19 @@ public class ToolbarComponent extends BaseComponent {
public ToolbarComponent dismissEditingMode() { public ToolbarComponent dismissEditingMode() {
assertIsEditing(); assertIsEditing();
if (getUrlEditText().isInputMethodTarget()) { // Cancel Button not implemeneted in tablet.
// Drop the soft keyboard. if (DeviceHelper.isTablet()) {
// TODO: Solo.hideSoftKeyboard() does not clear focus, causing unexpected if (getUrlEditText().isInputMethodTarget()) {
// behavior, but we may want to use it over goBack(). // Drop the soft keyboard.
mSolo.goBack(); // 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(); waitForNotEditing();