Skip to content

Instantly share code, notes, and snippets.

@NezSpencer
Created August 10, 2019 10:02
Show Gist options
  • Save NezSpencer/0acfe534d2d1e46e4964cc9e330b80b9 to your computer and use it in GitHub Desktop.
Save NezSpencer/0acfe534d2d1e46e4964cc9e330b80b9 to your computer and use it in GitHub Desktop.
Utility methods
private fun createClickSpan(action: String) = when (action.toLowerCase()) {
"accepttc" -> CustomClickSpan({ showToast("Terms ACCEPTED!") }, Color.RED)
"opentc" -> CustomClickSpan({ showToast("Terms and condition OPENED!") }, Color.BLUE, true)
else -> throw NotImplementedError("action $action not implemented")
}
private fun showToast(prompt: String) = Toast.makeText(this, prompt, Toast.LENGTH_SHORT).show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment