Only show record program button if it hasn't ended

This commit is contained in:
Damontecres 2025-10-22 12:43:14 -04:00
parent 36287be5d4
commit de22933766
No known key found for this signature in database
3 changed files with 55 additions and 47 deletions

View file

@ -147,6 +147,7 @@ fun DvrSchedule(
showDialog?.let { item ->
ProgramDialog(
item = item,
canRecord = true,
loading = LoadingState.Success,
onDismissRequest = {
showDialog = null

View file

@ -43,6 +43,7 @@ import java.time.ZoneId
@Composable
fun ProgramDialog(
item: BaseItem?,
canRecord: Boolean,
loading: LoadingState,
onDismissRequest: () -> Unit,
onWatch: () -> Unit,
@ -138,59 +139,64 @@ fun ProgramDialog(
.padding(top = 8.dp)
.fillMaxWidth(),
) {
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
if (dto.isSeries ?: false) {
Button(
onClick = {
if (isSeriesRecording) {
onCancelRecord.invoke(true)
} else {
onRecord.invoke(true)
}
},
) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
if (canRecord) {
Row(
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
if (dto.isSeries ?: false) {
Button(
onClick = {
if (isSeriesRecording) {
onCancelRecord.invoke(true)
} else {
onRecord.invoke(true)
}
},
) {
if (isSeriesRecording) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null,
tint = Color.Red,
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (isSeriesRecording) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null,
tint = Color.Red,
)
}
Text(
text = if (isSeriesRecording) "Cancel Series Recording" else "Record Series",
)
}
Text(
text = if (isSeriesRecording) "Cancel Series Recording" else "Record Series",
)
}
}
}
Button(
onClick = {
if (isRecording) {
onCancelRecord.invoke(false)
} else {
onRecord.invoke(false)
if (dto.endDate?.isAfter(LocalDateTime.now()) ?: true) {
// Only show program specific recording button if it hasn't finished yet
Button(
onClick = {
if (isRecording) {
onCancelRecord.invoke(false)
} else {
onRecord.invoke(false)
}
},
) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (isRecording) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null,
tint = Color.Red,
)
}
Text(
text = if (isRecording) "Cancel Recording" else "Record Program",
)
}
}
},
) {
Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (isRecording) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null,
tint = Color.Red,
)
}
Text(
text = if (isRecording) "Cancel Recording" else "Record Program",
)
}
}
}

View file

@ -143,6 +143,7 @@ fun TvGuideGrid(
val onDismissRequest = { showItemDialog = null }
ProgramDialog(
item = fetchedItem,
canRecord = true,
loading = loadingItem,
onDismissRequest = onDismissRequest,
onWatch = {