Change the search UI on 2-pane
- Don't always show the search view. Instead, show the search icon as an
option menu.
- If the icon is tapped, show the search view.
- Don't show "Searching all contacts". Just show the search view right
next to the app icon.
This simply means to use the 1-pane search UI on 2-pane as well.
Bug 5055536
Change-Id: I9a4b16048285cd30975bcb2bae5ec3d01d15f20e
diff --git a/res/menu-sw580dp-w720dp/actions.xml b/res/menu-sw580dp-w720dp/actions.xml
index d87b091..604813e 100644
--- a/res/menu-sw580dp-w720dp/actions.xml
+++ b/res/menu-sw580dp-w720dp/actions.xml
@@ -15,6 +15,12 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
+ android:id="@+id/menu_search"
+ android:icon="@android:drawable/ic_menu_search"
+ android:title="@string/menu_search"
+ android:showAsAction="always" />
+
+ <item
android:id="@+id/menu_add_contact"
android:icon="@drawable/ic_menu_add_contact_holo_light"
android:title="@string/menu_new_contact_action_bar"
diff --git a/res/menu-sw580dp/actions.xml b/res/menu-sw580dp/actions.xml
index fea883e..ebe4193 100644
--- a/res/menu-sw580dp/actions.xml
+++ b/res/menu-sw580dp/actions.xml
@@ -15,6 +15,12 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
+ android:id="@+id/menu_search"
+ android:icon="@android:drawable/ic_menu_search"
+ android:title="@string/menu_search"
+ android:showAsAction="ifRoom" />
+
+ <item
android:id="@+id/menu_add_contact"
android:icon="@drawable/ic_menu_add_contact_holo_light"
android:title="@string/menu_new_contact_action_bar"
diff --git a/res/values-sw580dp/donottranslate_config.xml b/res/values-sw580dp/donottranslate_config.xml
index 5c59f16..3d515eb 100644
--- a/res/values-sw580dp/donottranslate_config.xml
+++ b/res/values-sw580dp/donottranslate_config.xml
@@ -19,7 +19,6 @@
<resources>
<bool name="config_use_two_panes">true</bool>
- <bool name="always_show_search_view">true</bool>
<bool name="show_home_icon">true</bool>
<bool name="config_show_group_action_in_action_bar">false</bool>
</resources>
diff --git a/res/values/donottranslate_config.xml b/res/values/donottranslate_config.xml
index 0c719c4..6a4ea62 100644
--- a/res/values/donottranslate_config.xml
+++ b/res/values/donottranslate_config.xml
@@ -104,10 +104,6 @@
shown in their own screens. This flag must be in sync with the layout definitions. -->
<bool name="config_use_two_panes">false</bool>
- <!-- If true, search view on action bar will always be visible. If false, it'll only be
- visible in search mode. -->
- <bool name="always_show_search_view">false</bool>
-
<!-- If true, the "home" icon on the action bar will be shown. -->
<bool name="show_home_icon">false</bool>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4069c49..9f3d613 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1439,9 +1439,6 @@
<!-- The description of the directory where the contact was found [CHAR LIMIT=100]-->
<string name="contact_directory_description">Directory <xliff:g id="type" example="Corporate Directory">%1$s</xliff:g></string>
- <!-- The label displayed in the Contacts action bar when in search mode [CHAR LIMIT=64] -->
- <string name="search_label">Searching all contacts</string>
-
<!-- The label in section header in the contact list for a contact directory [CHAR LIMIT=128] -->
<string name="directory_search_label">Directory</string>
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 863c2f4..6d28235 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -26,7 +26,6 @@
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.SharedPreferences;
-import android.content.res.TypedArray;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
@@ -64,12 +63,10 @@
private boolean mSearchMode;
private String mQueryString;
- private String mSearchLabelText;
private SearchView mSearchView;
private final Context mContext;
private final SharedPreferences mPrefs;
- private final boolean mAlwaysShowSearchView;
private Listener mListener;
@@ -102,8 +99,6 @@
mListener = listener;
mActionBar = actionBar;
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- mSearchLabelText = mContext.getString(R.string.search_label);
- mAlwaysShowSearchView = mContext.getResources().getBoolean(R.bool.always_show_search_view);
mShowHomeIcon = mContext.getResources().getBoolean(R.bool.show_home_icon);
@@ -258,8 +253,6 @@
newFlags |= ActionBar.DISPLAY_SHOW_HOME;
newFlags |= ActionBar.DISPLAY_HOME_AS_UP;
newFlags |= ActionBar.DISPLAY_SHOW_CUSTOM;
- } else if (mAlwaysShowSearchView) {
- newFlags |= ActionBar.DISPLAY_SHOW_CUSTOM;
}
mActionBar.setHomeButtonEnabled(mSearchMode);
@@ -271,13 +264,7 @@
private void update() {
if (mSearchMode) {
- if (mAlwaysShowSearchView) {
- // Tablet -- change the app title for the search mode
- mActionBar.setTitle(mSearchLabelText);
- } else {
- // Phone -- search view gets focus
- setFocusOnSearchView();
- }
+ setFocusOnSearchView();
if (mActionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}