mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Code cleanup
This commit is contained in:
parent
8792c7dcb2
commit
2c2d3900d7
2 changed files with 1 additions and 40 deletions
|
|
@ -172,7 +172,7 @@ class LiveTvViewModel
|
||||||
val fakePrograms =
|
val fakePrograms =
|
||||||
(0..<MAX_HOURS).map {
|
(0..<MAX_HOURS).map {
|
||||||
TvProgram(
|
TvProgram(
|
||||||
id = UUID.randomUUID(), // TODO
|
id = UUID.randomUUID(),
|
||||||
channelId = channel.id,
|
channelId = channel.id,
|
||||||
start = start.plusHours(it),
|
start = start.plusHours(it),
|
||||||
end = start.plusHours(it + 1),
|
end = start.plusHours(it + 1),
|
||||||
|
|
@ -233,8 +233,6 @@ class LiveTvViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cancelRecording(
|
fun cancelRecording(
|
||||||
programIndex: Int,
|
|
||||||
programId: UUID,
|
|
||||||
series: Boolean,
|
series: Boolean,
|
||||||
timerId: String?,
|
timerId: String?,
|
||||||
) {
|
) {
|
||||||
|
|
@ -251,7 +249,6 @@ class LiveTvViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
fun record(
|
fun record(
|
||||||
programIndex: Int,
|
|
||||||
programId: UUID,
|
programId: UUID,
|
||||||
series: Boolean,
|
series: Boolean,
|
||||||
) {
|
) {
|
||||||
|
|
@ -289,31 +286,6 @@ class LiveTvViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun refreshProgram(
|
|
||||||
programIndex: Int,
|
|
||||||
programId: UUID,
|
|
||||||
) = mutex.withLock {
|
|
||||||
loading.setValueOnMain(LoadingState.Loading)
|
|
||||||
// TODO
|
|
||||||
// val program by api.liveTvApi.getProgram(programId.toServerString())
|
|
||||||
// val newProgram =
|
|
||||||
// programs.value?.getOrNull(programIndex)?.copy(
|
|
||||||
// isRecording = program.timerId.isNotNullOrBlank(),
|
|
||||||
// isSeriesRecording = program.seriesTimerId.isNotNullOrBlank(),
|
|
||||||
// )
|
|
||||||
// Timber.v("new program %s", newProgram)
|
|
||||||
// if (newProgram != null) {
|
|
||||||
// programs.value
|
|
||||||
// ?.toMutableList()
|
|
||||||
// ?.apply {
|
|
||||||
// this[programIndex] = newProgram
|
|
||||||
// }?.let {
|
|
||||||
// this@LiveTvViewModel.programs.setValueOnMain(it)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
loading.setValueOnMain(LoadingState.Success)
|
|
||||||
}
|
|
||||||
|
|
||||||
private var focusLoadingJob: Job? = null
|
private var focusLoadingJob: Job? = null
|
||||||
|
|
||||||
fun onFocusChannel(position: RowColumn) {
|
fun onFocusChannel(position: RowColumn) {
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,9 @@ fun TvGuideGrid(
|
||||||
TvGuideGrid(
|
TvGuideGrid(
|
||||||
loading = state is LoadingState.Loading,
|
loading = state is LoadingState.Loading,
|
||||||
channels = channels,
|
channels = channels,
|
||||||
// programList = programs,
|
|
||||||
programs = programs,
|
programs = programs,
|
||||||
channelProgramCount = viewModel.channelProgramCount,
|
channelProgramCount = viewModel.channelProgramCount,
|
||||||
start = viewModel.start,
|
start = viewModel.start,
|
||||||
// channelOffset = fetchedRange.start,
|
|
||||||
onClickChannel = { index, channel ->
|
onClickChannel = { index, channel ->
|
||||||
viewModel.navigationManager.navigateTo(
|
viewModel.navigationManager.navigateTo(
|
||||||
Destination.Playback(
|
Destination.Playback(
|
||||||
|
|
@ -166,7 +164,6 @@ fun TvGuideGrid(
|
||||||
onRecord = { series ->
|
onRecord = { series ->
|
||||||
fetchedItem?.let {
|
fetchedItem?.let {
|
||||||
viewModel.record(
|
viewModel.record(
|
||||||
programIndex = showItemDialog!!,
|
|
||||||
programId = it.id,
|
programId = it.id,
|
||||||
series = series,
|
series = series,
|
||||||
)
|
)
|
||||||
|
|
@ -176,8 +173,6 @@ fun TvGuideGrid(
|
||||||
onCancelRecord = { series ->
|
onCancelRecord = { series ->
|
||||||
fetchedItem?.data?.let {
|
fetchedItem?.data?.let {
|
||||||
viewModel.cancelRecording(
|
viewModel.cancelRecording(
|
||||||
programIndex = showItemDialog!!,
|
|
||||||
programId = it.id,
|
|
||||||
series = series,
|
series = series,
|
||||||
timerId = if (series) it.seriesTimerId else it.timerId,
|
timerId = if (series) it.seriesTimerId else it.timerId,
|
||||||
)
|
)
|
||||||
|
|
@ -190,21 +185,16 @@ fun TvGuideGrid(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const val CHANNEL_COLUMN = -1
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TvGuideGrid(
|
fun TvGuideGrid(
|
||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
channels: List<TvChannel>,
|
channels: List<TvChannel>,
|
||||||
// programList: List<TvProgram>,
|
|
||||||
// programs: Map<UUID, List<TvProgram>>,
|
|
||||||
programs: FetchedPrograms,
|
programs: FetchedPrograms,
|
||||||
channelProgramCount: Map<UUID, Int>,
|
channelProgramCount: Map<UUID, Int>,
|
||||||
start: LocalDateTime,
|
start: LocalDateTime,
|
||||||
onClickChannel: (Int, TvChannel) -> Unit,
|
onClickChannel: (Int, TvChannel) -> Unit,
|
||||||
onClickProgram: (Int, TvProgram) -> Unit,
|
onClickProgram: (Int, TvProgram) -> Unit,
|
||||||
onFocus: (RowColumn) -> Unit,
|
onFocus: (RowColumn) -> Unit,
|
||||||
// channelOffset: Int,
|
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
@ -517,7 +507,6 @@ fun TvGuideGrid(
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
// .scale(if (focused) 1.1f else 1f)
|
|
||||||
.padding(2.dp)
|
.padding(2.dp)
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(
|
.background(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue