Skip to content

feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety, download & backup updates#1069

Open
IIXII-L192 wants to merge 4 commits into
rukamori:devfrom
IIXII-L192:feat/v9-player-theme-and-ui-enhancements
Open

feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety, download & backup updates#1069
IIXII-L192 wants to merge 4 commits into
rukamori:devfrom
IIXII-L192:feat/v9-player-theme-and-ui-enhancements

Conversation

@IIXII-L192

@IIXII-L192 IIXII-L192 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces comprehensive UI, animation, color extraction, theme coordination, thread-safety, navigation bar layout, download management, backup recovery, and unified localization settings.


Key Changes & Rationale

1. Material Extended (V9) Player Layout & Controls

  • Streamlined Control Hierarchy: Removed the duplicate lower pill toggle row (V9BottomToggleRow) in PlayerComponents.kt and repositioned V9AnimatedPlaybackControls at the bottom of the player container.
  • Metadata & Progress Alignment: Shifted title/artist info, favorite/lyrics action buttons, and progress slider down directly above transport controls for an intuitive control group layout.
  • Dynamic 1:1 Squircle Art Container: Configured cover art thumbnail container to maintain aspectRatio(1f) with RoundedCornerShape(36.dp) while scaling dynamically into remaining vertical space.
  • Favorites Action: Replaced the duplicate lyrics shortcut beside track details with a dedicated Favorite button bound to user favorites (R.drawable.favorite / R.drawable.favorite_border).

2. Majority-Color Extraction & Smooth Theme Animations

  • Thumbnail Dominant Color Usage: Buttons, sliders, track progress indicators, and text elements in V9 now map directly to the extracted dominant majority color from cover art thumbnails without unwanted saturation shifts.
  • Smooth 800ms Color Transitions: Applied animateColorAsState(tween(800ms)) across dynamicBgColor, dynamicAccentColor, dynamicTextColor, and dynamicIconButtonColor. Color values crossfade smoothly during song switches instead of jumping instantly.
  • Auto-Next Color Swapping Fix: Keyed the color extraction LaunchedEffect in Player.kt to mediaMetadata?.thumbnailUrl alongside media ID, ensuring theme colors update automatically when tracks auto-advance.
  • System Light/Dark Theme Adaptation: Configured dynamic colors to follow useDarkTheme:
    • Light Mode: Generates a soft pastel background tint (value = 0.96f) paired with high-contrast dark text (value = 0.08f).
    • Dark Mode: Generates a deep dark background tint (value = 0.08f) paired with off-white text (value = 0.96f).

3. V7 Immersive Player Color Extractor Refinement

  • True Dominant Color Swatch: Updated V7 backdrop color extraction in PlayerColorExtractor.kt to use palette.dominantSwatch directly instead of generic weighted swatches (fixing incorrect tint selections such as burgundy vs. teal).
  • Vibrancy Tuning: Increased saturation multiplier in v7BackdropTone by a subtle 5% (from 1.22f to 1.27f) for richer background aesthetics.

4. Playback Service Thread-Safety

  • Main Thread Safety Fix: Captured player.currentPosition and metadata properties on the main application thread before performing database queries or launching background coroutine scopes. This fixes java.lang.IllegalStateException: Player is accessed on the wrong thread crashes during media transitions and timeline/position discontinuities (e.g. ListenBrainz scrobbling & Together online session syncs).

5. Navigation Bar & System Theme Fixes

  • Indicator Clipping Prevention: Removed restrictive padding(vertical = 8.dp) from the inner navigation items container in FloatingNavigationToolbar.kt, giving item buttons the full 78.dp height so active tab indicator pills render without clipping at the top.
  • In-Place System Theme Toggle: Added android:configChanges="uiMode" to MainActivity in AndroidManifest.xml so system dark/light theme switches recompose in-place instead of destroying and recreating the Activity.

6. Auto-Redownload on Backup Restore

  • Database & Backup Categories: Added downloadedSongsList() query and registered a DOWNLOADS category in database backup schemas.
  • Start-Up Restore Detection: Implemented start-up verification in MainActivity.kt checking for a RedownloadOnRestoreKey preference. If active, it automatically queues missing downloaded tracks via DownloadService.sendAddDownload.
  • User Settings Toggle: Added a toggle switch to the backup dialog to give users granular control over this restoration behavior.

7. Playlist Download & Cancel Optimization

  • Granular Cancel Toggling: Refactored the header download button action so clicking it to cancel active downloads only cancels queued/active items. Completed songs are preserved instead of being deleted.

8. Expandable Download Manager UI

  • Accordion Layout: Redesigned the "Downloaded" tab of the Download Manager to support expandable accordion groups for playlists/albums, allowing nested track inspection and individual track deletion.
  • Relaxed Collection Filtering: Changed item filtering from matching all completed tracks to any completed tracks, ensuring partially downloaded collections remain visible.

9. Unified App Language Selector Replacement

  • "Use System Language" Switch: Replaced the large dropdown list app language selector and platform-specific redirects with a single switch preference. When enabled, the app combines system language and country configurations (e.g. ar-EG for Egyptian Arabic) to support automatic regional fallbacks across all Android versions. When disabled, the app falls back to English (en).

Upstream vs. Modified Comparison

Area Upstream (dev) Modified (feat/v9-player-theme-and-ui-enhancements) Rationale
V9 Controls Layout Uses duplicate bottom toggle row & static control layout Streamlined layout with bottom-anchored V9AnimatedPlaybackControls and 1:1 squircle artwork Prevents visual clutter and optimizes thumb reachability
V9 Color Extraction Fixed color mappings; instant snapping on track change Dynamic majority-color extraction with 800ms animateColorAsState crossfades & auto-next updates Provides smooth, organic visual transitions matching track artwork
V9 Theme Switching Static backdrop across light/dark modes Adaptive light/dark palette generation following useDarkTheme Ensures full compliance with system light/dark settings
V7 Backdrop Extraction Picks weighted palette swatch Extracts dominantSwatch with +5% saturation tuning Solves color mismatches on dual-tone thumbnails
Playback Thread Safety Accesses player.currentPosition directly inside Dispatchers.IO coroutine Reads player.currentPosition on Main thread prior to launching coroutine Prevents Media3 thread-safety crashes during song changes and scrobbling transitions
Floating Nav Bar Inner item container applies vertical = 8.dp padding Removes vertical padding from inner Row container Prevents active tab pill indicator clipping at top of bar
Manifest Config Recreates Activity on uiMode change Declares android:configChanges="uiMode" Prevents player sheet from resetting on system dark/light toggle
Auto-Redownload on Restore Database restoration only Restores database and automatically queues missing tracks for redownload Fully recovers local offline library state on backup restore
Playlist Download Cancel Deletes the entire playlist folder Cancels active downloads while preserving completed files Prevents accidental loss of downloaded data
Download Manager UI Flat list of collections Expandable collection accordion with individual song controls Improves control and granularity over downloaded tracks
App Language Settings Large dropdown language list (or redirects to system settings on Android 13+) A single "Use system language" switch (uses system region combination or falls back to English) Simplifies localization setting UX and enables automatic regional dialect matching

Verification

  • Build Target: ./gradlew assembleGmsMobileUniversalDebug
  • Result: BUILD SUCCESSFUL
  • Testing:
    • Tested manual and auto-next track transitions for smooth color crossfades.
    • Verified favorite button toggle functionality.
    • Confirmed active indicator pill alignment on floating navigation bar.
    • Verified in-place theme toggle response.
    • Verified database backup restoration auto-download triggers on startup.
    • Tested download cancel button preserving completed tracks.
    • Verified Download Manager accordion expand/collapse & individual track deletion.
    • Verified "Use system language" switch changes the application locale between system defaults (including regional combinations like ar-EG for Egyptian Arabic) and English.

… color transitions, playback thread safety, and navigation layout
…cel, add expandable download manager and fix player thread safety
@IIXII-L192 IIXII-L192 changed the title feat(player): Material Extended (V9) theme enhancements, dynamic majority-color transitions & layout refinements feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety, download & backup updates Jul 23, 2026
@IIXII-L192
IIXII-L192 force-pushed the feat/v9-player-theme-and-ui-enhancements branch from 8dfdee8 to c4207fb Compare July 23, 2026 12:51
@IIXII-L192 IIXII-L192 changed the title feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety, download & backup updates feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety & layout refinements Jul 23, 2026
@IIXII-L192 IIXII-L192 changed the title feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety & layout refinements feat(player): Material Extended (V9) theme, dynamic majority-color transitions, thread safety, download & backup updates Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant