Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pickerHours.setOnValueChangedListener { picker, oldVal, newVal ->
- timerString = pickerHours.value.toString() + ":" + pickerMinutes.value.toString() + ":" + newVal
- }
- pickerMinutes.setOnValueChangedListener { picker, oldVal, newVal ->
- timerString1 = pickerHours.value.toString() + ":" + newVal + ":" + pickerSeconds.value
- }
- pickerSeconds.setOnValueChangedListener { picker, oldVal, newVal ->
- timerString2 = pickerHours.value.toString() + ":" + pickerMinutes.value.toString() + ":" + newVal
- calculateBtn.setOnClickListener {
- when {
- timerString.isEmpty() && timerString1.isEmpty() && timerString2.isEmpty() && (distance.text.isNotEmpty() && pace.text.isNotEmpty()) ->
- calculatePace(null, distance.text.toString().toDouble(), pace.text.toString())
- distance.text.isEmpty() && (timerString.isNotEmpty() && timerString1.isNotEmpty() && timerString2.isNotEmpty() && pace.text.isNotEmpty()) ->
- calculatePace(time.text.toString(), null, pace.text.toString())
- (timerString.isNotEmpty() && timerString1.isNotEmpty() && timerString2.isNotEmpty() && distance.text.isNotEmpty()) ->
- calculatePace(time.text.toString(), distance.text.toString().toDouble(), null)
- else -> {
- Toast.makeText(this, "Please check fields",
- Toast.LENGTH_SHORT).show()
- }
- }
- }
Add Comment
Please, Sign In to add comment