set timer for lobby

Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
sowjanyakch 2024-10-22 19:37:43 +02:00 committed by backportbot[bot]
parent 39fd7454c4
commit cbe9305497

View file

@ -31,7 +31,8 @@ import autodagger.AutoInjector
import com.afollestad.materialdialogs.LayoutMode.WRAP_CONTENT import com.afollestad.materialdialogs.LayoutMode.WRAP_CONTENT
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.afollestad.materialdialogs.datetime.dateTimePicker import com.afollestad.materialdialogs.datetime.datePicker
import com.afollestad.materialdialogs.datetime.timePicker
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.nextcloud.android.common.ui.theme.utils.ColorRole import com.nextcloud.android.common.ui.theme.utils.ColorRole
@ -354,22 +355,17 @@ class ConversationInfoActivity :
reconfigureLobbyTimerView() reconfigureLobbyTimerView()
binding.webinarInfoView.startTimeButton.setOnClickListener { binding.webinarInfoView.startTimeButton.setOnClickListener {
// First, show the calendar dialog
MaterialDialog(this, BottomSheet(WRAP_CONTENT)).show { MaterialDialog(this, BottomSheet(WRAP_CONTENT)).show {
val currentTimeCalendar = Calendar.getInstance() val currentTimeCalendar = Calendar.getInstance()
if (conversation!!.lobbyTimer != 0L) { if (conversation!!.lobbyTimer != 0L) {
currentTimeCalendar.timeInMillis = conversation!!.lobbyTimer * DateConstants.SECOND_DIVIDER currentTimeCalendar.timeInMillis = conversation!!.lobbyTimer * DateConstants.SECOND_DIVIDER
} }
dateTimePicker( datePicker { _, date ->
minDateTime = Calendar.getInstance(), // After selecting the date, now show the time picker
requireFutureDateTime = true, showTimePicker(date)
currentDateTime = currentTimeCalendar,
show24HoursView = true,
dateTimeCallback = { _, dateTime ->
reconfigureLobbyTimerView(dateTime)
submitLobbyChanges()
} }
)
} }
} }
@ -383,6 +379,22 @@ class ConversationInfoActivity :
} }
} }
private fun showTimePicker(selectedDate: Calendar) {
MaterialDialog(this, BottomSheet(WRAP_CONTENT)).show {
cancelable(false)
timePicker(
currentTime = Calendar.getInstance(),
show24HoursView = true,
timeCallback = { _, time ->
selectedDate.set(Calendar.HOUR_OF_DAY, time.get(Calendar.HOUR_OF_DAY))
selectedDate.set(Calendar.MINUTE, time.get(Calendar.MINUTE))
reconfigureLobbyTimerView(selectedDate)
submitLobbyChanges()
}
)
}
}
private fun webinaryRoomType(conversation: ConversationModel): Boolean { private fun webinaryRoomType(conversation: ConversationModel): Boolean {
return conversation.type == ConversationEnums.ConversationType.ROOM_GROUP_CALL || return conversation.type == ConversationEnums.ConversationType.ROOM_GROUP_CALL ||
conversation.type == ConversationEnums.ConversationType.ROOM_PUBLIC_CALL conversation.type == ConversationEnums.ConversationType.ROOM_PUBLIC_CALL