Skip to content

Commit bfb505b

Browse files
committed
feat: redesign playlist mode buttons in full-screen player for improved UI consistency
1 parent 9f79e1c commit bfb505b

3 files changed

Lines changed: 57 additions & 55 deletions

File tree

GEMINI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ app/src/main/java/org/parallel_sekai/kanade/
110110
- [x] Playback state persistence (playlist, track, position, modes).
111111
- [x] Code structure and file organization optimization.
112112
- [x] Show full-screen player when clicking media notification.
113+
- [x] Redesigned playlist mode buttons in full-screen player for better UI consistency.
113114
- [x] Improved robustness for lyric sharing (SuperLyricApi integration).
114115
- [x] Enhanced permission handling with user feedback.
115116

PLAN.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
# Plan: Show full-screen player from media notification
1+
# Plan: Redesign Playlist Mode Buttons in Full-screen Player
22

33
## Goal
4-
Show the full-screen player when the user clicks on the media notification.
4+
Redesign the shuffle and repeat mode buttons in the playlist view of the full-screen player to be more visually appealing and consistent with Material 3 principles.
55

66
## Tasks
7-
- [ ] **Task 1: Update AndroidManifest.xml**
8-
- Set `android:launchMode="singleTop"` for `MainActivity` to ensure we can handle new intents efficiently.
9-
- [ ] **Task 2: Update KanadePlaybackService.kt**
10-
- Create a `PendingIntent` targeting `MainActivity` with an extra `EXTRA_EXPAND_PLAYER = true`.
11-
- Set this `PendingIntent` as the `sessionActivity` for the `MediaSession`.
12-
- [ ] **Task 3: Update MainActivity.kt**
13-
- Define a constant for `EXTRA_EXPAND_PLAYER`.
14-
- Create a function to check the intent and trigger `PlayerIntent.Expand` if needed.
15-
- Call this function in `onCreate` and override `onNewIntent` to call it as well.
7+
- [ ] **Task 1: Locate and Analyze current implementation**
8+
- [x] Identified `PlaylistContent` in `app/src/main/java/org/parallel_sekai/kanade/ui/screens/player/PlayerComponents.kt`.
9+
- [ ] **Task 2: Design and Implement new Mode Buttons**
10+
- Replace the existing `IconButton` implementations with a more refined design.
11+
- Use `Surface` or `Box` with background and click handling for better control over the visual state.
12+
- Ensure active states (shuffle on, repeat modes) are clearly distinguished.
13+
- [ ] **Task 3: Verification**
14+
- Build the project to ensure no compilation errors.
15+
- (Manual) Verify the new UI in the app.
1616

17-
## Verification
18-
- Start playback.
19-
- Go to home screen or another app.
20-
- Click the media notification.
21-
- The app should open and automatically expand the player to full-screen.
17+
## Proposed Design Changes
18+
- Use a pill-shaped or rounded-rect container for the buttons.
19+
- Increase the contrast for active states.
20+
- Ensure the icons and backgrounds harmonize with the dark, immersive player UI.

app/src/main/java/org/parallel_sekai/kanade/ui/screens/player/PlayerComponents.kt

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -826,47 +826,25 @@ fun PlaylistContent(
826826
fontWeight = FontWeight.Bold
827827
)
828828

829-
Row {
830-
IconButton(
829+
Row(verticalAlignment = Alignment.CenterVertically) {
830+
PlaylistModeButton(
831+
icon = Icons.Default.Shuffle,
832+
isActive = state.shuffleModeEnabled,
831833
onClick = { onIntent(PlayerIntent.ToggleShuffle) },
832-
modifier = Modifier
833-
.padding(horizontal = Dimens.PaddingExtraSmall)
834-
.size(Dimens.IconSizeExtraLarge)
835-
.background(
836-
if (state.shuffleModeEnabled) Color.White.copy(alpha = 0.2f)
837-
else Color.Transparent,
838-
RoundedCornerShape(Dimens.PaddingSmall)
839-
)
840-
) {
841-
Icon(
842-
imageVector = Icons.Default.Shuffle,
843-
contentDescription = stringResource(R.string.desc_shuffle),
844-
tint = if (state.shuffleModeEnabled) Color.White else Color.White.copy(alpha = 0.5f),
845-
modifier = Modifier.size(Dimens.IconSizeMedium)
846-
)
847-
}
848-
849-
IconButton(
834+
contentDescription = stringResource(R.string.desc_shuffle)
835+
)
836+
837+
Spacer(modifier = Modifier.width(Dimens.SpacingExtraSmall))
838+
839+
PlaylistModeButton(
840+
icon = when (state.repeatMode) {
841+
RepeatMode.ONE -> Icons.Default.RepeatOne
842+
else -> Icons.Default.Repeat
843+
},
844+
isActive = state.repeatMode != RepeatMode.OFF,
850845
onClick = { onIntent(PlayerIntent.ToggleRepeat) },
851-
modifier = Modifier
852-
.padding(horizontal = Dimens.PaddingExtraSmall)
853-
.size(Dimens.IconSizeExtraLarge)
854-
.background(
855-
if (state.repeatMode != RepeatMode.OFF) Color.White.copy(alpha = 0.2f)
856-
else Color.Transparent,
857-
RoundedCornerShape(Dimens.PaddingSmall)
858-
)
859-
) {
860-
Icon(
861-
imageVector = when (state.repeatMode) {
862-
RepeatMode.ONE -> Icons.Default.RepeatOne
863-
else -> Icons.Default.Repeat
864-
},
865-
contentDescription = stringResource(R.string.desc_repeat),
866-
tint = if (state.repeatMode != RepeatMode.OFF) Color.White else Color.White.copy(alpha = 0.5f),
867-
modifier = Modifier.size(Dimens.IconSizeMedium)
868-
)
869-
}
846+
contentDescription = stringResource(R.string.desc_repeat)
847+
)
870848
}
871849
}
872850

@@ -1309,3 +1287,27 @@ fun LyricContent(
13091287
}
13101288
}
13111289
}
1290+
1291+
@Composable
1292+
private fun PlaylistModeButton(
1293+
icon: androidx.compose.ui.graphics.vector.ImageVector,
1294+
isActive: Boolean,
1295+
onClick: () -> Unit,
1296+
contentDescription: String?
1297+
) {
1298+
Surface(
1299+
onClick = onClick,
1300+
color = if (isActive) Color.White.copy(alpha = 0.2f) else Color.Transparent,
1301+
shape = RoundedCornerShape(Dimens.CornerRadiusLarge),
1302+
modifier = Modifier.size(Dimens.IconSizeHuge)
1303+
) {
1304+
Box(contentAlignment = Alignment.Center) {
1305+
Icon(
1306+
imageVector = icon,
1307+
contentDescription = contentDescription,
1308+
tint = if (isActive) Color.White else Color.White.copy(alpha = 0.5f),
1309+
modifier = Modifier.size(Dimens.IconSizeMedium)
1310+
)
1311+
}
1312+
}
1313+
}

0 commit comments

Comments
 (0)