From 1a8feddd22b777da53baac368077efcc0ac12719 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Thu, 27 Jan 2011 10:24:03 -0800 Subject: [PATCH] Transferring display name logic to GAL provider Bug: 3396886 Change-Id: Ice4da9fd4189387a31d3a5d44ec4dc49bff938da --- .../exchange/provider/ExchangeDirectoryProvider.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/com/android/exchange/provider/ExchangeDirectoryProvider.java b/src/com/android/exchange/provider/ExchangeDirectoryProvider.java index b267da9dd..f3616cc0c 100644 --- a/src/com/android/exchange/provider/ExchangeDirectoryProvider.java +++ b/src/com/android/exchange/provider/ExchangeDirectoryProvider.java @@ -224,7 +224,17 @@ public class ExchangeDirectoryProvider extends ContentProvider { row[i] = R.string.exchange_name; } } else if (column.equals(Directory.DISPLAY_NAME)) { - row[i] = account.name; + // If the account name is an email address, extract + // the domain name and use it as the directory display name + final String accountName = account.name; + int atIndex = accountName.indexOf('@'); + if (atIndex != -1 && atIndex < accountName.length() - 2) { + final char firstLetter = Character.toUpperCase( + accountName.charAt(atIndex + 1)); + row[i] = firstLetter + accountName.substring(atIndex + 2); + } else { + row[i] = account.name; + } } else if (column.equals(Directory.EXPORT_SUPPORT)) { row[i] = Directory.EXPORT_SUPPORT_SAME_ACCOUNT_ONLY; } else if (column.equals(Directory.SHORTCUT_SUPPORT)) {