mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Only show record program button if it hasn't ended
This commit is contained in:
parent
36287be5d4
commit
de22933766
3 changed files with 55 additions and 47 deletions
|
|
@ -147,6 +147,7 @@ fun DvrSchedule(
|
||||||
showDialog?.let { item ->
|
showDialog?.let { item ->
|
||||||
ProgramDialog(
|
ProgramDialog(
|
||||||
item = item,
|
item = item,
|
||||||
|
canRecord = true,
|
||||||
loading = LoadingState.Success,
|
loading = LoadingState.Success,
|
||||||
onDismissRequest = {
|
onDismissRequest = {
|
||||||
showDialog = null
|
showDialog = null
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import java.time.ZoneId
|
||||||
@Composable
|
@Composable
|
||||||
fun ProgramDialog(
|
fun ProgramDialog(
|
||||||
item: BaseItem?,
|
item: BaseItem?,
|
||||||
|
canRecord: Boolean,
|
||||||
loading: LoadingState,
|
loading: LoadingState,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onWatch: () -> Unit,
|
onWatch: () -> Unit,
|
||||||
|
|
@ -138,59 +139,64 @@ fun ProgramDialog(
|
||||||
.padding(top = 8.dp)
|
.padding(top = 8.dp)
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
Row(
|
if (canRecord) {
|
||||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
Row(
|
||||||
) {
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
if (dto.isSeries ?: false) {
|
) {
|
||||||
Button(
|
if (dto.isSeries ?: false) {
|
||||||
onClick = {
|
Button(
|
||||||
if (isSeriesRecording) {
|
onClick = {
|
||||||
onCancelRecord.invoke(true)
|
if (isSeriesRecording) {
|
||||||
} else {
|
onCancelRecord.invoke(true)
|
||||||
onRecord.invoke(true)
|
} else {
|
||||||
}
|
onRecord.invoke(true)
|
||||||
},
|
}
|
||||||
) {
|
},
|
||||||
Row(
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
) {
|
) {
|
||||||
if (isSeriesRecording) {
|
Row(
|
||||||
Icon(
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
imageVector = Icons.Default.Close,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
contentDescription = null,
|
) {
|
||||||
tint = Color.Red,
|
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",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (dto.endDate?.isAfter(LocalDateTime.now()) ?: true) {
|
||||||
Button(
|
// Only show program specific recording button if it hasn't finished yet
|
||||||
onClick = {
|
Button(
|
||||||
if (isRecording) {
|
onClick = {
|
||||||
onCancelRecord.invoke(false)
|
if (isRecording) {
|
||||||
} else {
|
onCancelRecord.invoke(false)
|
||||||
onRecord.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",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ fun TvGuideGrid(
|
||||||
val onDismissRequest = { showItemDialog = null }
|
val onDismissRequest = { showItemDialog = null }
|
||||||
ProgramDialog(
|
ProgramDialog(
|
||||||
item = fetchedItem,
|
item = fetchedItem,
|
||||||
|
canRecord = true,
|
||||||
loading = loadingItem,
|
loading = loadingItem,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
onWatch = {
|
onWatch = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue