Skip to content

Instantly share code, notes, and snippets.

@dbarks1024
Created October 2, 2018 13:30
Show Gist options
  • Save dbarks1024/6396884a525c306c0ed853f65eac1656 to your computer and use it in GitHub Desktop.
Save dbarks1024/6396884a525c306c0ed853f65eac1656 to your computer and use it in GitHub Desktop.
class FocusService : IntentService("FocusService") {
override fun onHandleIntent(intent: Intent?) {
intent ?: return
val toggleState = if (intent.hasExtra(Slice.EXTRA_TOGGLE_STATE)) {
intent.getBooleanExtra(Slice.EXTRA_TOGGLE_STATE, false)
} else {
false
}
FocusManager.focusing = toggleState
val sliceUri = Uri.parse("content://com.bignerdranch.android.icingontheslice/toggle")
contentResolver.notifyChange(sliceUri, null)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment