Revert "Use action bar style from ContactsCommon"
This reverts commit 80df79f4279b7f4f0f2f275ff6dca47cdc6d4632.
Change-Id: I1f1f855ef55206fbee246a2379367415a8f42885
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5be7ca1..bae0341 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -64,6 +64,7 @@
<activity android:name=".activities.PeopleActivity"
android:label="@string/people"
android:theme="@style/PeopleTheme"
+ android:uiOptions="splitActionBarWhenNarrow"
android:clearTaskOnLaunch="true"
android:launchMode="singleTop"
>
diff --git a/res/drawable/action_bar_tab.xml b/res/drawable/action_bar_tab.xml
new file mode 100644
index 0000000..2fc5c2b
--- /dev/null
+++ b/res/drawable/action_bar_tab.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 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:drawable="@drawable/tab_selected_pressed" android:state_pressed="true"/>
+ <item android:drawable="@drawable/tab_selected_focused" android:state_focused="true"/>
+ <item android:drawable="@drawable/tab_selected" />
+</selector>
\ No newline at end of file
diff --git a/res/drawable/tab_selected.xml b/res/drawable/tab_selected.xml
new file mode 100644
index 0000000..36a4175
--- /dev/null
+++ b/res/drawable/tab_selected.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item>
+ <shape android:shape="rectangle" >
+ <solid android:color="@color/action_bar_background" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_selected_focused.xml b/res/drawable/tab_selected_focused.xml
new file mode 100644
index 0000000..13aeb4ce
--- /dev/null
+++ b/res/drawable/tab_selected_focused.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item>
+ <shape android:shape="rectangle" >
+ <solid android:color="@color/action_bar_background_highlight" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_selected_pressed.xml b/res/drawable/tab_selected_pressed.xml
new file mode 100644
index 0000000..13aeb4ce
--- /dev/null
+++ b/res/drawable/tab_selected_pressed.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item>
+ <shape android:shape="rectangle" >
+ <solid android:color="@color/action_bar_background_highlight" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_unselected_focused.xml b/res/drawable/tab_unselected_focused.xml
new file mode 100644
index 0000000..13aeb4ce
--- /dev/null
+++ b/res/drawable/tab_unselected_focused.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item>
+ <shape android:shape="rectangle" >
+ <solid android:color="@color/action_bar_background_highlight" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/drawable/tab_unselected_pressed.xml b/res/drawable/tab_unselected_pressed.xml
new file mode 100644
index 0000000..13aeb4ce
--- /dev/null
+++ b/res/drawable/tab_unselected_pressed.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item>
+ <shape android:shape="rectangle" >
+ <solid android:color="@color/action_bar_background_highlight" />
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index fc5674b..e3fab85 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -36,6 +36,4 @@
<!-- Color of the text for buttons in the action bar -->
<color name="action_bar_button_text_color">#FFFFFF</color>
- <!-- Color of the selected tab underline (overriding value in ContactsCommon) -->
- <color name="tab_selected_color">#ffeeff41</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4c59480..971bfc2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -273,11 +273,13 @@
<item quantity="other"><xliff:g id="count">%d</xliff:g> found</item>
</plurals>
- <!-- The title of "all contacts" tab. [CHAR LIMIT=14] -->
- <string name="all_contacts_tab_label">All contacts</string>
+ <!-- The content description for the "all contacts" tab.
- <!-- The title of "favorites" tab. [CHAR LIMIT=14] -->
- <string name="favorites_tab_label">Favorites</string>
+ Note: AccessibilityServices use this attribute to announce what the view represents.
+ This is especially valuable for views without textual representation like ImageView.
+
+ [CHAR LIMIT=NONE] -->
+ <string name="contactsAllLabel">All contacts</string>
<!-- Action string for calling back a number in the call log -->
<string name="callBack">Call back</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 05ce498..3129189 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -53,17 +53,16 @@
<item name="android:listViewStyle">@style/ListViewStyle</item>
</style>
- <style name="PeopleTheme" parent="@android:style/Theme.Quantum.Light">
+ <style name="PeopleTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ContactsActionBarStyle</item>
- <!-- Style for the tabs -->
- <item name="android:actionBarTabStyle">@style/ContactsActionBarTabStyle</item>
- <!-- Style for the tab bar (for the divider between tabs) -->
- <item name="android:actionBarTabBarStyle">@style/ContactsActionBarTabBarStyle</item>
- <!-- Style for the tab bar text (for text on tabs) -->
- <item name="android:actionBarTabTextStyle">@style/ContactsActionBarTabTextStyle</item>
- <!-- Style for the overflow button in the actionbar. -->
- <item name="android:actionOverflowButtonStyle">@style/ContactsActionBarOverflowQP</item>
- <item name="android:icon">@android:color/transparent</item>
+ <item name="android:homeAsUpIndicator">@drawable/ic_menu_back</item>
+ <item name="android:actionOverflowButtonStyle">@style/ContactsActionBarOverflow</item>
+ <item name="android:actionBarItemBackground">@drawable/action_bar_item_background</item>
+ <item name="android:actionBarWidgetTheme">@style/ContactsActionBarTheme</item>
+ <item name="android:actionBarTabStyle">@style/ContactsActionBarTabView</item>
+ <item name="android:actionDropDownStyle">@style/ContactsActionBarDropDownStyle</item>
+ <item name="android:textColorPrimary">@color/primary_text_color</item>
+ <item name="android:textColorSecondary">@color/secondary_text_color</item>
<item name="android:listViewStyle">@style/ListViewStyle</item>
<item name="android:windowBackground">@color/background_primary</item>
<item name="list_item_height">?android:attr/listPreferredItemHeight</item>
@@ -100,45 +99,11 @@
<item name="android:src">@drawable/ic_overflow_menu</item>
</style>
- <style name="ContactsActionBarStyle" parent="@android:style/Widget.Quantum.Light.ActionBar">
- <item name="android:background">@color/actionbar_background_color</item>
- <item name="android:titleTextStyle">@style/ContactsActionBarTitleText</item>
- <item name="android:backgroundStacked">@color/actionbar_background_color</item>
- <!-- Empty icon -->
- <item name="android:icon">@android:color/transparent</item>
- </style>
-
- <!-- Styling for tabs. -->
- <style name="ContactsActionBarTabStyle" parent="@android:style/Widget.Quantum.Light.ActionBar.TabView">
+ <style name="ContactsActionBarStyle" parent="@android:Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/action_bar_tab</item>
- <item name="android:showDividers">none</item>
- </style>
-
- <!-- Text in the action bar at the top of the screen -->
- <style name="ContactsActionBarTitleText"
- parent="@android:style/TextAppearance.Quantum.Widget.ActionBar.Title">
- <item name="android:textColor">@color/actionbar_text_color</item>
- </style>
-
- <!-- Styling for the tab bar; handles styling of the divider line. -->
- <style name="ContactsActionBarTabBarStyle"
- parent="@android:style/Widget.Quantum.ActionBar.TabBar">
- <item name="android:showDividers">none</item>
- </style>
-
- <!-- Text style for tabs. -->
- <style name="ContactsActionBarTabTextStyle"
- parent="android:style/Widget.Quantum.Light.ActionBar.TabText">
- <item name="android:textColor">@color/tab_text_color</item>
- <item name="android:textSize">@dimen/tab_text_size</item>
- <item name="android:fontFamily">@string/tab_font_family</item>
- <item name="android:textStyle">bold</item>
- </style>
-
- <!-- Action bar overflow menu icon. -->
- <style name="ContactsActionBarOverflowQP"
- parent="@android:style/Widget.Quantum.Light.ActionButton.Overflow">
- <item name="android:src">@drawable/ic_menu_overflow_lt</item>
+ <item name="android:backgroundSplit">@drawable/action_bar_tab</item>
+ <item name="android:backgroundStacked">@drawable/action_bar_tab</item>
+ <item name="android:displayOptions"></item>
</style>
<style name="ContactsActionBarDropDownStyle" parent="@android:style/Widget.Holo.Light.Spinner">
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index b8cd32e..efad12f 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -82,6 +82,7 @@
private final MyNavigationListener mNavigationListener;
private boolean mShowHomeIcon;
+ private boolean mShowTabsAsText;
public interface TabState {
public static int FAVORITES = 0;
@@ -131,6 +132,7 @@
mShowHomeIcon = mContext.getResources().getBoolean(R.bool.show_home_icon);
// On wide screens, show the tabs as text (instead of icons)
+ mShowTabsAsText = isUsingTwoPanes;
if (isUsingTwoPanes) {
mActionBarNavigationMode = ActionBar.NAVIGATION_MODE_LIST;
mTabListener = null;
@@ -175,15 +177,15 @@
}
private void setupTabs() {
- addTab(TabState.FAVORITES, R.string.favorites_tab_label);
- addTab(TabState.ALL, R.string.all_contacts_tab_label);
+ addTab(TabState.FAVORITES, R.drawable.ic_tab_starred, R.string.contactsFavoritesLabel);
+ addTab(TabState.ALL, R.drawable.ic_tab_all, R.string.contactsAllLabel);
}
private void setupNavigationList() {
ArrayAdapter<String> navAdapter = new CustomArrayAdapter(mContext,
R.layout.people_navigation_item);
- navAdapter.add(mContext.getString(R.string.favorites_tab_label));
- navAdapter.add(mContext.getString(R.string.all_contacts_tab_label));
+ navAdapter.add(mContext.getString(R.string.contactsFavoritesLabel));
+ navAdapter.add(mContext.getString(R.string.contactsAllLabel));
mActionBar.setListNavigationCallbacks(navAdapter, mNavigationListener);
}
@@ -248,10 +250,15 @@
mListener = listener;
}
- private void addTab(int expectedTabIndex, int description) {
+ private void addTab(int expectedTabIndex, int icon, int description) {
final Tab tab = mActionBar.newTab();
tab.setTabListener(mTabListener);
- tab.setText(description);
+ if (mShowTabsAsText) {
+ tab.setText(description);
+ } else {
+ tab.setIcon(icon);
+ tab.setContentDescription(description);
+ }
mActionBar.addTab(tab);
if (expectedTabIndex != tab.getPosition()) {
throw new IllegalStateException("Tabs must be created in the right order");
@@ -392,8 +399,6 @@
}
mActionBar.setHomeButtonEnabled(mSearchMode);
-
-
if (current != newFlags) {
// Pass the mask here to preserve other flags that we're not interested here.
mActionBar.setDisplayOptions(newFlags, MASK);
@@ -444,6 +449,7 @@
getNavigationItemPositionFromTabPosition(mCurrentTab));
mNavigationListener.mIgnoreNavigationItemSelected = false;
}
+ mActionBar.setTitle(null);
// Since we have the {@link SearchView} in a custom action bar, we must manually handle
// collapsing the {@link SearchView} when search mode is exited.
if (isIconifiedChanging) {