Loading core/java/android/widget/TabHost.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -279,6 +279,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (!handled if (!handled && (event.getAction() == KeyEvent.ACTION_DOWN) && (event.getAction() == KeyEvent.ACTION_DOWN) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) && (mCurrentView != null) && (mCurrentView.isRootNamespace()) && (mCurrentView.isRootNamespace()) && (mCurrentView.hasFocus()) && (mCurrentView.hasFocus()) && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) { && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) { Loading @@ -292,8 +293,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); @Override @Override public void dispatchWindowFocusChanged(boolean hasFocus) { public void dispatchWindowFocusChanged(boolean hasFocus) { if (mCurrentView != null){ mCurrentView.dispatchWindowFocusChanged(hasFocus); mCurrentView.dispatchWindowFocusChanged(hasFocus); } } } public void setCurrentTab(int index) { public void setCurrentTab(int index) { if (index < 0 || index >= mTabSpecs.size()) { if (index < 0 || index >= mTabSpecs.size()) { Loading core/java/android/widget/TabWidget.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -183,7 +183,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { @Override @Override public void childDrawableStateChanged(View child) { public void childDrawableStateChanged(View child) { if (child == getChildTabViewAt(mSelectedTab)) { if (getTabCount() > 0 && child == getChildTabViewAt(mSelectedTab)) { // To make sure that the bottom strip is redrawn // To make sure that the bottom strip is redrawn invalidate(); invalidate(); } } Loading @@ -194,6 +194,9 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { public void dispatchDraw(Canvas canvas) { public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); super.dispatchDraw(canvas); // Do nothing if there are no tabs. if (getTabCount() == 0) return; // If the user specified a custom view for the tab indicators, then // If the user specified a custom view for the tab indicators, then // do not draw the bottom strips. // do not draw the bottom strips. if (!mDrawBottomStrips) { if (!mDrawBottomStrips) { Loading Loading @@ -347,7 +350,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { } } public void onFocusChange(View v, boolean hasFocus) { public void onFocusChange(View v, boolean hasFocus) { if (v == this && hasFocus) { if (v == this && hasFocus && getTabCount() > 0) { getChildTabViewAt(mSelectedTab).requestFocus(); getChildTabViewAt(mSelectedTab).requestFocus(); return; return; } } Loading Loading
core/java/android/widget/TabHost.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -279,6 +279,7 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); if (!handled if (!handled && (event.getAction() == KeyEvent.ACTION_DOWN) && (event.getAction() == KeyEvent.ACTION_DOWN) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) && (mCurrentView != null) && (mCurrentView.isRootNamespace()) && (mCurrentView.isRootNamespace()) && (mCurrentView.hasFocus()) && (mCurrentView.hasFocus()) && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) { && (mCurrentView.findFocus().focusSearch(View.FOCUS_UP) == null)) { Loading @@ -292,8 +293,10 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); @Override @Override public void dispatchWindowFocusChanged(boolean hasFocus) { public void dispatchWindowFocusChanged(boolean hasFocus) { if (mCurrentView != null){ mCurrentView.dispatchWindowFocusChanged(hasFocus); mCurrentView.dispatchWindowFocusChanged(hasFocus); } } } public void setCurrentTab(int index) { public void setCurrentTab(int index) { if (index < 0 || index >= mTabSpecs.size()) { if (index < 0 || index >= mTabSpecs.size()) { Loading
core/java/android/widget/TabWidget.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -183,7 +183,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { @Override @Override public void childDrawableStateChanged(View child) { public void childDrawableStateChanged(View child) { if (child == getChildTabViewAt(mSelectedTab)) { if (getTabCount() > 0 && child == getChildTabViewAt(mSelectedTab)) { // To make sure that the bottom strip is redrawn // To make sure that the bottom strip is redrawn invalidate(); invalidate(); } } Loading @@ -194,6 +194,9 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { public void dispatchDraw(Canvas canvas) { public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); super.dispatchDraw(canvas); // Do nothing if there are no tabs. if (getTabCount() == 0) return; // If the user specified a custom view for the tab indicators, then // If the user specified a custom view for the tab indicators, then // do not draw the bottom strips. // do not draw the bottom strips. if (!mDrawBottomStrips) { if (!mDrawBottomStrips) { Loading Loading @@ -347,7 +350,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { } } public void onFocusChange(View v, boolean hasFocus) { public void onFocusChange(View v, boolean hasFocus) { if (v == this && hasFocus) { if (v == this && hasFocus && getTabCount() > 0) { getChildTabViewAt(mSelectedTab).requestFocus(); getChildTabViewAt(mSelectedTab).requestFocus(); return; return; } } Loading