Skip to content

Instantly share code, notes, and snippets.

@dbarks1024
Created October 2, 2018 13:30
Show Gist options
  • Save dbarks1024/d3402471c18628a3a2274fbbeeea1bca to your computer and use it in GitHub Desktop.
Save dbarks1024/d3402471c18628a3a2274fbbeeea1bca to your computer and use it in GitHub Desktop.
override fun onBindSlice(sliceUri: Uri): Slice? {
context ?: return null
return when (sliceUri.path) {
"/toggle" -> {
// Display toggle slice
val toggleAction = createToggleAction()
val focusTitleText: String
val focusSubtitleText: String
if (FocusManager.focusing) {
focusTitleText = context.getString(R.string.focus_title_text_enabled)
focusSubtitleText = context.getString(R.string.focus_subtitle_text_enabled)
} else {
focusTitleText = context.getString(R.string.focus_title_text_disabled)
focusSubtitleText = context.getString(R.string.focus_subtitle_text_disabled)
}
}
else -> {
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment