don't set timer in past

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-10-22 19:38:50 +02:00
parent 71eb97c443
commit ee445f5722
No known key found for this signature in database
GPG Key ID: F7AA2A8B65B50220

View File

@ -380,6 +380,7 @@ class ConversationInfoActivity :
} }
private fun showTimePicker(selectedDate: Calendar) { private fun showTimePicker(selectedDate: Calendar) {
val currentTime = Calendar.getInstance()
MaterialDialog(this, BottomSheet(WRAP_CONTENT)).show { MaterialDialog(this, BottomSheet(WRAP_CONTENT)).show {
cancelable(false) cancelable(false)
timePicker( timePicker(
@ -388,6 +389,10 @@ class ConversationInfoActivity :
timeCallback = { _, time -> timeCallback = { _, time ->
selectedDate.set(Calendar.HOUR_OF_DAY, time.get(Calendar.HOUR_OF_DAY)) selectedDate.set(Calendar.HOUR_OF_DAY, time.get(Calendar.HOUR_OF_DAY))
selectedDate.set(Calendar.MINUTE, time.get(Calendar.MINUTE)) selectedDate.set(Calendar.MINUTE, time.get(Calendar.MINUTE))
if (selectedDate.timeInMillis < currentTime.timeInMillis) {
selectedDate.set(Calendar.HOUR_OF_DAY,currentTime.get(Calendar.HOUR_OF_DAY))
selectedDate.set(Calendar.MINUTE, currentTime.get(Calendar.MINUTE))
}
reconfigureLobbyTimerView(selectedDate) reconfigureLobbyTimerView(selectedDate)
submitLobbyChanges() submitLobbyChanges()
} }