зеркало из https://github.com/mozilla/gecko-dev.git
Bug 993261 - Remove legacy code for redirecting key events to URL bar. r=lucasr
This commit is contained in:
Родитель
ae43efa29c
Коммит
9ae694cea2
|
@ -362,11 +362,6 @@ abstract public class BrowserApp extends GeckoApp
|
|||
if (!mBrowserToolbar.isEditing() && onKey(null, keyCode, event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mBrowserToolbar.onKey(keyCode, event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -417,37 +417,6 @@ public class BrowserToolbar extends ThemedRelativeLayout
|
|||
return urlDisplayLayout.dismissSiteIdentityPopup();
|
||||
}
|
||||
|
||||
public boolean onKey(int keyCode, KeyEvent event) {
|
||||
if (event.getAction() != KeyEvent.ACTION_DOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Galaxy Note sends key events for the stylus that are outside of the
|
||||
// valid keyCode range (see bug 758427)
|
||||
if (keyCode > KeyEvent.getMaxKeyCode()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// This method is called only if the key event was not handled
|
||||
// by any of the views, which usually means the edit box lost focus
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK ||
|
||||
keyCode == KeyEvent.KEYCODE_MENU ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_UP ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_LEFT ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
|
||||
keyCode == KeyEvent.KEYCODE_DPAD_CENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_DEL ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||
return false;
|
||||
} else if (isEditing()) {
|
||||
return urlEditLayout.onKey(keyCode, event);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
// If the motion event has occured below the toolbar (due to the scroll
|
||||
|
|
|
@ -108,27 +108,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
|
|||
mEditText.setOnFilterListener(listener);
|
||||
}
|
||||
|
||||
boolean onKey(int keyCode, KeyEvent event) {
|
||||
final int prevSelStart = mEditText.getSelectionStart();
|
||||
final int prevSelEnd = mEditText.getSelectionEnd();
|
||||
|
||||
// Manually dispatch the key event to the edit text. If selection changed as
|
||||
// a result of the key event, then give focus back to mEditText
|
||||
mEditText.dispatchKeyEvent(event);
|
||||
|
||||
final int curSelStart = mEditText.getSelectionStart();
|
||||
final int curSelEnd = mEditText.getSelectionEnd();
|
||||
|
||||
if (prevSelStart != curSelStart || prevSelEnd != curSelEnd) {
|
||||
mEditText.requestFocusFromTouch();
|
||||
|
||||
// Restore the selection, which gets lost due to the focus switch
|
||||
mEditText.setSelection(curSelStart, curSelEnd);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void onEditSuggestion(String suggestion) {
|
||||
mEditText.setText(suggestion);
|
||||
mEditText.setSelection(mEditText.getText().length());
|
||||
|
@ -144,4 +123,4 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
|
|||
String getText() {
|
||||
return mEditText.getText().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче