Bug 750511 - Hide soft keyboard when user touches outside awesomebar. r=mfinkle

This commit is contained in:
Wes Johnston 2012-05-25 14:03:53 -07:00
parent 83a556e6f2
commit b697cb48ba
2 changed files with 9 additions and 20 deletions

View File

@ -202,15 +202,6 @@ public class AwesomeBar extends GeckoActivity implements GeckoEventListener {
}
});
mText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
});
registerForContextMenu(mAwesomeTabs.findViewById(R.id.all_pages_list));
registerForContextMenu(mAwesomeTabs.findViewById(R.id.bookmarks_list));
registerForContextMenu(mAwesomeTabs.findViewById(R.id.history_list));

View File

@ -67,7 +67,6 @@ public class AwesomeBarTabs extends TabHost {
private boolean mInflated;
private LayoutInflater mInflater;
private OnUrlOpenListener mUrlOpenListener;
private View.OnTouchListener mListTouchListener;
private JSONArray mSearchEngines;
private ContentResolver mContentResolver;
private ContentObserver mContentObserver;
@ -738,13 +737,6 @@ public class AwesomeBarTabs extends TabHost {
// to the TabHost.
setup();
mListTouchListener = new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
hideSoftInput(view);
return false;
}
};
addAllPagesTab();
addBookmarksTab();
addHistoryTab();
@ -833,7 +825,6 @@ public class AwesomeBarTabs extends TabHost {
});
allPagesList.setAdapter(mAllPagesCursorAdapter);
allPagesList.setOnTouchListener(mListTouchListener);
}
private void addBookmarksTab() {
@ -844,7 +835,6 @@ public class AwesomeBarTabs extends TabHost {
R.id.bookmarks_list);
ListView bookmarksList = (ListView) findViewById(R.id.bookmarks_list);
bookmarksList.setOnTouchListener(mListTouchListener);
// Only load bookmark list when tab is actually used.
// See OnTabChangeListener above.
@ -858,7 +848,6 @@ public class AwesomeBarTabs extends TabHost {
R.id.history_list);
ListView historyList = (ListView) findViewById(R.id.history_list);
historyList.setOnTouchListener(mListTouchListener);
// Only load history list when tab is actually used.
// See OnTabChangeListener above.
@ -1013,4 +1002,13 @@ public class AwesomeBarTabs extends TabHost {
}
});
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
hideSoftInput(this);
// the android docs make no sense, but returning false will cause this and other
// motion events to be sent to the view the user tapped on
return false;
}
}