Skip to content

Instantly share code, notes, and snippets.

@dbarks1024
Created October 23, 2018 13:08
Show Gist options
  • Save dbarks1024/7a65943294bd302780660700486f5ea8 to your computer and use it in GitHub Desktop.
Save dbarks1024/7a65943294bd302780660700486f5ea8 to your computer and use it in GitHub Desktop.
override fun onBindSlice(sliceUri: Uri): Slice? {
context ?: return null
return when (sliceUri.path) {
"/range" -> {
// Display range slice
val primarySliceAction = createPrimarySliceAction()
val nerdLevelIntent = Intent(context, NerdLevelReceiver::class.java).let {
PendingIntent.getBroadcast(context, 0, it, 0)
}
val nerdLevelTitle = context.getString(R.string.nerd_level_title)
list(context, sliceUri, ListBuilder.INFINITY) {
inputRange {
title = nerdLevelTitle
inputAction = nerdLevelIntent
max = 100
value = 50
primaryAction = primarySliceAction
}
}
}
else -> {
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment