Loading core/java/android/widget/TabWidget.java +34 −18 Original line number Diff line number Diff line Loading @@ -77,7 +77,9 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } super.onSizeChanged(w, h, oldw, oldh); } Loading @@ -104,32 +106,44 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { View selectedChild = getChildAt(mSelectedTab); if (mBottomLeftStrip != null) { mBottomLeftStrip.setState(selectedChild.getDrawableState()); } if (mBottomRightStrip != null) { mBottomRightStrip.setState(selectedChild.getDrawableState()); } if (mStripMoved) { Rect selBounds = new Rect(); // Bounds of the selected tab indicator selBounds.left = selectedChild.getLeft(); selBounds.right = selectedChild.getRight(); final int myHeight = getHeight(); if (mBottomLeftStrip != null) { mBottomLeftStrip.setBounds( Math.min(0, selBounds.left - mBottomLeftStrip.getIntrinsicWidth()), myHeight - mBottomLeftStrip.getIntrinsicHeight(), selBounds.left, getHeight()); } if (mBottomRightStrip != null) { mBottomRightStrip.setBounds( selBounds.right, myHeight - mBottomRightStrip.getIntrinsicHeight(), Math.max(getWidth(), selBounds.right + mBottomRightStrip.getIntrinsicWidth()), myHeight); } mStripMoved = false; } if (mBottomLeftStrip != null) { mBottomLeftStrip.draw(canvas); } if (mBottomRightStrip != null) { mBottomRightStrip.draw(canvas); } } /** * Sets the current tab. Loading Loading @@ -166,8 +180,10 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { getChildAt(mSelectedTab).setSelected(false); mSelectedTab = index; getChildAt(mSelectedTab).setSelected(true); if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } } /** * Sets the current tab and focuses the UI on it. Loading Loading
core/java/android/widget/TabWidget.java +34 −18 Original line number Diff line number Diff line Loading @@ -77,7 +77,9 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } super.onSizeChanged(w, h, oldw, oldh); } Loading @@ -104,32 +106,44 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { View selectedChild = getChildAt(mSelectedTab); if (mBottomLeftStrip != null) { mBottomLeftStrip.setState(selectedChild.getDrawableState()); } if (mBottomRightStrip != null) { mBottomRightStrip.setState(selectedChild.getDrawableState()); } if (mStripMoved) { Rect selBounds = new Rect(); // Bounds of the selected tab indicator selBounds.left = selectedChild.getLeft(); selBounds.right = selectedChild.getRight(); final int myHeight = getHeight(); if (mBottomLeftStrip != null) { mBottomLeftStrip.setBounds( Math.min(0, selBounds.left - mBottomLeftStrip.getIntrinsicWidth()), myHeight - mBottomLeftStrip.getIntrinsicHeight(), selBounds.left, getHeight()); } if (mBottomRightStrip != null) { mBottomRightStrip.setBounds( selBounds.right, myHeight - mBottomRightStrip.getIntrinsicHeight(), Math.max(getWidth(), selBounds.right + mBottomRightStrip.getIntrinsicWidth()), myHeight); } mStripMoved = false; } if (mBottomLeftStrip != null) { mBottomLeftStrip.draw(canvas); } if (mBottomRightStrip != null) { mBottomRightStrip.draw(canvas); } } /** * Sets the current tab. Loading Loading @@ -166,8 +180,10 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { getChildAt(mSelectedTab).setSelected(false); mSelectedTab = index; getChildAt(mSelectedTab).setSelected(true); if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } } /** * Sets the current tab and focuses the UI on it. Loading