Skip to content

Instantly share code, notes, and snippets.

@alexstyl
Last active June 12, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexstyl/a4528e5ab5b254cf6de66eefef940643 to your computer and use it in GitHub Desktop.
Save alexstyl/a4528e5ab5b254cf6de66eefef940643 to your computer and use it in GitHub Desktop.
override fun summaryViewModelOf(viewModels: List<ContactEventNotificationViewModel>): SummaryNotificationViewModel {
val title = NaturalLanguageUtils.joinContacts(strings, contacts, MAX_CONTACTS)
val label = strings.dontForgetToSendWishes()
val lines = arrayListOf<CharSequence>()
viewModels.forEach { contactViewModel ->
val boldedTitle = SpannableString("${contactViewModel.title}\t\t${contactViewModel.label}").apply {
setSpan(StyleSpan(Typeface.BOLD), 0, contactViewModel.title.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
}
lines.add(boldedTitle)
}
return SummaryNotificationViewModel(
NotificationConstants.NOTIFICATION_ID_CONTACTS_SUMMARY,
title, label, lines
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment