Skip to content

Instantly share code, notes, and snippets.

@TheDancerCodes
Last active July 23, 2020 17:33
Show Gist options
  • Save TheDancerCodes/6cafca8291e24b717c3a6d5607001c5d to your computer and use it in GitHub Desktop.
Save TheDancerCodes/6cafca8291e24b717c3a6d5607001c5d to your computer and use it in GitHub Desktop.
tipSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(p0: SeekBar?, progress: Int, p2: Boolean) {
// 2. Print out the int value of progress that is coming through.
Log.i(TAG, "onProgressChanged $progress")
// 3. Update value of the tip as we interact with the SeekBar
// Kotlin - replace this with the actual integer progress and append %
// Convert the progress value to a string and concatenate a % symbol after the value
tvTipPercent.text = "$progress%"
// 9. Call method for SeekBar functionality to work
computeTipAndTotal()
}
override fun onStartTrackingTouch(p0: SeekBar?) {}
override fun onStopTrackingTouch(p0: SeekBar?) {}
})
override fun onStopTrackingTouch(p0: SeekBar?) {}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment