summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-09-08 16:14:47 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-08 16:14:47 -0700
commit75c923e3ec584dc8c3418534141e49441df0462a (patch)
tree819768bc250dc0a75811b66a465f0188936cf484 /core
parentc03ea416ca1d6d82f2c4bfdc31f73e08951d7362 (diff)
parentca259f4081404a8b4524b2fe80ab036182141ab7 (diff)
downloadframeworks_base-75c923e3ec584dc8c3418534141e49441df0462a.zip
frameworks_base-75c923e3ec584dc8c3418534141e49441df0462a.tar.gz
frameworks_base-75c923e3ec584dc8c3418534141e49441df0462a.tar.bz2
Merge "Added resources and styles for ActionBar tabs"
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java10
-rw-r--r--core/res/res/drawable-mdpi/minitab_lt_focus.9.pngbin0 -> 182 bytes
-rw-r--r--core/res/res/drawable-mdpi/minitab_lt_press.9.pngbin0 -> 181 bytes
-rw-r--r--core/res/res/drawable-mdpi/minitab_lt_selected.9.pngbin0 -> 183 bytes
-rw-r--r--core/res/res/drawable-mdpi/minitab_lt_unselected.9.pngbin0 -> 177 bytes
-rw-r--r--core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.pngbin0 -> 180 bytes
-rw-r--r--core/res/res/drawable/minitab_lt.xml25
-rwxr-xr-xcore/res/res/values/attrs.xml4
-rw-r--r--core/res/res/values/public.xml3
-rw-r--r--core/res/res/values/styles.xml19
-rw-r--r--core/res/res/values/themes.xml3
11 files changed, 58 insertions, 6 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 6b3d353..308a709 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -371,7 +371,8 @@ public class ActionBarView extends ViewGroup {
break;
case ActionBar.NAVIGATION_MODE_TABS:
mTabScrollView = new HorizontalScrollView(getContext());
- mTabLayout = new LinearLayout(getContext());
+ mTabLayout = new LinearLayout(getContext(), null,
+ com.android.internal.R.attr.actionBarTabBarStyle);
mTabScrollView.addView(mTabLayout);
addView(mTabScrollView);
break;
@@ -609,7 +610,7 @@ public class ActionBarView extends ViewGroup {
if (mTabScrollView != null) {
mTabScrollView.measure(
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
- MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
}
break;
}
@@ -711,7 +712,7 @@ public class ActionBarView extends ViewGroup {
private ActionBar.Tab mTab;
public TabView(Context context, ActionBar.Tab tab) {
- super(context);
+ super(context, null, com.android.internal.R.attr.actionBarTabStyle);
mTab = tab;
final View custom = tab.getCustomView();
@@ -734,7 +735,8 @@ public class ActionBarView extends ViewGroup {
}
if (text != null) {
- TextView textView = new TextView(context);
+ TextView textView = new TextView(context, null,
+ com.android.internal.R.attr.actionBarTabTextStyle);
textView.setText(text);
textView.setSingleLine();
textView.setEllipsize(TruncateAt.END);
diff --git a/core/res/res/drawable-mdpi/minitab_lt_focus.9.png b/core/res/res/drawable-mdpi/minitab_lt_focus.9.png
new file mode 100644
index 0000000..415c571
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_focus.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_press.9.png b/core/res/res/drawable-mdpi/minitab_lt_press.9.png
new file mode 100644
index 0000000..4166543
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_press.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_selected.9.png b/core/res/res/drawable-mdpi/minitab_lt_selected.9.png
new file mode 100644
index 0000000..fefa27e
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_selected.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png b/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png
new file mode 100644
index 0000000..0051cd5
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_unselected.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png b/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png
new file mode 100644
index 0000000..69444dd
--- /dev/null
+++ b/core/res/res/drawable-mdpi/minitab_lt_unselected_press.9.png
Binary files differ
diff --git a/core/res/res/drawable/minitab_lt.xml b/core/res/res/drawable/minitab_lt.xml
new file mode 100644
index 0000000..aeea97c
--- /dev/null
+++ b/core/res/res/drawable/minitab_lt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:state_selected="true"
+ android:drawable="@drawable/minitab_lt_press" />
+ <item android:state_selected="true"
+ android:drawable="@drawable/minitab_lt_selected" />
+ <item android:state_pressed="true"
+ android:drawable="@drawable/minitab_lt_unselected_press" />
+ <item android:drawable="@drawable/minitab_lt_unselected" />
+</selector>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b476b44..3130b20 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -473,6 +473,10 @@
<eat-comment />
<!-- Default amount of padding to use between action buttons. -->
<attr name="actionButtonPadding" format="dimension" />
+ <!-- Default style for tabs within an action bar -->
+ <attr name="actionBarTabStyle" format="reference" />
+ <attr name="actionBarTabBarStyle" format="reference" />
+ <attr name="actionBarTabTextStyle" format="reference" />
<!-- =================== -->
<!-- Action mode styles -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 7bb56bd..515f817 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1335,6 +1335,9 @@
<public type="attr" name="listChoiceBackgroundIndicator" />
<public type="attr" name="spinnerMode" />
<public type="attr" name="animateLayoutChanges" />
+ <public type="attr" name="actionBarTabStyle" />
+ <public type="attr" name="actionBarTabBarStyle" />
+ <public type="attr" name="actionBarTabTextStyle" />
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 6964808..bbdad62 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -885,12 +885,27 @@
<item name="android:divider">@android:drawable/action_bar_divider</item>
<item name="android:height">?android:attr/windowActionBarSize</item>
<item name="android:paddingLeft">3dip</item>
- <item name="android:paddingTop">3dip</item>
+ <item name="android:paddingTop">0dip</item>
<item name="android:paddingRight">3dip</item>
- <item name="android:paddingBottom">3dip</item>
+ <item name="android:paddingBottom">0dip</item>
</style>
<style name="Widget.ActionButton">
<item name="android:background">@null</item>
</style>
+
+ <style name="Widget.ActionBarView_TabView">
+ <item name="android:background">@drawable/minitab_lt</item>
+ <item name="android:paddingLeft">4dip</item>
+ <item name="android:paddingRight">4dip</item>
+ </style>
+
+ <style name="Widget.ActionBarView_TabBar">
+ </style>
+
+ <style name="Widget.ActionBarView_TabText">
+ <item name="android:textAppearance">@style/TextAppearance.Widget.TextView.PopupMenu</item>
+ <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
+ <item name="android:textSize">18sp</item>
+ </style>
</resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 6ed7b71..652121c 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -199,6 +199,9 @@
<item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.QuickContactBadgeSmall.WindowSmall</item>
<item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.QuickContactBadgeSmall.WindowMedium</item>
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>
+ <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item>
+ <item name="actionBarTabBarStyle">@style/Widget.ActionBarView_TabBar</item>
+ <item name="actionBarTabTextStyle">@style/Widget.ActionBarView_TabText</item>
<!-- Preference styles -->
<item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>