Merge "Show empty detail screen (on tablet) on nothing loaded"
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 1c69ef9..1bab98d 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -1045,6 +1045,8 @@
         @Override
         public void onDetailsLoaded(final ContactLoader.Result result) {
             if (result == null) {
+                // Nothing is loaded. Show empty state.
+                mContactDetailLayoutController.showEmptyState();
                 return;
             }
             // Since {@link FragmentTransaction}s cannot be done in the onLoadFinished() of the
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index daf8229..b2e20ca 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -371,6 +371,10 @@
         mShowStaticPhoto = showPhoto;
     }
 
+    public void showEmptyState() {
+        setData(null, null);
+    }
+
     public void setData(Uri lookupUri, ContactLoader.Result result) {
         mLookupUri = lookupUri;
         mContactData = result;
@@ -412,6 +416,10 @@
 
         if (mContactData == null) {
             mView.setVisibility(View.INVISIBLE);
+            mAllEntries.clear();
+            if (mAdapter != null) {
+                mAdapter.notifyDataSetChanged();
+            }
             return;
         }
 
diff --git a/src/com/android/contacts/detail/ContactDetailLayoutController.java b/src/com/android/contacts/detail/ContactDetailLayoutController.java
index 579d7bf..f9d6443 100644
--- a/src/com/android/contacts/detail/ContactDetailLayoutController.java
+++ b/src/com/android/contacts/detail/ContactDetailLayoutController.java
@@ -233,6 +233,33 @@
         }
     }
 
+    public void showEmptyState() {
+        switch (mLayoutMode) {
+            case FRAGMENT_CAROUSEL: {
+                mFragmentCarousel.enableSwipe(false);
+                mDetailFragment.showEmptyState();
+                break;
+            }
+            case TWO_COLUMN: {
+                mDetailFragment.setShowStaticPhoto(false);
+                mUpdatesFragmentView.setVisibility(View.GONE);
+                mDetailFragment.showEmptyState();
+                break;
+            }
+            case VIEW_PAGER_AND_TAB_CAROUSEL: {
+                mDetailFragment.setShowStaticPhoto(false);
+                mDetailFragment.showEmptyState();
+                mTabCarousel.loadData(null);
+                mTabCarousel.setVisibility(View.GONE);
+                mViewPagerAdapter.enableSwipe(false);
+                mViewPager.setCurrentItem(0);
+                break;
+            }
+            default:
+                throw new IllegalStateException("Invalid LayoutMode " + mLayoutMode);
+        }
+    }
+
     /**
      * Setup the layout for the contact with updates. Pass in the index of the current page to
      * select or null if the current selection should be left as is.