Commit Graph

208 Commits

Author SHA1 Message Date
88e9ca229e refactor: abstract player logic into PlayerManager and MediaRepository
- Introduce `PlayerManager` to encapsulate `Media3` player interactions, state management, and UI updates.
  - Manages playback state (playing, buffering, ended, error), progress, metadata, track selection, and the media queue.
  - Exposes state via `StateFlow` for reactive UI updates.
  - Handles player lifecycle and event listeners.
- Create `MediaRepository` to fetch media items and upcoming episodes from the Jellyfin API.
  - Abstracts away the logic for retrieving media sources, playback URLs, and constructing `MediaItem` objects.
  - Includes a method to get the next episodes for auto-play, avoiding duplicates already in the queue.
- Implement `TrackMapper` to convert Media3 `Tracks` into a `TrackSelectionState` model for the UI.
- Refactor `PlayerViewModel` to delegate all player and data-fetching logic to `PlayerManager` and `MediaRepository`.
  - The ViewModel now observes state flows from the manager and orchestrates UI actions (e.g., auto-hiding controls).
  - Simplifies the ViewModel by removing direct player listener implementation, progress loops, and track parsing.
  - Improves error handling for invalid media IDs and data loading issues.
2026-01-28 21:08:33 +01:00
eae843312c feat: implement auto-play next episode and up-next queue
- Implement `getNextEpisodes` in `JellyfinApiClient` to fetch a list of upcoming episodes for a given series.
- In `PlayerViewModel`, automatically load the next few episodes into the media queue when a new item starts playing.
- Attach `MediaMetadata` (e.g., title) to `MediaItem` objects to ensure the correct title is displayed for queued items.
- Trigger loading of the next episodes in the `onMediaItemTransition` player callback.
- Refactor video playback and queueing methods (`playVideo`, `addVideoUri`) to accept and utilize `MediaMetadata`.
2026-01-28 20:24:50 +01:00
abf66c75e1 refactor: move HorizontalSeekGestureHelper to helper package 2026-01-28 17:43:23 +01:00
aeec3784be refactor(player): replace side sliders with centered adjustment indicators
- Replace the horizontal `PlayerSideSliders` with a new vertical `PlayerAdjustmentIndicator` for brightness and volume, displaying it in the center of the screen.
- Create `PlayerAdjustmentIndicator.kt`, a new composable that shows an icon, a vertical progress bar, and a percentage value within a semi-transparent black background.
- Update `PlayerScreen` to use the new centered indicator instead of the old side-aligned sliders when brightness or volume is adjusted via gestures.
- Pass a `modifier` to `ValueChangeTimedVisibility` to correctly position the new indicators.
- Change the background color of the "Seek to" toast message from a theme surface color to semi-transparent black for better consistency.
2026-01-27 20:23:18 +01:00
d24eff19cc refactor: improve player gesture feedback with timed visibility components
- Replace `LaunchedEffect` and manual state handling for showing/hiding player overlays (brightness, volume, seek feedback) with new reusable timed visibility composables.
- Introduce `ValueChangeTimedVisibility` to automatically show brightness and volume sliders for a short duration when their values change.
- Implement `EmptyValueTimedVisibility` to display the horizontal seek amount indicator and hide it after a delay.
- Remove redundant state variables (`brightnessOverlayVisible`, `volumeOverlayVisible`, `showFeedbackPreview`) and related logic from `PlayerScreen`.
- Clean up `PlayerGesturesLayer` by removing the `setFeedBackPreview` callback, simplifying its responsibility.
- Remove the auto-hide `LaunchedEffect` from `PlayerSideSliders` as this is now handled externally.
2026-01-27 19:16:23 +01:00
b97867d9f1 feature: add ValueChangeTimedVisibility composable for dynamic content display 2026-01-27 19:16:01 +01:00
380ae9d056 feature: add TimedVisibility composable for delayed content display 2026-01-27 18:46:34 +01:00
3d7b6bcf13 refactor: rename player gesture handlers for clarity
- Rename `PlayerGesturesLayer` parameters to be more descriptive of the gesture type (e.g., `onDoubleTapLeft`, `onDoubleTapCenter`, `onDoubleTapRight`).
- Update the `PlayerScreen` to use the new, more specific gesture handler names.
2026-01-27 18:18:09 +01:00
8cd97fc928 refactor: rename player gesture handlers for clarity
- Rename `PlayerGesturesLayer` parameters to be more descriptive of the gesture type (e.g., `onDoubleTapLeft`, `onDoubleTapCenter`, `onDoubleTapRight`).
- Update the `PlayerScreen` to use the new, more specific gesture handler names.
2026-01-26 20:32:41 +01:00
f2158820ac feature: add resume/pause functionality to PlayerGesturesLayer and update seek duration 2026-01-26 20:27:58 +01:00
616aa302ad feature: add resume/pause functionality to PlayerGesturesLayer and update seek duration 2026-01-26 20:01:32 +01:00
a2d73e1a54 refactor: enhance PlayerSeekBar with custom progress indicator and improved layout 2026-01-26 19:45:29 +01:00
6604c727bf refactor: update seek functionality in PlayerControlsOverlay for improved user experience 2026-01-26 19:17:26 +01:00
985c0028c9 refactor: replace Column with Box in PlayerControlsOverlay for improved layout management 2026-01-26 19:15:29 +01:00
71812f076f feature: add season and episode numbers to every episode occurence 2026-01-26 17:39:44 +01:00
3dc9ec7524 feature: add content progress and autoscroll to next up media to SeriesComponents 2026-01-26 16:58:38 +01:00
f835d9ea26 implement advanced custom video player UI and logic
- Replace basic `AndroidView` player with a comprehensive `PlayerScreen` including custom controls, gestures, and state management.
- Implement `PlayerViewModel` logic for playback state, track selection (audio, subtitles, quality), progress updates, and auto-hiding controls.
- Add `PlayerUiState` and related models to track buffering, playback speed, tracks, and media queue.
- Create several reusable player components:
    - `PlayerControlsOverlay`: Top/center/bottom bars for navigation, playback actions, and time info.
    - `PlayerGesturesLayer`: Support for double-tap to seek and vertical drags for brightness/volume.
    - `PlayerSeekBar`: Custom seek bar with buffer visualization and chapter/ad markers.
    - `PlayerSettingsSheet`: Bottom sheet for adjusting playback speed and selecting media tracks.
    - `PlayerQueuePanel`: Slide-out panel to view and navigate the current playlist.
    - `PlayerSideSliders`: Visual overlays for brightness and volume adjustments.
- Update `PlayerActivity` to support immersive mode and use a dark theme for playback.
- Enable `trackSelector` in `VideoPlayerModule` to facilitate manual track switching.
2026-01-25 18:43:43 +01:00
9c8614df6d refactor: remove unnecessary background overlay from HomeSections 2026-01-25 13:43:11 +01:00
f81e8f61fe Refactor: Make ContinueWatchingCard's progress bar floating. 2026-01-25 13:33:52 +01:00
9b2f4dfce5 update Home screen item play button UI
- Replace `Button` with `IconButton` for the media play action in `HomeSections.kt`.
- Style the play button with a circular background, custom sizing, and theme-specific colors.
- Adjust layout positioning and padding for the play icon within the item card.
2026-01-25 13:30:02 +01:00
e360517562 refactor UI components and improve home/library screen logic
- Rename `MediaGhostIconButton` to `GhostIconButton` and move it to the common components package.
- Implement `PurefinIconButton` as a new reusable UI component.
- Refactor `PosterItem` to include `imageUrl`, shifting image URL generation to the ViewModel.
- Update `HomePageViewModel` and `LibraryViewModel` to use `stateIn` for the server URL and handle image URL generation.
- Decouple `PosterCard` from `HomePageViewModel` by passing click lambdas as parameters.
- Add `LibraryTopBar` and navigation support (back button, item selection) to the `LibraryScreen`.
- Enhance `PurefinAsyncImage` to handle empty string models by treating them as null to trigger placeholders.
- Update `HomeTopBar` styling and replace the custom refresh button with `PurefinIconButton`.
2026-01-25 13:17:45 +01:00
3d17b7e614 implement season selection logic and update SeriesScreen UI
- Update `SeasonTabs` to handle selection state and provide an `onSelect` callback.
- Implement `selectedSeason` state in `SeriesScreen` using `remember` and `mutableStateOf`.
- Refactor `SeriesScreen` to display episodes based on the currently selected season.
- Adjust spacing and remove redundant styling from `EpisodeCarousel` items.
- Clean up unused imports and commented-out code in `SeriesComponents.kt`.
2026-01-24 14:57:06 +01:00
d102d80c09 implement reusable MediaSynopsis component
- Create `MediaSynopsis` as a common UI component with support for expandable text, custom styling, and overflow detection.
- Refactor `EpisodeComponents`, `MovieComponents`, and `SeriesScreen` to use the new `MediaSynopsis` component.
- Standardize the synopsis layout across different media detail screens.
2026-01-24 14:10:53 +01:00
bc6938fe93 update MediaHero heights and refactor SeriesHero
- Increase `MediaHero` height from 200dp to 300dp in `EpisodeScreen` and `MovieScreen`.
- Replace `SeriesHero` with `MediaHero` in `SeriesScreen` and increase height to 350dp.
- Remove redundant `SeriesHero` component from `SeriesComponents.kt`.
- Update `SeriesViewModel` to use `ImageType.PRIMARY` for the hero image URL.
- Remove comments from `MediaHero.kt`.
2026-01-24 13:47:36 +01:00
dac4ee42dc refactor UI styling and image handling
- Remove custom color token classes (`EpisodeColors`, `MovieColors`, `SeriesColors`, `HomeColors`) in favor of standard `MaterialTheme.colorScheme`.
- Introduce `PurefinAsyncImage` component to provide consistent theme-synced placeholders for asynchronous images.
- Refactor various UI components (`MediaGhostIconButton`, `MediaMetaChip`, `MediaCastRow`, `PosterCard`) to use `MaterialTheme` directly instead of custom color objects.
- Simplify `MediaDetailColors` mapping logic by removing redundant conversion functions.
- Update `PurefinTheme` to disable dynamic color by default.
- Force light mode in `PlayerActivity` temporarily.
- Replace standard Coil `AsyncImage` with `PurefinAsyncImage` across the application.
2026-01-24 13:40:39 +01:00
48a773fded refactor media play button and integrate into detail screens
- Replace `MediaFloatingPlayButton` with a new `MediaPlayButton` component in `EpisodeScreen` and `MovieScreen`.
- Move play action logic from screens into `EpisodeComponents` and `MovieComponents`.
- Update `MovieComponents` layout to include the play button and improve vertical spacing and dividers.
- Refactor `MediaPlayButton` to support text labels and custom styling, moving it to a standalone file.
- Remove unused `MediaFloatingPlayButton` and old `MediaPlayButton` implementation from `MediaDetailComponents.kt`.
2026-01-22 22:15:57 +01:00
8c29f681c5 refactor: Replace MediaActionButtons with individual MediaActionButton components in Episode, Movie, and Series screens 2026-01-22 19:59:40 +01:00
ee43178622 refactor: Move MediaPlaybackSettings to a separate component and update usage in Episode and Movie screens 2026-01-22 19:59:38 +01:00
ce45139f74 refactor media screens to use Scaffold and standard layout components
- Replace `BoxWithConstraints` with `Scaffold` in `MovieScreen`, `EpisodeScreen`, and `SeriesScreen`.
- Move `MovieTopBar`, `EpisodeTopBar`, and `SeriesTopBar` into the `topBar` slot of `Scaffold`.
- Implement `statusBarsPadding` and standard padding in top bar components.
- Decouple top bar components from ViewModels by passing an `onBack` callback.
- Simplify hero image heights and remove complex offsets and conditional wide-screen layouts.
- Use `floatingActionButton` slot for the play button in movie and episode screens.
- Standardize background handling using `MaterialTheme.colorScheme.background`.
2026-01-21 22:43:50 +01:00
decb8cd0cb refactor media screens and consolidate mock data
- Move `EpisodeCard` and `MovieCard` logic directly into `EpisodeScreen` and `MovieScreen` as internal components.
- Delete `SeriesCard.kt` and merge its content into `SeriesScreen.kt`.
- Create `ContentMockData.kt` to centralize mock data for movies, series, and episodes, replacing local mock objects.
- Add Compose previews for `EpisodeScreen`, `MovieScreen`, and `SeriesScreen`.
- Clean up unused imports and streamline layout structures in content components.
2026-01-21 21:13:39 +01:00
d2f5f8547a refactor: Extract and generalize MediaHero component. Now MovieScreen, SeriesScreen and EpisodeScreen also use the same Component. 2026-01-21 20:48:53 +01:00
6fa8ab1c56 Fix: SeriesViewModel should use PRIMARY image type for episode image URLs 2026-01-21 20:20:24 +01:00
b0db4644f5 Fix: PosterCard should use imageItemId for image URL retrieval 2026-01-21 20:20:23 +01:00
474d07e49f refactor media components to use shared UI elements and improve consistency 2026-01-21 20:01:02 +01:00
a9940d36ce refactor image URL handling to use ViewModel method for consistency 2026-01-20 17:34:19 +01:00
bcf66fd393 refactor UI components to utilize MaterialTheme for consistent theming 2026-01-20 17:01:28 +01:00
00cf71e65e refactor color management to use MaterialTheme and implement dynamic color schemes 2026-01-20 16:53:11 +01:00
c4347e610c implement library navigation and screen
- Implement `LibraryScreen` with a responsive grid layout for displaying library contents.
- Create `LibraryViewModel` to handle fetching items for a specific library via `JellyfinApiClient`.
- Integrate dynamic library navigation in `HomePage` by mapping Jellyfin user views to drawer navigation items.
- Add `Route.Library` and `Route.Login` to the navigation graph.
- Update `SeriesCard` and `SeriesViewModel` to adjust hero height and use backdrop images for episodes.
- Refactor `HomePageViewModel` to support library selection and rename episode selection logic for consistency.
- Enhance `PosterCard` with default colors and `PlayerActivity` with a black background.
- Remove redundant play button from `SeriesComponents`.
2026-01-20 16:00:04 +01:00
94117b1df2 refactor navigation with named arguments for ItemDto
- Update `EpisodeScreenViewModel`, `SeriesViewModel`, and `HomePageViewModel` to use named parameters (`id`, `type`) when creating `ItemDto` for navigation routes.
2026-01-19 19:48:33 +01:00
14efa152a3 extract PosterCard into a common UI component
- Move `PosterCard` from `HomeSections.kt` to a new standalone file `PosterCard.kt` in `hu.bbara.purefin.common.ui`.
- Refactor `PosterCard` layout from a `Box` to a `Column` for better text placement.
- Update text styling on `PosterCard` to limit to 1 line and adjust padding.
- Clean up code formatting and imports in `HomeSections.kt`.
2026-01-19 19:41:05 +01:00
a515819daa implement navigation, loading states, and series episode data
- Implement back navigation and home redirection in `EpisodeScreenViewModel`, `MovieScreenViewModel`, and `SeriesViewModel`.
- Refactor `EpisodeScreen`, `MovieScreen`, and `SeriesScreen` to handle data fetching via `LaunchedEffect` and display a loading state.
- Create `PurefinWaitingScreen`, a custom animated loading component with pulsing icons and dots.
- Update `SeriesViewModel` to properly map episode data, including image URLs and unique identifiers.
- Add click listeners to `EpisodeTopBar`, `MovieTopBar`, `SeriesTopBar`, and `EpisodeCard` to support navigation between screens.
- Integrate the waiting screen into the `LoginScreen` flow during connection attempts.
- Fix image URL generation in `SeriesViewModel` to use the primary image type for episodes and backdrops for series.
2026-01-19 19:11:41 +01:00
f7d64478fd implement series screen and refactor navigation to use ItemDto
- Implement `SeriesScreen`, `SeriesViewModel`, and associated UI components (`SeriesCard`, `SeriesHero`, etc.) for TV show details.
- Add `getSeasons` and `getEpisodesInSeason` methods to `JellyfinApiClient`.
- Refactor `Route` and navigation logic to use `ItemDto` (containing ID and `BaseItemKind`) instead of raw strings.
- Update `MovieScreen` and `EpisodeScreen` to accept `ItemDto` as a parameter.
- Enhance `PosterItem` and `ContinueWatchingItem` logic to handle parent IDs and correct image fetching for episodes and seasons.
- Add mock data for the series detail view.
- Remove redundant `MovieScreenNavigation.kt`.
2026-01-18 19:18:27 +01:00
aa00748923 implement click handling for "Continue Watching" items
- Add `BaseItemKind` type to `ContinueWatchingItem` model.
- Update `HomePageViewModel` to populate the item type.
- Implement click logic in `HomeSections` to navigate to movie or series details based on the item type.
2026-01-18 14:38:05 +01:00
ae02536ac6 implement episode details screen and ViewModel
- Create `EpisodeScreen` and `EpisodeCard` components with adaptive layouts for wide and narrow viewports.
- Implement `EpisodeScreenViewModel` to fetch "Next Up" episode data using the Jellyfin API.
- Add `EpisodeUiModel` and `CastMember` data classes for content representation.
- Develop custom UI components including `EpisodeHero`, `PlaybackSettings`, `CastRow`, and `EpisodeTopBar`.
- Define a dedicated color palette for the episode view in `EpisodeColors.kt`.
- Integrate navigation to the player activity from the play buttons.
2026-01-18 14:24:54 +01:00
f7ce63e50c implement playback navigation in MovieScreen
- Add `id` field to `MovieUiModel` and populate it from the Jellyfin item.
- Update `PlayButton` in `MovieComponents` to launch `PlayerActivity` with the selected media ID.
- Integrate `MovieScreenViewModel` into `PlayButton` to access current movie data via `collectAsState`.
2026-01-18 13:38:11 +01:00
c5c2c105ee implement Navigation 3 and Movie Details screen
- Update Android Gradle Plugin to 8.9.1 and target SDK to 36.
- Integrate `androidx.navigation3` for Compose-based navigation management.
- Implement a centralized `NavigationManager` and `Route` system (supporting `Home` and `Movie` routes).
- Add a comprehensive Movie Details screen featuring hero images, synopsis, metadata chips, and cast lists.
- Refactor `HomePage` and related components into a dedicated `hu.bbara.purefin.app.home` package.
- Enhance `JellyfinApiClient` with methods to fetch item details and "next up" episodes.
- Update `PurefinActivity` to use `NavDisplay` for handling app navigation and backstack.
- Setup Hilt modules for providing navigation-related dependencies.
2026-01-18 13:34:15 +01:00
fd100816cc implement Media3 ExoPlayer for video playback
- Add Media3 UI, ExoPlayer, and Compose dependencies.
- Implement `PlayerActivity` with landscape orientation for video playback.
- Create `PlayerViewModel` to manage ExoPlayer lifecycle and media loading via Hilt.
- Define `VideoPlayerModule` to provide a configured `ExoPlayer` instance with tunneling and custom load control.
- Extend `JellyfinApiClient` to fetch media sources and video stream URLs.
- Update `ContinueWatchingCard` to launch `PlayerActivity` when the play button is clicked.
- Enforce portrait orientation for the main application and filter duplicate items in `HomePageViewModel`.
2026-01-18 02:09:11 +01:00
6529b109f8 Enhance library item handling by adding isEmpty property and filtering out empty libraries from the HomeContent 2026-01-17 22:34:19 +01:00
71080198c4 Only show the latest media on the HomePage 2026-01-17 22:21:44 +01:00
3bd8d423d2 Fix progress bar 2026-01-17 18:10:36 +01:00