Skip to content

Instantly share code, notes, and snippets.

@saurabhkpatel
Last active August 9, 2018 07:15
Show Gist options
  • Save saurabhkpatel/d7ea4ad3266129483c9679c61e0f3984 to your computer and use it in GitHub Desktop.
Save saurabhkpatel/d7ea4ad3266129483c9679c61e0f3984 to your computer and use it in GitHub Desktop.
private fun createSliceWithHeaderAndRow(sliceUri: Uri): Slice? {
return list(context, sliceUri, ListBuilder.INFINITY) {
header {
title = "Get a ride."
subtitle = "Ride in 4 min."
summary = "Work in 45 min | Home in 15 min."
}
row {
title = "Home"
subtitle = "15 miles | 15 min | $15.23"
primaryAction = createActivityAction(Intent(context, MainActivity::class.java), R.drawable.ic_work_24, SliceHints.ICON_IMAGE)
}
row {
title = "Work"
subtitle = "45 miles | 45 min | $15.23"
addEndItem(createActivityAction(Intent(context, MainActivity::class.java), R.drawable.ic_work_24, SliceHints.ICON_IMAGE))
}
row {
title = "Slice Row"
subtitle = "contains start and end items"
primaryAction = createActivityAction(Intent(context, MainActivity::class.java), R.drawable.ic_work_24, SliceHints.ICON_IMAGE)
setTitleItem(createActivityAction(Intent(context, MainActivity::class.java), R.drawable.ic_pizza_slice_24, SliceHints.ICON_IMAGE))
}
setAccentColor(R.color.colorAccent)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment