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:
@@ -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.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user