Modify provide status busy screen to just show spinner

Bug: 30566541

Test: Manual
https://drive.google.com/open?id=0BxaQ3Ze9jz_cMjA3QV9FMG5WUFk
https://drive.google.com/open?id=0BxaQ3Ze9jz_cbEhDZ2lYRjlLUmM

Change-Id: I381aef4d71300699fbb1ec3d38e4a1c4deec3022
diff --git a/res/layout-land/contacts_unavailable_fragment_content.xml b/res/layout-land/contacts_unavailable_fragment_content.xml
index 234d7c4..35aa90d 100644
--- a/res/layout-land/contacts_unavailable_fragment_content.xml
+++ b/res/layout-land/contacts_unavailable_fragment_content.xml
@@ -14,64 +14,61 @@
      limitations under the License.
 -->
 
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center_horizontal">
+    android:layout_height="match_parent"
+    android:gravity="center_horizontal"
+    android:orientation="vertical">
 
-    <LinearLayout
-        android:orientation="vertical"
+    <ImageView
+        android:id="@+id/empty_image"
+        android:layout_width="@dimen/contacts_no_account_empty_image_width"
+        android:layout_height="wrap_content"
+        android:adjustViewBounds="true"
+        android:scaleType="centerInside"
+        android:src="@drawable/contacts_no_account_empty" />
+
+    <TextView
+        android:id="@+id/message"
+        style="@style/EmptyStateTextStyle"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-
-        <ImageView
-            android:id="@+id/empty_image"
-            android:layout_width="@dimen/contacts_no_account_empty_image_width"
-            android:layout_height="wrap_content"
-            android:scaleType="centerInside"
-            android:adjustViewBounds="true"
-            android:src="@drawable/contacts_no_account_empty"/>
-
-        <TextView
-            android:id="@+id/message"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/contacts_no_account_empty_text_padding_top"
-            android:layout_gravity="center_horizontal"
-            style="@style/EmptyStateTextStyle"/>
-
-        <ProgressBar
-            android:id="@+id/progress"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            style="?android:attr/progressBarStyleHorizontal"
-            android:indeterminate="true"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginTop="12dp" />
-    </LinearLayout>
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="@dimen/contacts_no_account_empty_text_padding_top" />
 
     <LinearLayout
         android:id="@+id/buttons_container"
-        android:orientation="horizontal"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:gravity="center_horizontal">
+        android:gravity="center_horizontal"
+        android:orientation="horizontal">
 
         <Button
             android:id="@+id/add_account_button"
+            style="@style/NoAccountViewButtonStyle"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginEnd="@dimen/contacts_no_account_buttons_margin"
-            android:text="@string/contacts_unavailable_add_account"
-            style="@style/NoAccountViewButtonStyle"/>
+            android:text="@string/contacts_unavailable_add_account" />
 
         <Button
             android:id="@+id/import_contacts_button"
+            style="@style/NoAccountViewButtonStyle"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="@string/contacts_unavailable_import_contacts"
-            style="@style/NoAccountViewButtonStyle"/>
+            android:text="@string/contacts_unavailable_import_contacts" />
     </LinearLayout>
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <ProgressBar
+            android:id="@+id/progress"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:indeterminate="true"
+            android:visibility="gone" />
+    </FrameLayout>
 </LinearLayout>
diff --git a/res/layout/contacts_unavailable_fragment_content.xml b/res/layout/contacts_unavailable_fragment_content.xml
index 860490d..dd04ebe 100644
--- a/res/layout/contacts_unavailable_fragment_content.xml
+++ b/res/layout/contacts_unavailable_fragment_content.xml
@@ -14,61 +14,52 @@
      limitations under the License.
 -->
 
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center_horizontal">
+    android:layout_height="match_parent"
+    android:gravity="center_horizontal"
+    android:orientation="vertical">
 
     <ImageView
         android:id="@+id/empty_image"
         android:layout_width="@dimen/contacts_no_account_empty_image_width"
         android:layout_height="wrap_content"
-        android:scaleType="centerInside"
         android:adjustViewBounds="true"
-        android:src="@drawable/contacts_no_account_empty"/>
+        android:scaleType="centerInside"
+        android:src="@drawable/contacts_no_account_empty" />
 
-    <LinearLayout
-        android:orientation="vertical"
+    <TextView
+        android:id="@+id/message"
+        style="@style/EmptyStateTextStyle"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/contacts_no_account_empty_text_padding_top" />
 
-        <TextView
-            android:id="@+id/message"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/contacts_no_account_empty_text_padding_top"
-            style="@style/EmptyStateTextStyle"/>
+    <Button
+        android:id="@+id/add_account_button"
+        style="@style/NoAccountViewButtonStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/contacts_no_account_empty_button_padding_top"
+        android:text="@string/contacts_unavailable_add_account" />
+
+    <Button
+        android:id="@+id/import_contacts_button"
+        style="@style/NoAccountViewButtonStyle"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/contacts_unavailable_import_contacts" />
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <ProgressBar
             android:id="@+id/progress"
-            android:layout_width="match_parent"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            style="?android:attr/progressBarStyleHorizontal"
+            android:layout_gravity="center"
             android:indeterminate="true"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginTop="12dp" />
-    </LinearLayout>
-
-    <LinearLayout
-        android:orientation="vertical"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content">
-
-        <Button
-            android:id="@+id/add_account_button"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/contacts_no_account_empty_button_padding_top"
-            android:text="@string/contacts_unavailable_add_account"
-            style="@style/NoAccountViewButtonStyle"/>
-
-        <Button
-            android:id="@+id/import_contacts_button"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/contacts_unavailable_import_contacts"
-            style="@style/NoAccountViewButtonStyle"/>
-    </LinearLayout>
+            android:visibility="gone" />
+    </FrameLayout>
 </LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f3e2a04..896d4e6 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -231,9 +231,6 @@
     <dimen name="quickcontact_expanding_button_section_height">48dp</dimen>
     <dimen name="quickcontact_expanding_button_section_padding">8dp</dimen>
 
-    <!-- Top margin of the text message when provider status is busy -->
-    <dimen name="update_contact_list_top_margin">188dp</dimen>
-
     <dimen name="expanding_entry_card_item_icon_height">24dp</dimen>
     <dimen name="expanding_entry_card_item_icon_width">24dp</dimen>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0efa091..8ae0401 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -508,9 +508,6 @@
     <!-- An option in the 'Contact photo' dialog, if there is already a photo [CHAR LIMIT=50] -->
     <string name="pick_new_photo">Select new photo</string>
 
-    <!-- Text shown in the contacts app while the background process updates contacts after a system upgrade [CHAR LIMIT=300] -->
-    <string name="upgrade_in_progress">Contact list is being updated.</string>
-
     <!-- Title shown in the search result activity of contacts app while searching.  [CHAR LIMIT=20] -->
     <string name="search_results_searching">Searching\u2026</string>
 
@@ -920,9 +917,6 @@
     <!-- Content description of photo in photo picker indicating a photo from unknown account is selected. -->
     <string name="photo_view_description_checked_no_info">Photo from unknown account checked</string>
 
-    <!-- Text shown in the contacts app while the background process updates contacts after a locale change [CHAR LIMIT=150]-->
-    <string name="locale_change_in_progress">Contact list is being updated to reflect the change of language.\n\nPlease wait&#8230;</string>
-
     <!-- Left drawer menu item to open contacts assistant cards. [CHAR LIMIT=20]-->
     <string name="menu_assistant">Assistant</string>
 
diff --git a/src/com/android/contacts/list/ContactsUnavailableFragment.java b/src/com/android/contacts/list/ContactsUnavailableFragment.java
index 72e6718..ef57d38 100644
--- a/src/com/android/contacts/list/ContactsUnavailableFragment.java
+++ b/src/com/android/contacts/list/ContactsUnavailableFragment.java
@@ -103,10 +103,9 @@
         }
         if (providerStatus == ProviderStatusCompat.STATUS_EMPTY) {
             updateViewsForEmptyStatus();
-        } else if (providerStatus == ProviderStatusCompat.STATUS_BUSY) {
-            updateViewsForBusyStatus(R.string.upgrade_in_progress);
-        } else if (providerStatus == ProviderStatusCompat.STATUS_CHANGING_LOCALE) {
-            updateViewsForBusyStatus(R.string.locale_change_in_progress);
+        } else if (providerStatus == ProviderStatusCompat.STATUS_BUSY
+                || providerStatus == ProviderStatusCompat.STATUS_CHANGING_LOCALE) {
+            updateViewsForBusyStatus();
         }
     }
 
@@ -122,22 +121,12 @@
 
     /**
      * Update views in the fragment when provider status is busy.
-     *
-     * @param resId resource ID of the string to show in mMessageView.
      */
-    private void updateViewsForBusyStatus(int resId) {
-        mMessageView.setText(resId);
-        mMessageView.setVisibility(View.VISIBLE);
+    private void updateViewsForBusyStatus() {
+        mMessageView.setVisibility(View.GONE);
         mImageView.setVisibility(View.GONE);
         updateButtonVisibility(View.GONE);
         mProgress.setVisibility(View.VISIBLE);
-
-        final ViewGroup.MarginLayoutParams layoutParams =
-                (ViewGroup.MarginLayoutParams) mMessageView.getLayoutParams();
-        final int marginTop =
-                (int) getResources().getDimension(R.dimen.update_contact_list_top_margin);
-        layoutParams.setMargins(0, marginTop, 0, 0);
-        mMessageView.setGravity(Gravity.CENTER_HORIZONTAL);
     }
 
     @Override
@@ -153,11 +142,6 @@
         }
     }
 
-    private boolean areContactsAvailable() {
-        return (mProviderStatus != null) && mProviderStatus.equals(ProviderStatus.STATUS_NORMAL);
-    }
-
-
     private void updateButtonVisibility(int visibility) {
         if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
             mAddAccountButton.setVisibility(visibility);