Lyricon (词幕)

repository·master·Indexed 20 days ago

https://github.com/tomakino/lyricon

An Android tool that enhances the system status bar by displaying lyrics using the Xposed/LSPosed framework. It features a modular plugin system to fetch lyrics from various music players (such as ConePlayer, Flamingo, and Kanade), supports word-by-word lyrics, translations, and extensive visual customization of fonts, logos, and animations. Requires a rooted device with Android 9.0 (API 28) or higher.

Tokens
21.2K
Snippets
47
Records
154
Agent score
70%

What's inside Lyricon

  1. Overview of Lyricon features

    master

    Lyricon provides enhanced lyric visualization in the Android status bar with the following capabilities:

    • Lyric Display: Supports word-by-word lyrics, translation display, and duet modes.
    • Modular Design: Uses an independent plugin system to support various lyric sources via different music players.
    • Visual Customization: Allows users to adjust font styles, Logo visibility, coordinate offsets, and animation effects.
  2. Lyricon Main Features overview

    master

    Lyricon provides several capabilities for customizing the status bar lyric experience:

    • Status bar lyrics: Displays current lyrics in the status bar area.
    • Word-by-word lyrics: Supports word-level progress and highlighting (requires source support).
    • Translated lyrics: Supports provider-side translations or OpenAI-compatible translation services.
    • Per-app styles: Allows unique text, logo, and animation styles for different music players.
    • Position tuning: Adjusts anchor, insertion order, width, margins, and paddings.
    • Logo display: Supports provider logos, app icons, album covers, or custom logos.
    • Animation effects: Includes various lyric transition animation presets.
    • Backup and restore: Allows exporting and importing Lyricon configurations.
  3. Overview of Lyricon Developer Interfaces

    master

    Lyricon provides two primary interfaces for third-party integration:

    1. Provider: Used by music players or lyric provider plugins to push data (songs, lyrics, and playback state) into Lyricon.
    2. Subscriber: Used by third-party applications to listen to and react to the active player and current lyric state.
  4. Best practices for initial configuration

    master

    When setting up Lyricon for the first time, follow these strategies:

    • Style First: Keep the default style until lyrics are confirmed to be working.
    • Isolate Players: Test one player thoroughly before testing multiple players.
    • Verify Data: If a player shows no lyrics, check provider support before attempting to change style settings.
    • Fix Overlaps: If lyrics overlap status icons, prioritize reducing width or changing the anchor before other adjustments.
  5. Configure View Rules for status bar visibility

    master

    The Configure view visibility rules setting allows you to control how certain status bar views behave while lyrics are playing. This is primarily used to hide system UI elements that overlap with the lyric container.

    Note: Because system UI hierarchies vary by ROM, you may need to reconfigure these rules after a system update.

  6. Understand the Provider Lyric Model

    master

    The Lyricon Provider uses three primary data structures to describe songs and lyrics: Song, RichLyricLine, and LyricWord. All time-related values (such as begin, end, and duration) must be provided in milliseconds.

    Core Data Structures

    Song

    Song represents the current track. Key fields include:

    • id: A stable identifier for the song.
    • name: The song title.
    • artist: The artist name.
    • duration: Total duration in milliseconds.
    • lyrics: A list of RichLyricLine objects.

    RichLyricLine

    RichLyricLine represents a single line of lyrics. It supports:

    • Line-level timing: begin and end timestamps.
    • Word-level timing: A list of LyricWord objects.
    • Secondary content: secondary text (e.g., background vocals) and translation text.

    LyricWord

    LyricWord provides granular timing for individual words within a line via the text, begin, and end properties.

  7. Handle Player Switches

    master

    When the active player changes, the subscriber receives an onActiveProviderChanged() callback. Once this occurs, all subsequent song, lyric, playback state, and position callbacks will originate from the new active Provider.

    Recommended handling during a switch:

    1. Clear temporary UI state associated with the previous player.
    2. Wait for the next onSongChanged() or onReceiveText() callback.
    3. Reset playback position based on the new Provider's callbacks.
  8. Handle cross-device and cross-version restores

    master

    When restoring backups in non-identical environments, be aware of the following:

    Cross-Device Restore

    Because status bar structures, screen sizes, and ROMs may differ between devices, your layout might be misaligned. If the position is incorrect, manually adjust the anchor, width, margins, and view rules.

    Cross-Version Restore

    When restoring an old backup to a newer version of Lyricon, any settings introduced in the newer version will use their default values. If you encounter display issues, restart the System UI and re-verify key settings.

  9. When to use `setPosition()` vs `seekTo()`

    master

    Lyricon provides two ways to synchronize playback position, depending on the nature of the movement:

    • setPosition(): Use this for continuous playback position sync. This is intended for regular updates during normal playback (e.g., updating the current timestamp as the song plays).
    • seekTo(): Use this for explicit seek operations. This is intended for discrete jumps, such as when a user drags the progress bar or when the app restores a position after switching tracks.
  10. Difference between `sendText()` and `setSong()`

    master

    When providing lyric data to Lyricon, choose between these two methods based on the complexity of your data:

    • sendText(): Use this to send plain text lyrics. This method does not include a timeline and will clear any previously set song data.
    • setSong(): Use this to send structured song and lyric data. This is the preferred method for rich features, as it includes line-level lyrics, word-by-word lyrics, and translations.
  11. Distinguish between `onPositionChanged()` and `onSeekTo()`

    master

    Use these callbacks to manage lyric synchronization during playback:

    • onPositionChanged(): Triggered during normal playback position updates.
    • onSeekTo(): Triggered during an explicit seek operation. Use this callback to immediately reset your lyric rendering state to match the new position.
  12. How Lyricon works

    master

    Lyricon is an Android status bar lyrics tool that operates through three distinct components. It does not draw lyrics directly from the app; instead, it uses an LSPosed module to inject a lyric view into the System UI.

    • Lyricon app: Used to manage configuration, visual styles, lyric providers, and backup/restore operations.
    • LSPosed module: Responsible for injecting the lyric view into the System UI.
    • Lyric provider: Supplies the actual lyric data from music players or external sources.

    Note: Lyrics will only appear after the module is enabled in LSPosed, the System UI scope is selected, and System UI has been restarted.