Fix empty state layouts

Bug: 5074806 Fix empty state layouts
Bug: 5109507 During loading group, we show "no groups"
     instead of "loading groups"

- Changed the layout of contacts_unavailable_fragment to Marco's specs.
- Added a secondary message for empty state.
- Aligned layouts of empty state of each specific fragment to match the
  full empty state.
- Removed "No Groups" message when group list fragment is loading the
  group list

Change-Id: I5cea254e5892955906127599374dc706d2aca91b
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 45ce4fe..2f13481 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -16,6 +16,8 @@
 
 package com.android.contacts;
 
+import com.android.contacts.model.AccountTypeManager;
+import com.android.contacts.model.AccountWithDataSet;
 import com.android.i18n.phonenumbers.NumberParseException;
 import com.android.i18n.phonenumbers.PhoneNumberUtil;
 import com.android.i18n.phonenumbers.PhoneNumberUtil.MatchType;
@@ -29,6 +31,8 @@
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 
+import java.util.List;
+
 public class ContactsUtils {
     private static final String TAG = "ContactsUtils";
     private static final String WAIT_SYMBOL_AS_STRING = String.valueOf(PhoneNumberUtils.WAIT);
@@ -166,4 +170,12 @@
                 (CountryDetector) context.getSystemService(Context.COUNTRY_DETECTOR);
         return detector.detectCountry().getCountryIso();
     }
+
+    public static boolean areAccountsAvailable(Context context) {
+        final List<AccountWithDataSet> accounts =
+                AccountTypeManager.getInstance(context).getAccounts(true /* writeable */);
+        return !accounts.isEmpty();
+    }
+
+
 }