diff --git a/app/src/main/java/com/acitelight/aether/MainActivity.kt b/app/src/main/java/com/acitelight/aether/MainActivity.kt index abb09cb..63bc6f7 100644 --- a/app/src/main/java/com/acitelight/aether/MainActivity.kt +++ b/app/src/main/java/com/acitelight/aether/MainActivity.kt @@ -3,8 +3,6 @@ package com.acitelight.aether import android.app.Activity import android.content.Intent import androidx.compose.material.icons.Icons -import android.graphics.drawable.Icon -import android.net.http.SslCertificate.saveState import android.os.Bundle import android.view.WindowManager import androidx.activity.ComponentActivity @@ -16,36 +14,26 @@ import androidx.compose.animation.slideOutVertically import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.automirrored.filled.CompareArrows import androidx.compose.material.icons.filled.* import androidx.compose.material3.Card -import androidx.compose.material3.CardColors import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold -import androidx.compose.material3.SegmentedButtonDefaults.Icon -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalView -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat @@ -60,22 +48,18 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navArgument -import com.acitelight.aether.view.ComicGridView -import com.acitelight.aether.view.ComicPageView -import com.acitelight.aether.view.ComicScreen -import com.acitelight.aether.view.HomeScreen -import com.acitelight.aether.view.MeScreen -import com.acitelight.aether.view.TransmissionScreen -import com.acitelight.aether.view.VideoPlayer -import com.acitelight.aether.view.VideoScreen +import com.acitelight.aether.view.pages.ComicGridView +import com.acitelight.aether.view.pages.ComicPageView +import com.acitelight.aether.view.pages.ComicScreen +import com.acitelight.aether.view.pages.HomeScreen +import com.acitelight.aether.view.pages.MeScreen +import com.acitelight.aether.view.pages.TransmissionScreen +import com.acitelight.aether.view.pages.VideoPlayer +import com.acitelight.aether.view.pages.VideoScreen import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext -import okhttp3.OkHttpClient -import okhttp3.Request @AndroidEntryPoint class MainActivity : ComponentActivity() { diff --git a/app/src/main/java/com/acitelight/aether/view/VideoPlayer.kt b/app/src/main/java/com/acitelight/aether/view/VideoPlayer.kt deleted file mode 100644 index f6a4a39..0000000 --- a/app/src/main/java/com/acitelight/aether/view/VideoPlayer.kt +++ /dev/null @@ -1,171 +0,0 @@ -package com.acitelight.aether.view - -import android.app.Activity -import android.content.Context -import android.content.pm.ActivityInfo -import android.content.res.Configuration -import android.media.AudioManager -import android.view.View -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.animation.slideInVertically -import androidx.compose.animation.slideOutVertically -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.material.icons.filled.Pause -import androidx.compose.material.icons.filled.PlayArrow -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.Slider -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import androidx.compose.ui.viewinterop.AndroidView -import androidx.media3.exoplayer.ExoPlayer -import androidx.media3.ui.PlayerView -import androidx.navigation.NavHostController -import com.acitelight.aether.viewModel.VideoPlayerViewModel - -import androidx.compose.foundation.gestures.detectDragGestures -import androidx.compose.foundation.gestures.detectTapGestures -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.heightIn -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.layout.wrapContentWidth -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.LazyRow -import androidx.compose.foundation.lazy.items -import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.automirrored.filled.VolumeUp -import androidx.compose.material.icons.filled.Brightness4 -import androidx.compose.material.icons.filled.FastForward -import androidx.compose.material.icons.filled.Info -import androidx.compose.material.icons.filled.Lock -import androidx.compose.material.icons.filled.LockOpen -import androidx.compose.material.icons.filled.Share -import androidx.compose.material.icons.filled.Star -import androidx.compose.material.icons.filled.ThumbDown -import androidx.compose.material.icons.filled.ThumbUp -import androidx.compose.material3.Card -import androidx.compose.material3.CardColors -import androidx.compose.material3.CardDefaults -import androidx.compose.material3.DividerDefaults -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.SliderDefaults -import androidx.compose.material3.Tab -import androidx.compose.material3.TabRow -import androidx.compose.runtime.DisposableEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableFloatStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.draw.alpha -import androidx.compose.ui.draw.clip -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Brush -import androidx.compose.ui.graphics.Shadow -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection -import androidx.compose.ui.input.nestedscroll.NestedScrollSource -import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.layout.onGloballyPositioned -import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.TextUnit -import androidx.compose.ui.unit.sp -import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel -import androidx.lifecycle.viewModelScope -import androidx.media3.common.text.Cue -import androidx.media3.common.util.UnstableApi -import coil3.ImageLoader -import coil3.compose.AsyncImage -import coil3.request.ImageRequest -import com.acitelight.aether.Global -import com.acitelight.aether.ToggleFullScreen -import com.acitelight.aether.model.KeyImage -import com.acitelight.aether.model.Video -import kotlinx.coroutines.launch -import kotlin.math.abs -import kotlin.math.exp -import kotlin.math.ln -import kotlin.math.pow - -fun formatTime(ms: Long): String { - if (ms <= 0) return "00:00:00" - val totalSeconds = ms / 1000 - val hours = totalSeconds / 3600 - val minutes = (totalSeconds % 3600) / 60 - val seconds = totalSeconds % 60 - return String.format("%02d:%02d:%02d", hours, minutes, seconds) -} - -fun moveBrit(db: Float, activity: Activity, videoPlayerViewModel: VideoPlayerViewModel) { - val attr = activity.window.attributes - - val britUi = (videoPlayerViewModel.brit - db * 0.002f).coerceIn(0f, 1f) - videoPlayerViewModel.brit = britUi - - val gamma = 2.2f - val britSystem = britUi.pow(gamma).coerceIn(0.001f, 1f) - - attr.screenBrightness = britSystem - activity.window.attributes = attr -} - -@Composable -fun VideoPlayer( - videoPlayerViewModel: VideoPlayerViewModel = hiltViewModel(), - videoId: String, - navController: NavHostController -) { - val context = LocalContext.current - val activity = (context as? Activity)!! - - DisposableEffect(Unit) { - onDispose { - activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED - } - } - - videoPlayerViewModel.init(videoId) - - activity.requestedOrientation = - if(videoPlayerViewModel.isLandscape) - ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE - else - ActivityInfo.SCREEN_ORIENTATION_PORTRAIT - - if (videoPlayerViewModel.startPlaying) { - if (videoPlayerViewModel.isLandscape) { - VideoPlayerLandscape(videoPlayerViewModel) - } else { - VideoPlayerPortal(videoPlayerViewModel, navController) - } - } -} diff --git a/app/src/main/java/com/acitelight/aether/view/BiliStyle.kt b/app/src/main/java/com/acitelight/aether/view/components/BiliStyle.kt similarity index 98% rename from app/src/main/java/com/acitelight/aether/view/BiliStyle.kt rename to app/src/main/java/com/acitelight/aether/view/components/BiliStyle.kt index 36d42d4..1decfd3 100644 --- a/app/src/main/java/com/acitelight/aether/view/BiliStyle.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/BiliStyle.kt @@ -1,4 +1,4 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box diff --git a/app/src/main/java/com/acitelight/aether/view/BookmarkPop.kt b/app/src/main/java/com/acitelight/aether/view/components/BookmarkPop.kt similarity index 97% rename from app/src/main/java/com/acitelight/aether/view/BookmarkPop.kt rename to app/src/main/java/com/acitelight/aether/view/components/BookmarkPop.kt index 749e8a0..4af1baa 100644 --- a/app/src/main/java/com/acitelight/aether/view/BookmarkPop.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/BookmarkPop.kt @@ -1,4 +1,4 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth diff --git a/app/src/main/java/com/acitelight/aether/view/components/ComicCard.kt b/app/src/main/java/com/acitelight/aether/view/components/ComicCard.kt new file mode 100644 index 0000000..779ecd1 --- /dev/null +++ b/app/src/main/java/com/acitelight/aether/view/components/ComicCard.kt @@ -0,0 +1,129 @@ +package com.acitelight.aether.view.components + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.layout.ModifierLocalBeyondBoundsLayout +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.NavHostController +import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import com.acitelight.aether.model.Comic +import com.acitelight.aether.view.pages.toHex +import com.acitelight.aether.viewModel.ComicScreenViewModel + + +@Composable +fun ComicCard( + comic: Comic, + navController: NavHostController, + comicScreenViewModel: ComicScreenViewModel +) { + Card( + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface.copy(0.65f)), + shape = RoundedCornerShape(8.dp), + modifier = Modifier + .fillMaxWidth() + .wrapContentHeight(), + onClick = { + val route = "comic_grid_route/${comic.id.toHex()}" + navController.navigate(route) + } + ) { + Column( + modifier = Modifier + .fillMaxWidth() + ) { + Box(modifier = Modifier.fillMaxSize()) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .data(comic.getPage(0, comicScreenViewModel.apiClient)) + .memoryCacheKey("${comic.id}/${0}") + .diskCacheKey("${comic.id}/${0}") + .build(), + contentDescription = null, + imageLoader = comicScreenViewModel.imageLoader!!, + modifier = Modifier + .fillMaxSize() + .clip(RoundedCornerShape(8.dp)), + contentScale = ContentScale.Crop, + ) + + Box( + Modifier + .fillMaxWidth() + .height(24.dp) + .background( + brush = Brush.verticalGradient( + colors = listOf( + Color.Transparent, + Color.Black.copy(alpha = 0.45f) + ) + ) + ) + .align(Alignment.BottomCenter) + ) + { + Text( + modifier = Modifier + .align(Alignment.BottomEnd) + .padding(2.dp), + fontSize = 12.sp, + text = "${comic.comic.list.size} Pages", + fontWeight = FontWeight.Bold, + color = Color.White, + maxLines = 1 + ) + } + } + Text( + text = comic.comic.comic_name, + fontSize = 14.sp, + lineHeight = 17.sp, + fontWeight = FontWeight.Bold, + maxLines = 2, + modifier = Modifier.padding(4.dp) + ) + + Box(Modifier.padding(4.dp).fillMaxWidth()){ + Text( + text = "Id: ${comic.id}", + fontSize = 12.sp, + lineHeight = 14.sp, + maxLines = 1, + modifier = Modifier.align(Alignment.CenterStart) + ) + + Text( + text = comic.comic.author, + fontSize = 12.sp, + lineHeight = 14.sp, + maxLines = 1, + modifier = Modifier.align(Alignment.CenterEnd) + ) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/acitelight/aether/view/HorizontalGallery.kt b/app/src/main/java/com/acitelight/aether/view/components/HorizontalGallery.kt similarity index 97% rename from app/src/main/java/com/acitelight/aether/view/HorizontalGallery.kt rename to app/src/main/java/com/acitelight/aether/view/components/HorizontalGallery.kt index d00fe4f..ad23779 100644 --- a/app/src/main/java/com/acitelight/aether/view/HorizontalGallery.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/HorizontalGallery.kt @@ -1,4 +1,4 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues diff --git a/app/src/main/java/com/acitelight/aether/view/MiniPlaylistCard.kt b/app/src/main/java/com/acitelight/aether/view/components/MiniPlaylistCard.kt similarity index 96% rename from app/src/main/java/com/acitelight/aether/view/MiniPlaylistCard.kt rename to app/src/main/java/com/acitelight/aether/view/components/MiniPlaylistCard.kt index d61f875..763982d 100644 --- a/app/src/main/java/com/acitelight/aether/view/MiniPlaylistCard.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/MiniPlaylistCard.kt @@ -1,7 +1,5 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components -import android.R -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -20,10 +18,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.PaintingStyle.Companion.Stroke import androidx.compose.ui.graphics.drawOutline import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.layout.ContentScale @@ -36,6 +32,7 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.acitelight.aether.model.Video import com.acitelight.aether.service.ApiClient +import com.acitelight.aether.view.pages.formatTime @Composable diff --git a/app/src/main/java/com/acitelight/aether/view/MiniVideoCard.kt b/app/src/main/java/com/acitelight/aether/view/components/MiniVideoCard.kt similarity index 97% rename from app/src/main/java/com/acitelight/aether/view/MiniVideoCard.kt rename to app/src/main/java/com/acitelight/aether/view/components/MiniVideoCard.kt index 5f1768d..2774de0 100644 --- a/app/src/main/java/com/acitelight/aether/view/MiniVideoCard.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/MiniVideoCard.kt @@ -1,4 +1,4 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -29,6 +29,7 @@ import coil3.compose.AsyncImage import coil3.request.ImageRequest import com.acitelight.aether.model.Video import com.acitelight.aether.service.ApiClient +import com.acitelight.aether.view.pages.formatTime @Composable diff --git a/app/src/main/java/com/acitelight/aether/view/PlaylistPanel.kt b/app/src/main/java/com/acitelight/aether/view/components/PlaylistPanel.kt similarity index 98% rename from app/src/main/java/com/acitelight/aether/view/PlaylistPanel.kt rename to app/src/main/java/com/acitelight/aether/view/components/PlaylistPanel.kt index 684bbc3..7d59dbf 100644 --- a/app/src/main/java/com/acitelight/aether/view/PlaylistPanel.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/PlaylistPanel.kt @@ -1,4 +1,4 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box diff --git a/app/src/main/java/com/acitelight/aether/view/PortalCorePlayer.kt b/app/src/main/java/com/acitelight/aether/view/components/PortalCorePlayer.kt similarity index 97% rename from app/src/main/java/com/acitelight/aether/view/PortalCorePlayer.kt rename to app/src/main/java/com/acitelight/aether/view/components/PortalCorePlayer.kt index e0c05fd..ea3104b 100644 --- a/app/src/main/java/com/acitelight/aether/view/PortalCorePlayer.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/PortalCorePlayer.kt @@ -1,9 +1,11 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components import android.app.Activity import android.content.Context import android.media.AudioManager import android.view.View +import androidx.annotation.OptIn +import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInVertically @@ -51,11 +53,13 @@ import androidx.compose.ui.viewinterop.AndroidView import androidx.media3.common.util.UnstableApi import androidx.media3.exoplayer.ExoPlayer import androidx.media3.ui.PlayerView +import com.acitelight.aether.view.pages.formatTime +import com.acitelight.aether.view.pages.moveBrit import com.acitelight.aether.viewModel.VideoPlayerViewModel import kotlin.math.abs -@androidx.annotation.OptIn(UnstableApi::class) +@OptIn(UnstableApi::class) @Composable fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel, cover: Float) { val exoPlayer: ExoPlayer = videoPlayerViewModel.player!! @@ -173,7 +177,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo } ) - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = videoPlayerViewModel.isLongPressing, enter = slideInVertically(initialOffsetY = { fullHeight -> -fullHeight }), exit = slideOutVertically(targetOffsetY = { fullHeight -> -fullHeight }), @@ -212,7 +216,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo } } - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = videoPlayerViewModel.draggingPurpose == 0, enter = fadeIn( initialAlpha = 0f, @@ -235,7 +239,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo ) } - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = videoPlayerViewModel.draggingPurpose == 2, enter = fadeIn( initialAlpha = 0f, @@ -270,7 +274,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo } } - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = videoPlayerViewModel.draggingPurpose == 1, enter = fadeIn( initialAlpha = 0f, @@ -310,7 +314,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo .background(MaterialTheme.colorScheme.primary.copy(cover)) .fillMaxSize()) - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = (!videoPlayerViewModel.planeVisibility) || videoPlayerViewModel.locked, enter = fadeIn( initialAlpha = 0f, @@ -331,7 +335,7 @@ fun PortalCorePlayer(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewMo ) } - androidx.compose.animation.AnimatedVisibility( + AnimatedVisibility( visible = videoPlayerViewModel.planeVisibility && (!videoPlayerViewModel.locked), enter = fadeIn( initialAlpha = 0f, diff --git a/app/src/main/java/com/acitelight/aether/view/SubtitleOverlay.kt b/app/src/main/java/com/acitelight/aether/view/components/SubtitleOverlay.kt similarity index 91% rename from app/src/main/java/com/acitelight/aether/view/SubtitleOverlay.kt rename to app/src/main/java/com/acitelight/aether/view/components/SubtitleOverlay.kt index 5bf9d53..4eb59e7 100644 --- a/app/src/main/java/com/acitelight/aether/view/SubtitleOverlay.kt +++ b/app/src/main/java/com/acitelight/aether/view/components/SubtitleOverlay.kt @@ -1,5 +1,6 @@ -package com.acitelight.aether.view +package com.acitelight.aether.view.components +import android.text.Layout import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding @@ -42,9 +43,9 @@ fun SubtitleOverlay( if (raw.isEmpty()) return val textAlign = when (cues.firstOrNull()?.textAlignment) { - android.text.Layout.Alignment.ALIGN_CENTER -> TextAlign.Center - android.text.Layout.Alignment.ALIGN_OPPOSITE -> TextAlign.End - android.text.Layout.Alignment.ALIGN_NORMAL -> TextAlign.Start + Layout.Alignment.ALIGN_CENTER -> TextAlign.Center + Layout.Alignment.ALIGN_OPPOSITE -> TextAlign.End + Layout.Alignment.ALIGN_NORMAL -> TextAlign.Start else -> TextAlign.Center } diff --git a/app/src/main/java/com/acitelight/aether/view/components/VideoCard.kt b/app/src/main/java/com/acitelight/aether/view/components/VideoCard.kt new file mode 100644 index 0000000..438e56d --- /dev/null +++ b/app/src/main/java/com/acitelight/aether/view/components/VideoCard.kt @@ -0,0 +1,186 @@ +package com.acitelight.aether.view.components + +import android.widget.Toast +import androidx.compose.foundation.background +import androidx.compose.foundation.combinedClickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.widthIn +import androidx.compose.foundation.layout.wrapContentHeight +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateListOf +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Brush +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.lifecycle.viewModelScope +import androidx.navigation.NavHostController +import coil3.compose.AsyncImage +import coil3.request.ImageRequest +import com.acitelight.aether.Global.updateRelate +import com.acitelight.aether.model.Video +import com.acitelight.aether.view.pages.formatTime +import com.acitelight.aether.view.pages.toHex +import com.acitelight.aether.viewModel.VideoScreenViewModel +import kotlinx.coroutines.launch + + +@Composable +fun VideoCard( + videos: List