use of android.icu.text.MessageFormat in project android_packages_apps_Settings by omnirom.
the class ZenModeBackend method getStarredContactsSummary.
String getStarredContactsSummary(Context context) {
List<String> starredContacts = getStarredContacts();
int numStarredContacts = starredContacts.size();
MessageFormat msgFormat = new MessageFormat(mContext.getString(R.string.zen_mode_starred_contacts_summary_contacts), Locale.getDefault());
Map<String, Object> args = new HashMap<>();
args.put("count", numStarredContacts);
if (numStarredContacts >= 1) {
args.put("contact_1", starredContacts.get(0));
if (numStarredContacts >= 2) {
args.put("contact_2", starredContacts.get(1));
if (numStarredContacts == 3) {
args.put("contact_3", starredContacts.get(2));
}
}
}
return msgFormat.format(args);
}
Aggregations