Merge "Import translations. DO NOT MERGE" into jb-dev
diff --git a/res/layout-sw580dp-w940dp/group_browse_list_account_header.xml b/res/layout-sw580dp-w940dp/group_browse_list_account_header.xml
new file mode 100644
index 0000000..af60c79
--- /dev/null
+++ b/res/layout-sw580dp-w940dp/group_browse_list_account_header.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <!-- Only visible when it is the first element in the list. -->
+    <View
+        android:id="@+id/header_extra_top_padding"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/list_header_extra_top_padding" />
+
+    <include layout="@layout/group_account_header_horizontal" />
+
+</LinearLayout>
diff --git a/res/layout-sw580dp/group_browse_list_account_header.xml b/res/layout-sw580dp/group_browse_list_account_header.xml
new file mode 100644
index 0000000..cca6ed9
--- /dev/null
+++ b/res/layout-sw580dp/group_browse_list_account_header.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <!-- Only visible when it is the first element in the list. -->
+    <View
+        android:id="@+id/header_extra_top_padding"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/list_header_extra_top_padding" />
+
+    <include layout="@layout/group_account_header_vertical" />
+
+</LinearLayout>
diff --git a/res/layout-sw580dp/search_header.xml b/res/layout-sw580dp/search_header.xml
index e543883..cf09190 100644
--- a/res/layout-sw580dp/search_header.xml
+++ b/res/layout-sw580dp/search_header.xml
@@ -14,29 +14,11 @@
      limitations under the License.
 -->
 
-<RelativeLayout
+<TextView
     xmlns:android="http://schemas.android.com/apk/res/android"
-    style="DirectoryHeader"
-    android:layout_width="match_parent"
-    android:layout_height="56dip">
-    <TextView
-        android:id="@+id/totalContactsText"
-        android:layout_height="wrap_content"
-        android:layout_width="wrap_content"
-        android:layout_centerVertical="true"
-        android:layout_alignParentLeft="true"
-        android:layout_marginLeft="8dip"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorTertiary"
-        android:textStyle="bold" />
-
-    <ProgressBar
-        android:id="@+id/progress"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        style="?android:attr/progressBarStyleSmall"
-        android:layout_alignParentRight="true"
-        android:layout_centerVertical="true"
-        android:layout_marginRight="10dip" />
-
-</RelativeLayout>
+    android:id="@+id/totalContactsText"
+    android:minHeight="@dimen/contact_filter_header_min_height"
+    android:paddingTop="10dip"
+    android:textAppearance="?android:attr/textAppearanceSmall"
+    android:textColor="?android:attr/textColorTertiary"
+    android:textStyle="bold" />
diff --git a/res/layout-sw680dp/group_browse_list_account_header.xml b/res/layout-sw680dp/group_browse_list_account_header.xml
new file mode 100644
index 0000000..af60c79
--- /dev/null
+++ b/res/layout-sw680dp/group_browse_list_account_header.xml
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <!-- Only visible when it is the first element in the list. -->
+    <View
+        android:id="@+id/header_extra_top_padding"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/list_header_extra_top_padding" />
+
+    <include layout="@layout/group_account_header_horizontal" />
+
+</LinearLayout>
diff --git a/res/layout/contact_list_content.xml b/res/layout/contact_list_content.xml
index 05f1930..b268102 100644
--- a/res/layout/contact_list_content.xml
+++ b/res/layout/contact_list_content.xml
@@ -33,21 +33,32 @@
         android:id="@+id/account_filter_header_container"
         layout="@layout/account_filter_header" />
 
-    <view
-        class="com.android.contacts.widget.PinnedHeaderListView"
-        android:id="@android:id/list"
+    <FrameLayout
         android:layout_width="match_parent"
         android:layout_height="0dip"
-        android:layout_marginLeft="?attr/contact_browser_list_padding_left"
-        android:layout_marginRight="?attr/contact_browser_list_padding_right"
-        android:fastScrollEnabled="true"
-        android:fadingEdge="none"
-        android:layout_weight="1" />
+        android:layout_weight="1" >
+        <view
+            class="com.android.contacts.widget.PinnedHeaderListView"
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="?attr/contact_browser_list_padding_left"
+            android:layout_marginRight="?attr/contact_browser_list_padding_right"
+            android:fastScrollEnabled="true"
+            android:fadingEdge="none" />
+        <ProgressBar
+            android:id="@+id/search_progress"
+            style="?android:attr/progressBarStyleLarge"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:visibility="gone" />
+    </FrameLayout>
 
-   <ViewStub
-       android:id="@+id/footer_stub"
-       android:layout="@layout/footer_panel"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content" />
+    <ViewStub
+        android:id="@+id/footer_stub"
+        android:layout="@layout/footer_panel"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content" />
 
 </LinearLayout>
diff --git a/res/layout/group_account_header_horizontal.xml b/res/layout/group_account_header_horizontal.xml
new file mode 100644
index 0000000..5043f25
--- /dev/null
+++ b/res/layout/group_account_header_horizontal.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?attr/list_item_header_height"
+    android:layout_marginLeft="?attr/list_item_padding_left"
+    android:layout_marginRight="?attr/list_item_padding_right"
+    android:background="@drawable/list_section_divider_holo_custom"
+    android:orientation="horizontal">
+
+    <TextView
+        android:id="@+id/account_type"
+        android:layout_width="0px"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="?attr/list_item_header_text_indent"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="@color/people_app_theme_color"
+        android:textStyle="bold"
+        android:textAllCaps="true"
+        android:singleLine="true"/>
+
+    <!-- TODO: Should use correct color with a correct name (content should be same).
+         can use "?android:attr/textColorTertiary" -->
+    <TextView
+        android:id="@+id/account_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:textColor="@color/contact_count_text_color"
+        android:textSize="12sp"
+        android:singleLine="true"
+        android:ellipsize="middle" />
+</LinearLayout>
diff --git a/res/layout/group_account_header_vertical.xml b/res/layout/group_account_header_vertical.xml
new file mode 100644
index 0000000..8edbb8b
--- /dev/null
+++ b/res/layout/group_account_header_vertical.xml
@@ -0,0 +1,52 @@
+<?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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?attr/list_item_header_height"
+    android:layout_marginLeft="?attr/list_item_padding_left"
+    android:layout_marginRight="?attr/list_item_padding_right"
+    android:paddingBottom="4dip"
+    android:background="@drawable/list_section_divider_holo_custom"
+    android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/account_type"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="?attr/list_item_header_text_indent"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="@color/people_app_theme_color"
+        android:textStyle="bold"
+        android:textAllCaps="true"
+        android:singleLine="true"/>
+
+    <!-- TODO: Should use correct color with a correct name (content should be same).
+         can use "?android:attr/textColorTertiary" -->
+    <TextView
+        android:id="@+id/account_name"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="?attr/list_item_header_text_indent"
+        android:textColor="@color/contact_count_text_color"
+        android:textSize="12sp"
+        android:singleLine="true"
+        android:ellipsize="middle" />
+</LinearLayout>
diff --git a/res/layout/group_browse_list_account_header.xml b/res/layout/group_browse_list_account_header.xml
index 78e0639..7bfbd07 100644
--- a/res/layout/group_browse_list_account_header.xml
+++ b/res/layout/group_browse_list_account_header.xml
@@ -26,39 +26,6 @@
         android:layout_width="match_parent"
         android:layout_height="@dimen/list_header_extra_top_padding" />
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:minHeight="?attr/list_item_header_height"
-        android:layout_marginLeft="?attr/list_item_padding_left"
-        android:layout_marginRight="?attr/list_item_padding_right"
-        android:background="@drawable/list_section_divider_holo_custom"
-        android:orientation="horizontal">
-
-        <TextView
-            android:id="@+id/account_type"
-            android:layout_width="0px"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:layout_gravity="center_vertical"
-            android:paddingLeft="?attr/list_item_header_text_indent"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="@color/people_app_theme_color"
-            android:textStyle="bold"
-            android:textAllCaps="true"
-            android:singleLine="true"/>
-
-        <!-- TODO: Shold use correct color with a correct name (content should be same).
-             can use "?android:attr/textColorTertiary" -->
-        <TextView
-            android:id="@+id/account_name"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:textColor="@color/contact_count_text_color"
-            android:textSize="12sp"
-            android:singleLine="true"
-            android:ellipsize="middle" />
-    </LinearLayout>
+    <include layout="@layout/group_account_header_horizontal" />
 
 </LinearLayout>
diff --git a/res/layout/search_header.xml b/res/layout/search_header.xml
index b1ba00f..44e4632 100644
--- a/res/layout/search_header.xml
+++ b/res/layout/search_header.xml
@@ -14,28 +14,10 @@
      limitations under the License.
 -->
 
-<RelativeLayout
+<TextView
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
+    android:id="@+id/totalContactsText"
     android:minHeight="@dimen/contact_filter_header_min_height"
-    android:background="@android:color/transparent">
-    <TextView
-        android:id="@+id/totalContactsText"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerVertical="true"
-        android:layout_alignParentLeft="true"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorSecondary" />
-
-    <ProgressBar
-        android:id="@+id/progress"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_toRightOf="@id/totalContactsText"
-        style="?android:attr/progressBarStyleSmall"
-        android:layout_alignParentRight="true"
-        android:layout_centerVertical="true" />
-
-</RelativeLayout>
+    android:paddingTop="10dip"
+    android:textAppearance="?android:attr/textAppearanceSmall"
+    android:textColor="?android:attr/textColorSecondary" />
\ No newline at end of file
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 6e3cc05..5c79c45 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -34,7 +34,6 @@
 import android.widget.Button;
 import android.widget.FrameLayout;
 import android.widget.ListView;
-import android.widget.ProgressBar;
 import android.widget.TextView;
 
 /**
@@ -54,6 +53,8 @@
     private Button mProfileMessage;
     private FrameLayout mMessageContainer;
     private TextView mProfileTitle;
+    private View mSearchProgress;
+    private TextView mSearchProgressText;
 
     private View mPaddingView;
 
@@ -117,12 +118,21 @@
         headerContainer.addView(mSearchHeaderView);
         getListView().addHeaderView(headerContainer, null, false);
         checkHeaderViewVisibility();
+
+        mSearchProgress = getView().findViewById(R.id.search_progress);
+        mSearchProgressText = (TextView) mSearchHeaderView.findViewById(R.id.totalContactsText);
     }
 
     @Override
     protected void setSearchMode(boolean flag) {
         super.setSearchMode(flag);
         checkHeaderViewVisibility();
+        if (!flag) showSearchProgress(false);
+    }
+
+    /** Show or hide the directory-search progress spinner. */
+    private void showSearchProgress(boolean show) {
+        mSearchProgress.setVisibility(show ? View.VISIBLE : View.GONE);
     }
 
     private void checkHeaderViewVisibility() {
@@ -203,19 +213,17 @@
             // In search mode we only display the header if there is nothing found
             if (TextUtils.isEmpty(getQueryString()) || !adapter.areAllPartitionsEmpty()) {
                 mSearchHeaderView.setVisibility(View.GONE);
+                showSearchProgress(false);
             } else {
-                TextView textView = (TextView) mSearchHeaderView.findViewById(
-                        R.id.totalContactsText);
-                ProgressBar progress = (ProgressBar) mSearchHeaderView.findViewById(
-                        R.id.progress);
                 mSearchHeaderView.setVisibility(View.VISIBLE);
                 if (adapter.isLoading()) {
-                    textView.setText(R.string.search_results_searching);
-                    progress.setVisibility(View.VISIBLE);
+                    mSearchProgressText.setText(R.string.search_results_searching);
+                    showSearchProgress(true);
                 } else {
-                    textView.setText(R.string.listFoundAllContactsZero);
-                    textView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
-                    progress.setVisibility(View.GONE);
+                    mSearchProgressText.setText(R.string.listFoundAllContactsZero);
+                    mSearchProgressText.sendAccessibilityEvent(
+                            AccessibilityEvent.TYPE_VIEW_SELECTED);
+                    showSearchProgress(false);
                 }
             }
             showEmptyUserProfile(false);