mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1057390: Clear focus when keyboard is dismissed. r=margaret
This commit is contained in:
parent
87d44388d2
commit
633f23c334
@ -0,0 +1,36 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.search.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.EditText;
|
||||
|
||||
/**
|
||||
* An EditText subclass that loses focus when the keyboard
|
||||
* is dismissed.
|
||||
*/
|
||||
public class BackCaptureEditText extends EditText {
|
||||
public BackCaptureEditText(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public BackCaptureEditText(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public BackCaptureEditText(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
clearFocus();
|
||||
}
|
||||
return super.onKeyPreIme(keyCode, event);
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<EditText
|
||||
<org.mozilla.search.ui.BackCaptureEditText
|
||||
android:id="@+id/edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -17,4 +17,5 @@ search_activity_sources = [
|
||||
'java/org/mozilla/search/providers/SearchEngineManager.java',
|
||||
'java/org/mozilla/search/SearchPreferenceActivity.java',
|
||||
'java/org/mozilla/search/SearchWidget.java',
|
||||
'java/org/mozilla/search/ui/BackCaptureEditText.java',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user