OSDN Git Service

Add help text when user creates the shortcut but there is no contact.
authorBai Tao <michaelbai@google.com>
Fri, 19 Mar 2010 01:57:03 +0000 (09:57 +0800)
committerBai Tao <michaelbai@google.com>
Fri, 19 Mar 2010 02:04:03 +0000 (10:04 +0800)
bug: 2139262
Change-Id: I04e8da5424f11e1e834e3bab6ea1b4c51b37b385

res/values/strings.xml
src/com/android/contacts/ContactsListActivity.java

index 6a73500..a2193c2 100644 (file)
     <!-- 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>
index d0d6cb2..627caba 100644 (file)
@@ -962,16 +962,22 @@ public class ContactsListActivity extends ListActivity implements View.OnCreateC
         } 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));
                 }