mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
EPG category backgrounds
This commit is contained in:
parent
6c1ff662e6
commit
40df118034
3 changed files with 40 additions and 5 deletions
|
|
@ -22,6 +22,11 @@ sealed class AppColors private constructor() {
|
||||||
val TransparentBlack25 = Color(0x40000000)
|
val TransparentBlack25 = Color(0x40000000)
|
||||||
val TransparentBlack50 = Color(0x80000000)
|
val TransparentBlack50 = Color(0x80000000)
|
||||||
val TransparentBlack75 = Color(0xBF000000)
|
val TransparentBlack75 = Color(0xBF000000)
|
||||||
|
|
||||||
|
val DarkGreen = Color(0xFF114000)
|
||||||
|
val DarkRed = Color(0xFF400000)
|
||||||
|
val DarkCyan = Color(0xFF21556E)
|
||||||
|
val DarkPurple = Color(0xFF261370)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package com.github.damontecres.wholphin.ui.detail.livetv
|
package com.github.damontecres.wholphin.ui.detail.livetv
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.github.damontecres.wholphin.data.model.BaseItem
|
import com.github.damontecres.wholphin.data.model.BaseItem
|
||||||
|
import com.github.damontecres.wholphin.ui.AppColors
|
||||||
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisode
|
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisode
|
||||||
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
|
import com.github.damontecres.wholphin.ui.isNotNullOrBlank
|
||||||
import com.github.damontecres.wholphin.ui.launchIO
|
import com.github.damontecres.wholphin.ui.launchIO
|
||||||
|
|
@ -113,6 +115,18 @@ class LiveTvViewModel
|
||||||
.getLiveTvPrograms(request)
|
.getLiveTvPrograms(request)
|
||||||
.content.items
|
.content.items
|
||||||
.map { dto ->
|
.map { dto ->
|
||||||
|
val category =
|
||||||
|
if (dto.isKids ?: false) {
|
||||||
|
ProgramCategory.KIDS
|
||||||
|
} else if (dto.isMovie ?: false) {
|
||||||
|
ProgramCategory.MOVIE
|
||||||
|
} else if (dto.isNews ?: false) {
|
||||||
|
ProgramCategory.NEWS
|
||||||
|
} else if (dto.isSports ?: false) {
|
||||||
|
ProgramCategory.SPORTS
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
TvProgram(
|
TvProgram(
|
||||||
id = dto.id,
|
id = dto.id,
|
||||||
channelId = dto.channelId!!,
|
channelId = dto.channelId!!,
|
||||||
|
|
@ -131,7 +145,8 @@ class LiveTvViewModel
|
||||||
},
|
},
|
||||||
isRecording = dto.timerId.isNotNullOrBlank(),
|
isRecording = dto.timerId.isNotNullOrBlank(),
|
||||||
isSeriesRecording = dto.seriesTimerId.isNotNullOrBlank(),
|
isSeriesRecording = dto.seriesTimerId.isNotNullOrBlank(),
|
||||||
isFake = false,
|
isRepeat = dto.isRepeat ?: false,
|
||||||
|
category = category,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +171,8 @@ class LiveTvViewModel
|
||||||
seasonEpisode = null,
|
seasonEpisode = null,
|
||||||
isRecording = false,
|
isRecording = false,
|
||||||
isSeriesRecording = false,
|
isSeriesRecording = false,
|
||||||
isFake = true,
|
isRepeat = false,
|
||||||
|
category = ProgramCategory.FAKE,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
put(channel.id, fakePrograms)
|
put(channel.id, fakePrograms)
|
||||||
|
|
@ -314,5 +330,18 @@ data class TvProgram(
|
||||||
val seasonEpisode: SeasonEpisode?,
|
val seasonEpisode: SeasonEpisode?,
|
||||||
val isRecording: Boolean,
|
val isRecording: Boolean,
|
||||||
val isSeriesRecording: Boolean,
|
val isSeriesRecording: Boolean,
|
||||||
val isFake: Boolean,
|
val isRepeat: Boolean,
|
||||||
)
|
val category: ProgramCategory?,
|
||||||
|
) {
|
||||||
|
val isFake = category == ProgramCategory.FAKE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ProgramCategory(
|
||||||
|
val color: Color?,
|
||||||
|
) {
|
||||||
|
KIDS(AppColors.DarkCyan),
|
||||||
|
NEWS(AppColors.DarkGreen),
|
||||||
|
MOVIE(AppColors.DarkPurple),
|
||||||
|
SPORTS(AppColors.DarkRed),
|
||||||
|
FAKE(null),
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -478,7 +478,8 @@ fun TvGuideGrid(
|
||||||
if (focused) {
|
if (focused) {
|
||||||
MaterialTheme.colorScheme.inverseSurface
|
MaterialTheme.colorScheme.inverseSurface
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)
|
program.category?.color
|
||||||
|
?: MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)
|
||||||
}
|
}
|
||||||
val textColor = MaterialTheme.colorScheme.contentColorFor(background)
|
val textColor = MaterialTheme.colorScheme.contentColorFor(background)
|
||||||
Box(
|
Box(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue