am 8fd48ca3: Merge "Fix TabHost stealing focus on hardware keyboard keypress" into mnc-dev

* commit '8fd48ca377956e434819ade33a9970cd66a2fda7':
  Fix TabHost stealing focus on hardware keyboard keypress
This commit is contained in:
James Cook
2015-06-03 21:07:48 +00:00
committed by Android Git Automerger

View File

@@ -188,32 +188,9 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");
mLocalActivityManager = activityGroup;
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.addOnTouchModeChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
final ViewTreeObserver treeObserver = getViewTreeObserver();
treeObserver.removeOnTouchModeChangeListener(this);
}
/**
* {@inheritDoc}
*/
public void onTouchModeChanged(boolean isInTouchMode) {
if (!isInTouchMode) {
// leaving touch mode.. if nothing has focus, let's give it to
// the indicator of the current tab
if (mCurrentView != null && (!mCurrentView.hasFocus() || mCurrentView.isFocused())) {
mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus();
}
}
// No longer used, but kept to maintain API compatibility.
}
/**