mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-23 19:26:50 +00:00
refactor: simplify layout in EpisodeComponents and remove unused modifiers
This commit is contained in:
@@ -4,8 +4,6 @@ import android.Manifest
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -15,7 +13,6 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import hu.bbara.purefin.core.download.DownloadState
|
import hu.bbara.purefin.core.download.DownloadState
|
||||||
@@ -119,9 +116,6 @@ private fun EpisodeScreenInternal(
|
|||||||
episode = episode,
|
episode = episode,
|
||||||
downloadState = downloadState,
|
downloadState = downloadState,
|
||||||
onDownloadClick = onDownloadClick,
|
onDownloadClick = onDownloadClick,
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package hu.bbara.purefin.ui.screen.episode.components
|
package hu.bbara.purefin.ui.screen.episode.components
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -84,6 +83,7 @@ internal fun EpisodeTopBar(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
null -> {}
|
null -> {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -103,7 +103,6 @@ internal fun EpisodeDetails(
|
|||||||
episode: Episode,
|
episode: Episode,
|
||||||
downloadState: DownloadState,
|
downloadState: DownloadState,
|
||||||
onDownloadClick: () -> Unit,
|
onDownloadClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val scheme = MaterialTheme.colorScheme
|
val scheme = MaterialTheme.colorScheme
|
||||||
|
|
||||||
@@ -116,58 +115,56 @@ internal fun EpisodeDetails(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
MediaSynopsis(
|
||||||
MediaSynopsis(
|
synopsis = episode.synopsis
|
||||||
synopsis = episode.synopsis
|
)
|
||||||
|
Row() {
|
||||||
|
MediaResumeButton(
|
||||||
|
text = mediaPlayButtonText(episode.progress, episode.watched),
|
||||||
|
progress = mediaPlaybackProgress(episode.progress),
|
||||||
|
onClick = playAction,
|
||||||
|
modifier = Modifier.sizeIn(maxWidth = 200.dp)
|
||||||
|
)
|
||||||
|
VerticalDivider(
|
||||||
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
|
thickness = 2.dp,
|
||||||
|
modifier = Modifier
|
||||||
|
.height(48.dp)
|
||||||
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
)
|
)
|
||||||
Row() {
|
Row() {
|
||||||
MediaResumeButton(
|
MediaActionButton(
|
||||||
text = mediaPlayButtonText(episode.progress, episode.watched),
|
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||||
progress = mediaPlaybackProgress(episode.progress),
|
iconColor = MaterialTheme.colorScheme.onSurface,
|
||||||
onClick = playAction,
|
icon = when (downloadState) {
|
||||||
modifier = Modifier.sizeIn(maxWidth = 200.dp)
|
is DownloadState.NotDownloaded -> Icons.Outlined.Download
|
||||||
|
is DownloadState.Downloading -> Icons.Outlined.Close
|
||||||
|
is DownloadState.Downloaded -> Icons.Outlined.DownloadDone
|
||||||
|
is DownloadState.Failed -> Icons.Outlined.Download
|
||||||
|
},
|
||||||
|
height = 48.dp,
|
||||||
|
onClick = onDownloadClick
|
||||||
)
|
)
|
||||||
VerticalDivider(
|
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
|
||||||
thickness = 2.dp,
|
|
||||||
modifier = Modifier
|
|
||||||
.height(48.dp)
|
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
|
||||||
)
|
|
||||||
Row() {
|
|
||||||
MediaActionButton(
|
|
||||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
|
||||||
iconColor = MaterialTheme.colorScheme.onSurface,
|
|
||||||
icon = when (downloadState) {
|
|
||||||
is DownloadState.NotDownloaded -> Icons.Outlined.Download
|
|
||||||
is DownloadState.Downloading -> Icons.Outlined.Close
|
|
||||||
is DownloadState.Downloaded -> Icons.Outlined.DownloadDone
|
|
||||||
is DownloadState.Failed -> Icons.Outlined.Download
|
|
||||||
},
|
|
||||||
height = 48.dp,
|
|
||||||
onClick = onDownloadClick
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MediaPlaybackSettings(
|
}
|
||||||
backgroundColor = MaterialTheme.colorScheme.surface,
|
MediaPlaybackSettings(
|
||||||
foregroundColor = MaterialTheme.colorScheme.onSurface,
|
backgroundColor = MaterialTheme.colorScheme.surface,
|
||||||
//TODO fix it
|
foregroundColor = MaterialTheme.colorScheme.onSurface,
|
||||||
audioTrack = "ENG",
|
//TODO fix it
|
||||||
subtitles = "ENG"
|
audioTrack = "ENG",
|
||||||
|
subtitles = "ENG"
|
||||||
|
)
|
||||||
|
if (episode.cast.isNotEmpty()) {
|
||||||
|
Text(
|
||||||
|
text = "Cast",
|
||||||
|
color = scheme.onBackground,
|
||||||
|
fontSize = 18.sp,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
)
|
)
|
||||||
if (episode.cast.isNotEmpty()) {
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
Text(
|
//TODO use it
|
||||||
text = "Cast",
|
|
||||||
color = scheme.onBackground,
|
|
||||||
fontSize = 18.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
|
||||||
//TODO use it
|
|
||||||
// MediaCastRow(
|
// MediaCastRow(
|
||||||
// cast = episode.cast
|
// cast = episode.cast
|
||||||
// )
|
// )
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user