Skip to content

Instantly share code, notes, and snippets.

@dbarks1024
Created October 2, 2018 13:30
Show Gist options
  • Save dbarks1024/8b1a5ca312f65f1db717085c4cf17c64 to your computer and use it in GitHub Desktop.
Save dbarks1024/8b1a5ca312f65f1db717085c4cf17c64 to your computer and use it in GitHub Desktop.
override fun onBindSlice(sliceUri: Uri): Slice? {
context ?: return null
return when (sliceUri.path) {
"/toggle" -> {
...
} else {
focusTitleText = context.getString(R.string.focus_title_text_disabled)
focusSubtitleText = context.getString(R.string.focus_subtitle_text_disabled)
}
list(context, sliceUri, ListBuilder.INFINITY) {
header {
title = focusTitleText
subtitle = focusSubtitleText
}
addAction(toggleAction)
}
}
else -> {
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment