/** * Finds the meta-data XML containing the contacts configuration and * reads the picture priority from that file. */ private static String resolveAllContactsNameFromMetaData(Context context, String packageName) { final XmlResourceParser parser = ExternalAccountType.loadContactsXml(context, packageName); if (parser != null) { return loadAllContactsNameFromXml(context, parser, packageName); } return null; }
/** * Returns the name for All Contacts for the specified account type. */ public static String getAllContactsName(Context context, String accountType) { if (context == null) throw new IllegalArgumentException("Context must not be null"); if (accountType == null) return null; return resolveAllContactsName(context, accountType); }
/** * Finds "All Contacts"-Name for the specified account type. */ private static String resolveAllContactsName(Context context, String accountType) { final AccountManager am = AccountManager.get(context); for (AuthenticatorDescription auth : am.getAuthenticatorTypes()) { if (accountType.equals(auth.type)) { return resolveAllContactsNameFromMetaData(context, auth.packageName); } } return null; }
public CharSequence getTitle(Context context) { if (mUngrouped) { final String customAllContactsName = LocalizedNameResolver.getAllContactsName(context, getAccountType()); if (customAllContactsName != null) { return customAllContactsName; } if (mAccountHasGroups) { return context.getText(R.string.display_ungrouped); } else { return context.getText(R.string.display_all_contacts); } } else { final Integer titleRes = getAsInteger(Groups.TITLE_RES); if (titleRes != null) { final String packageName = getAsString(Groups.RES_PACKAGE); return context.getPackageManager().getText(packageName, titleRes, null); } else { return getAsString(Groups.TITLE); } } }