Loading core/java/android/widget/TabWidget.java +33 −56 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.View.OnFocusChangeListener; Loading Loading @@ -66,26 +65,19 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { } public TabWidget(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); super(context, attrs); initTabWidget(); TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TabWidget, defStyle, 0); mBottomLeftStrip = a.getDrawableWithContext(context, com.android.internal.R.styleable.TabWidget_bottomLeftStrip); mBottomRightStrip = a.getDrawableWithContext(context, com.android.internal.R.styleable.TabWidget_bottomRightStrip); a.recycle(); } @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 @@ -109,7 +101,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { final Context context = mContext; final Resources resources = context.getResources(); if (mBottomLeftStrip == null || mBottomRightStrip == null) { if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) { // Donut apps get old color scheme mBottomLeftStrip = resources.getDrawable( Loading @@ -123,7 +114,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { mBottomRightStrip = resources.getDrawable( com.android.internal.R.drawable.tab_bottom_right); } } // Deal with focus, as we don't want the focus to go by default // to a tab other than the current tab Loading Loading @@ -212,44 +203,32 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { View selectedChild = getChildTabViewAt(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 @@ -286,10 +265,8 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { getChildTabViewAt(mSelectedTab).setSelected(false); mSelectedTab = index; getChildTabViewAt(mSelectedTab).setSelected(true); if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } } /** * Sets the current tab and focuses the UI on it. Loading core/res/res/layout/tab_indicator.xml +7 −5 Original line number Diff line number Diff line Loading @@ -15,9 +15,13 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="0dip" android:layout_height="64dip" android:layout_weight="1" android:layout_marginLeft="-3dip" android:layout_marginRight="-3dip" android:orientation="vertical" style="?android:attr/tabIndicatorStyle" > android:background="@android:drawable/tab_indicator"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" Loading @@ -30,9 +34,7 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:ellipsize="marquee" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceTab" style="?android:attr/tabWidgetStyle" /> </RelativeLayout> core/res/res/values/attrs.xml +0 −17 Original line number Diff line number Diff line Loading @@ -158,19 +158,6 @@ <attr name="buttonStyleTimePickerUp" format="reference" /> <attr name="buttonStyleTimePickerDown" format="reference" /> <!-- ============== --> <!-- Tab styles --> <!-- ============== --> <eat-comment /> <!-- Style for the inflated indicator widget itself, not the text or image views typically contained within. --> <attr name="tabIndicatorStyle" format="reference" /> <!-- Style for the text label on the default indicator. Previously was lumped with tabWidgetStyle. --> <attr name="textAppearanceTab" format="reference" /> <!-- ============== --> <!-- Gallery styles --> <!-- ============== --> Loading Loading @@ -1891,10 +1878,6 @@ <attr name="layout_span" format="integer" /> </declare-styleable> <declare-styleable name="TabWidget"> <!-- Bottom-left tab strip. --> <attr name="bottomLeftStrip" format="reference" /> <!-- Bottom-right tab strip. --> <attr name="bottomRightStrip" format="reference" /> </declare-styleable> <declare-styleable name="TextAppearance"> <!-- Text color. --> Loading core/res/res/values/public.xml +1 −6 Original line number Diff line number Diff line Loading @@ -1225,8 +1225,7 @@ =============================================================== --> <eat-comment /> <public type="style" name="Widget.TabIndicator" id="0x010300a0" /> <public type="style" name="Widget.EditText.TimePicker" /> <public type="style" name="Widget.EditText.TimePicker" id="0x010300a0" /> <public type="style" name="com_android_server_status_ExpandedView" /> <public type="style" name="com_android_server_status_LatestItemView" /> <public type="style" name="Widget.TextView.ListItem" /> Loading @@ -1243,10 +1242,6 @@ <public type="attr" name="alertDialogTheme" /> <public type="attr" name="searchDialogTheme" /> <public type="attr" name="listItemTextViewStyle" /> <public type="attr" name="bottomLeftStrip" /> <public type="attr" name="bottomRightStrip" /> <public type="attr" name="tabIndicatorStyle" /> <public type="attr" name="textAppearanceTab" /> <public type="attr" name="timePickerInputStyle" /> <public type="attr" name="buttonStyleTimePickerUp" /> Loading core/res/res/values/styles.xml +3 −11 Original line number Diff line number Diff line Loading @@ -500,8 +500,9 @@ </style> <style name="Widget.TabWidget"> <item name="android:bottomLeftStrip">@android:drawable/tab_bottom_left</item> <item name="android:bottomRightStrip">@android:drawable/tab_bottom_right</item> <item name="android:textAppearance">@style/TextAppearance.Widget.TabWidget</item> <item name="ellipsize">marquee</item> <item name="singleLine">true</item> </style> <style name="Widget.Gallery"> Loading Loading @@ -870,15 +871,6 @@ <item name="textColorTertiaryInverse">@android:color/tertiary_text_dark</item> </style> <style name="Widget.TabIndicator"> <item name="android:layout_width">0px</item> <item name="android:layout_weight">1</item> <item name="android:layout_height">64dp</item> <item name="android:layout_marginLeft">-3dp</item> <item name="android:layout_marginRight">-3dp</item> <item name="android:background">@android:drawable/tab_indicator</item> </style> <style name="TimePickerUpButton"> <item name="android:background">@android:drawable/timepicker_up_btn</item> </style> Loading Loading
core/java/android/widget/TabWidget.java +33 −56 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.View.OnFocusChangeListener; Loading Loading @@ -66,26 +65,19 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { } public TabWidget(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); super(context, attrs); initTabWidget(); TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TabWidget, defStyle, 0); mBottomLeftStrip = a.getDrawableWithContext(context, com.android.internal.R.styleable.TabWidget_bottomLeftStrip); mBottomRightStrip = a.getDrawableWithContext(context, com.android.internal.R.styleable.TabWidget_bottomRightStrip); a.recycle(); } @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 @@ -109,7 +101,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { final Context context = mContext; final Resources resources = context.getResources(); if (mBottomLeftStrip == null || mBottomRightStrip == null) { if (context.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.DONUT) { // Donut apps get old color scheme mBottomLeftStrip = resources.getDrawable( Loading @@ -123,7 +114,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { mBottomRightStrip = resources.getDrawable( com.android.internal.R.drawable.tab_bottom_right); } } // Deal with focus, as we don't want the focus to go by default // to a tab other than the current tab Loading Loading @@ -212,44 +203,32 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { View selectedChild = getChildTabViewAt(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 @@ -286,10 +265,8 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { getChildTabViewAt(mSelectedTab).setSelected(false); mSelectedTab = index; getChildTabViewAt(mSelectedTab).setSelected(true); if (mBottomLeftStrip != null || mBottomRightStrip != null) { mStripMoved = true; } } /** * Sets the current tab and focuses the UI on it. Loading
core/res/res/layout/tab_indicator.xml +7 −5 Original line number Diff line number Diff line Loading @@ -15,9 +15,13 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="0dip" android:layout_height="64dip" android:layout_weight="1" android:layout_marginLeft="-3dip" android:layout_marginRight="-3dip" android:orientation="vertical" style="?android:attr/tabIndicatorStyle" > android:background="@android:drawable/tab_indicator"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" Loading @@ -30,9 +34,7 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:ellipsize="marquee" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceTab" style="?android:attr/tabWidgetStyle" /> </RelativeLayout>
core/res/res/values/attrs.xml +0 −17 Original line number Diff line number Diff line Loading @@ -158,19 +158,6 @@ <attr name="buttonStyleTimePickerUp" format="reference" /> <attr name="buttonStyleTimePickerDown" format="reference" /> <!-- ============== --> <!-- Tab styles --> <!-- ============== --> <eat-comment /> <!-- Style for the inflated indicator widget itself, not the text or image views typically contained within. --> <attr name="tabIndicatorStyle" format="reference" /> <!-- Style for the text label on the default indicator. Previously was lumped with tabWidgetStyle. --> <attr name="textAppearanceTab" format="reference" /> <!-- ============== --> <!-- Gallery styles --> <!-- ============== --> Loading Loading @@ -1891,10 +1878,6 @@ <attr name="layout_span" format="integer" /> </declare-styleable> <declare-styleable name="TabWidget"> <!-- Bottom-left tab strip. --> <attr name="bottomLeftStrip" format="reference" /> <!-- Bottom-right tab strip. --> <attr name="bottomRightStrip" format="reference" /> </declare-styleable> <declare-styleable name="TextAppearance"> <!-- Text color. --> Loading
core/res/res/values/public.xml +1 −6 Original line number Diff line number Diff line Loading @@ -1225,8 +1225,7 @@ =============================================================== --> <eat-comment /> <public type="style" name="Widget.TabIndicator" id="0x010300a0" /> <public type="style" name="Widget.EditText.TimePicker" /> <public type="style" name="Widget.EditText.TimePicker" id="0x010300a0" /> <public type="style" name="com_android_server_status_ExpandedView" /> <public type="style" name="com_android_server_status_LatestItemView" /> <public type="style" name="Widget.TextView.ListItem" /> Loading @@ -1243,10 +1242,6 @@ <public type="attr" name="alertDialogTheme" /> <public type="attr" name="searchDialogTheme" /> <public type="attr" name="listItemTextViewStyle" /> <public type="attr" name="bottomLeftStrip" /> <public type="attr" name="bottomRightStrip" /> <public type="attr" name="tabIndicatorStyle" /> <public type="attr" name="textAppearanceTab" /> <public type="attr" name="timePickerInputStyle" /> <public type="attr" name="buttonStyleTimePickerUp" /> Loading
core/res/res/values/styles.xml +3 −11 Original line number Diff line number Diff line Loading @@ -500,8 +500,9 @@ </style> <style name="Widget.TabWidget"> <item name="android:bottomLeftStrip">@android:drawable/tab_bottom_left</item> <item name="android:bottomRightStrip">@android:drawable/tab_bottom_right</item> <item name="android:textAppearance">@style/TextAppearance.Widget.TabWidget</item> <item name="ellipsize">marquee</item> <item name="singleLine">true</item> </style> <style name="Widget.Gallery"> Loading Loading @@ -870,15 +871,6 @@ <item name="textColorTertiaryInverse">@android:color/tertiary_text_dark</item> </style> <style name="Widget.TabIndicator"> <item name="android:layout_width">0px</item> <item name="android:layout_weight">1</item> <item name="android:layout_height">64dp</item> <item name="android:layout_marginLeft">-3dp</item> <item name="android:layout_marginRight">-3dp</item> <item name="android:background">@android:drawable/tab_indicator</item> </style> <style name="TimePickerUpButton"> <item name="android:background">@android:drawable/timepicker_up_btn</item> </style> Loading