Bug 743158 - Take focus away from awesome bar when accessing awesome screen lists. r=wesj

This commit is contained in:
Jim Chen 2013-04-29 14:36:23 -04:00
parent 5e0ee32176
commit a1f1d83c09
2 changed files with 9 additions and 11 deletions

View File

@ -132,8 +132,10 @@ public class AwesomeBarTabs extends TabHost
mListTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN)
hideSoftInput(view);
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
// take focus away from awesome bar to hide the keyboard
requestFocus();
}
return false;
}
};
@ -161,7 +163,8 @@ public class AwesomeBarTabs extends TabHost
public void onPageSelected(int position) {
tabWidget.setCurrentTab(position);
styleSelectedTab();
hideSoftInput(mViewPager);
// take focus away from awesome bar to hide the keyboard
requestFocus();
}
});
@ -276,13 +279,6 @@ public class AwesomeBarTabs extends TabHost
return indicatorView;
}
private boolean hideSoftInput(View view) {
InputMethodManager imm =
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
public void setOnUrlOpenListener(OnUrlOpenListener listener) {
mUrlOpenListener = listener;
for (AwesomeBarTab tab : mTabs) {

View File

@ -6,7 +6,9 @@
<org.mozilla.gecko.AwesomeBarTabs xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/awesomebar_tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_height="fill_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"