Add help text when user creates the shortcut but there is no contact.
bug: 2139262
Change-Id: I04e8da5424f11e1e834e3bab6ea1b4c51b37b385
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6a73500..a2193c2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -414,6 +414,12 @@
<!-- Dialog title displayed when loading a phone number from the SIM card for speed dial -->
<string name="simContacts_title">SIM card contacts</string>
+ <!-- Displayed full screen when the user want to create a shortcut, but there is no contacts, and contact syncing is enabled -->
+ <string name="noContactsHelpTextWithSyncForCreateShortcut">"You don't have any contacts to display. (If you just added an account, it can take a few minutes to sync contacts.)"</string>
+
+ <!-- Displayed full screen when the user want to create a shortcut, but there is no contacts -->
+ <string name="noContactsHelpTextForCreateShortcut">"You don't have any contacts to display."</string>
+
<!-- Displayed full screen when the user has no contacts and they are displaying the My Contacts group, and contact syncing is disabled -->
<string name="noContactsHelpText">"You don't have any contacts to display.\n\nTo add contacts, press <font fgcolor="#ffffffff"><b>Menu</b></font> and touch:\n
\n<li><font fgcolor="#ffffffff"><b>Accounts</b></font> to add or configure an account with contacts you can sync to the phone\n</li>
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index d0d6cb2..627caba 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -962,16 +962,22 @@
} else {
boolean hasSim = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
.hasIccCard();
-
- if (hasSim) {
- if (mSyncEnabled) {
+ boolean createShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction());
+ if (mSyncEnabled) {
+ if (createShortcut) {
+ // Help text is the same no matter whether there is SIM or not.
+ empty.setText(getText(R.string.noContactsHelpTextWithSyncForCreateShortcut));
+ } else if (hasSim) {
empty.setText(getText(R.string.noContactsHelpTextWithSync));
} else {
- empty.setText(getText(R.string.noContactsHelpText));
+ empty.setText(getText(R.string.noContactsNoSimHelpTextWithSync));
}
} else {
- if (mSyncEnabled) {
- empty.setText(getText(R.string.noContactsNoSimHelpTextWithSync));
+ if (createShortcut) {
+ // Help text is the same no matter whether there is SIM or not.
+ empty.setText(getText(R.string.noContactsHelpTextForCreateShortcut));
+ } else if (hasSim) {
+ empty.setText(getText(R.string.noContactsHelpText));
} else {
empty.setText(getText(R.string.noContactsNoSimHelpText));
}