Skip to content

playPausFunction + English text#24

Merged
johanbriger merged 2 commits intomainfrom
feature/playPausInNowPlaying
Jan 14, 2026
Merged

playPausFunction + English text#24
johanbriger merged 2 commits intomainfrom
feature/playPausInNowPlaying

Conversation

@johanbriger
Copy link
Copy Markdown

@johanbriger johanbriger commented Jan 14, 2026

Summary by CodeRabbit

  • New Features

    • Play/Pause toggle control added to the media player interface (click/tap/keyboard accessible).
  • Localization

    • All user-facing text updated to English, including menus, buttons, dialogs, prompts, table headers, and error messages.
    • Default playlist names translated from Swedish to English ("Library" and "Favorites").

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Swedish UI strings were translated to English and two default playlist names were changed; MyPod gained a combined Play/Pause control that toggles playback via the existing mediaPlayer.

Changes

Cohort / File(s) Summary
Database & playlist defaults
src/main/java/org/example/DatabaseInitializer.java
Renamed default playlists: BibliotekLibrary, FavoriterFavorites. No logic changes to ID checks or song additions.
UI localization
src/main/java/org/example/ItunesPlayList.java
Replaced Swedish user-facing strings with English (labels, prompts, column headers, dialogs, placeholders, error texts). No control-flow or signature changes.
Playback control
src/main/java/org/example/MyPod.java
Replaced static play label with playPauseLabel ("▶/⏸"); added click and SPACE key handlers and a new playPauseFunction that toggles mediaPlayer.play() / mediaPlayer.pause().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as ClickWheel/UI
    participant MyPod
    participant MediaPlayer

    User->>UI: Click playPauseLabel / press SPACE
    UI->>MyPod: invoke playPauseFunction()
    MyPod->>MediaPlayer: if playing -> pause() / else -> play()
    MediaPlayer-->>MyPod: state updated
    MyPod-->>UI: update playPauseLabel display
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through strings both shy and bright,
I nudged two playlists into English light,
I tapped a button, now play and pause agree,
A tiny hop for code, a joyful key,
▶/⏸ — said the rabbit, "Now sing with me!"

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references two main changes: a playPause function and English text translations, both of which are substantially present in the changeset across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc21bf3 and fe9d883.

📒 Files selected for processing (1)
  • src/main/java/org/example/ItunesPlayList.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/example/ItunesPlayList.java

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/main/java/org/example/ItunesPlayList.java`:
- Line 342: There's a typo in the Alert message inside ItunesPlayList where the
error text reads "Failed to add son: " — update that string to "Failed to add
song: " in the Alert creation (the new Alert(Alert.AlertType.ERROR, ...) call)
so the message correctly says "song".
🧹 Nitpick comments (3)
src/main/java/org/example/MyPod.java (2)

220-236: Extraneous comment and minor cleanup opportunity.

The comment /// NY KOD //////////////////////////////////////////// on line 220 appears to be a development marker that should be removed before merging.

Also, the lambda on lines 227-228 could be simplified:

🧹 Suggested cleanup
-        /// NY KOD ////////////////////////////////////////////
-        // --- NY PLAY/PAUSE-FUNKTION ---
+        // --- PLAY/PAUSE FUNCTION ---
         Label playPauseLabel = new Label("▶/⏸");
         playPauseLabel.getStyleClass().add("wheel-text-play");

         playPauseLabel.setFocusTraversable(true);

-        playPauseLabel.setOnMouseClicked(e ->
-            playPauseFunction());
+        playPauseLabel.setOnMouseClicked(e -> playPauseFunction());

240-254: Play/pause toggle logic looks correct, minor formatting cleanup.

The implementation correctly handles the null check and toggles between play and pause states. However, there are excessive blank lines that could be cleaned up.

🧹 Suggested formatting cleanup
     private void playPauseFunction(){
         if(mediaPlayer != null) {
             if(mediaPlayer.getStatus() == MediaPlayer.Status.PLAYING) {
                 mediaPlayer.pause();
-
-            } else  {
+            } else {
                 mediaPlayer.play();
-
             }
         }
-
     }
-
-
-
src/main/java/org/example/DatabaseInitializer.java (1)

67-74: Comments are inconsistent with the new English playlist names.

The code now uses English playlist names ("Library", "Favorites"), but the comments on lines 67 and 72 still reference the Swedish names ("Bibliotek", "Favoriter"). Consider updating the comments for consistency:

🧹 Suggested comment updates
-        if (!playlistRepo.existsByUniqueId(1L)) { // Finns det en playlist borde det vara "Bibliotek"
+        if (!playlistRepo.existsByUniqueId(1L)) { // If a playlist exists, it should be "Library"
             Playlist library = playlistRepo.createPlaylist("Library");
             playlistRepo.addSongs(library, songRepo.findAll());
-            //Lägger bara till låtar som fanns innan listan, om fler "laddas ner" behövs de manuellt läggas till
+            // Only adds songs that existed before the list; if more are "downloaded", they need to be added manually
         }
-        if (!playlistRepo.existsByUniqueId(2L)) { // Finns det två playlist borde den andra vara "Favoriter"
+        if (!playlistRepo.existsByUniqueId(2L)) { // If there are two playlists, the second should be "Favorites"
             playlistRepo.createPlaylist("Favorites");
         }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4f02f and dc21bf3.

📒 Files selected for processing (3)
  • src/main/java/org/example/DatabaseInitializer.java
  • src/main/java/org/example/ItunesPlayList.java
  • src/main/java/org/example/MyPod.java
🔇 Additional comments (11)
src/main/java/org/example/ItunesPlayList.java (11)

58-58: LGTM!

The LCD artist text is appropriately translated to English.


92-92: LGTM!

Search prompt translated correctly.


128-128: LGTM!

Context menu items correctly translated to English.

Also applies to: 138-138


187-188: LGTM!

Button labels correctly translated to English.


251-286: LGTM!

Table column headers and placeholder text correctly translated to English.


298-298: LGTM!

Default artist name placeholder correctly translated.


317-318: LGTM!

Context menu items for adding/removing songs correctly translated.


350-350: LGTM!

Empty playlist message correctly translated.


412-416: LGTM!

Create playlist dialog text correctly translated to English.


437-440: LGTM!

Rename playlist dialog text correctly translated to English.


449-449: LGTM!

Error message correctly translated to English.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@johanbriger johanbriger merged commit c602ad8 into main Jan 14, 2026
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 14, 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