Skip to content

Commit ecafed8

Browse files
committed
feat: enhance UI layout and improve error handling in media player
1 parent 6c68093 commit ecafed8

File tree

9 files changed

+38
-20
lines changed

9 files changed

+38
-20
lines changed

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENT.md

androidApp/src/main/java/com/maxrave/simpmusic/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class MainActivity : AppCompatActivity() {
250250
}
251251

252252
is ToastType.PlayerError -> {
253-
runBlocking { ComposeResUtils.getResString(ComposeResUtils.StringType.TIME_OUT_ERROR) }
253+
runBlocking { ComposeResUtils.getResString(ComposeResUtils.StringType.TIME_OUT_ERROR, type.error) }
254254
}
255255
},
256256
)

composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,30 +1680,35 @@ fun NowPlayingBottomSheet(
16801680
ActionButton(
16811681
icon =
16821682
when (uiState.songUIState.downloadState) {
1683-
DownloadState.STATE_NOT_DOWNLOADED ->
1683+
DownloadState.STATE_NOT_DOWNLOADED -> {
16841684
painterResource(
16851685
Res.drawable.outline_download_for_offline_24,
16861686
)
1687+
}
16871688

1688-
DownloadState.STATE_DOWNLOADING ->
1689+
DownloadState.STATE_DOWNLOADING -> {
16891690
painterResource(
16901691
Res.drawable.baseline_downloading_white,
16911692
)
1693+
}
16921694

1693-
DownloadState.STATE_DOWNLOADED ->
1695+
DownloadState.STATE_DOWNLOADED -> {
16941696
painterResource(
16951697
Res.drawable.baseline_downloaded,
16961698
)
1699+
}
16971700

1698-
DownloadState.STATE_PREPARING ->
1701+
DownloadState.STATE_PREPARING -> {
16991702
painterResource(
17001703
Res.drawable.baseline_downloading_white,
17011704
)
1705+
}
17021706

1703-
else ->
1707+
else -> {
17041708
painterResource(
17051709
Res.drawable.outline_download_for_offline_24,
17061710
)
1711+
}
17071712
},
17081713
text =
17091714
when (uiState.songUIState.downloadState) {

composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/MiniPlayer.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import androidx.compose.foundation.layout.wrapContentSize
4040
import androidx.compose.foundation.shape.CircleShape
4141
import androidx.compose.foundation.shape.RoundedCornerShape
4242
import androidx.compose.material.icons.Icons
43+
import androidx.compose.material.icons.automirrored.filled.VolumeOff
44+
import androidx.compose.material.icons.automirrored.filled.VolumeUp
4345
import androidx.compose.material.icons.filled.VolumeOff
4446
import androidx.compose.material.icons.filled.VolumeUp
4547
import androidx.compose.material.icons.outlined.OpenInNew
@@ -646,7 +648,7 @@ fun MiniPlayer(
646648
}
647649
// Part 2
648650
Box(modifier = Modifier.weight(1f)) {
649-
Column(Modifier.width(380.dp).padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {
651+
Column(Modifier.width(600.dp).padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally) {
650652
Box(
651653
contentAlignment = Alignment.Center,
652654
) {
@@ -810,7 +812,7 @@ fun MiniPlayer(
810812
HeartCheckBox(checked = controllerState.isLiked, size = 30) {
811813
sharedViewModel.onUIEvent(UIEvent.ToggleLike)
812814
}
813-
Spacer(Modifier.width(8.dp))
815+
Spacer(Modifier.width(4.dp))
814816
// Desktop mini player button (JVM only)
815817
if (getPlatform() == Platform.Desktop) {
816818
IconButton(onClick = { toggleMiniPlayer() }) {
@@ -830,14 +832,14 @@ fun MiniPlayer(
830832
Icon(
831833
imageVector =
832834
if (controllerState.volume > 0f) {
833-
Icons.Filled.VolumeUp
835+
Icons.AutoMirrored.Filled.VolumeUp
834836
} else {
835-
Icons.Filled.VolumeOff
837+
Icons.AutoMirrored.Filled.VolumeOff
836838
},
837839
contentDescription = if (controllerState.volume > 0f) "Mute" else "Unmute",
838840
)
839841
}
840-
Spacer(Modifier.width(4.dp))
842+
Spacer(Modifier.width(2.dp))
841843
var isVolumeSliding by rememberSaveable {
842844
mutableStateOf(false)
843845
}
@@ -910,7 +912,7 @@ fun MiniPlayer(
910912
},
911913
)
912914
}
913-
Spacer(Modifier.width(8.dp))
915+
Spacer(Modifier.width(4.dp))
914916
IconButton(onClick = { onClose() }) {
915917
Icon(Icons.Rounded.Close, "")
916918
}

composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/ui/screen/player/NowPlayingScreen.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,15 @@ fun NowPlayingScreenContent(
671671
modifier =
672672
Modifier
673673
.fillMaxHeight()
674-
.wrapContentWidth(unbounded = true, align = Alignment.CenterHorizontally)
675-
.align(Alignment.Center),
674+
.then(
675+
if (getPlatform() == Platform.Desktop) {
676+
Modifier
677+
} else {
678+
Modifier
679+
.wrapContentWidth(unbounded = true, align = Alignment.CenterHorizontally)
680+
.align(Alignment.Center)
681+
},
682+
),
676683
)
677684
}
678685
} else if (isVideo == false) {

composeApp/src/commonMain/kotlin/com/maxrave/simpmusic/utils/ComposeResUtils.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ import simpmusic.composeapp.generated.resources.this_app_needs_to_access_your_no
99
import simpmusic.composeapp.generated.resources.time_out_check_internet_connection_or_change_piped_instance_in_settings
1010

1111
object ComposeResUtils {
12-
suspend fun getResString(type: StringType): String =
12+
suspend fun getResString(
13+
type: StringType,
14+
vararg format: String,
15+
): String =
1316
when (type) {
1417
StringType.EXPLICIT_CONTENT_BLOCKED -> getString(Res.string.explicit_content_blocked)
1518
StringType.NOTIFICATION_REQUEST -> getString(Res.string.this_app_needs_to_access_your_notification)
16-
StringType.TIME_OUT_ERROR -> getString(Res.string.time_out_check_internet_connection_or_change_piped_instance_in_settings)
19+
StringType.TIME_OUT_ERROR -> getString(Res.string.time_out_check_internet_connection_or_change_piped_instance_in_settings, format)
1720
StringType.NEW_SINGLES -> getString(Res.string.new_singles)
1821
StringType.NEW_ALBUMS -> getString(Res.string.new_albums)
1922
}

composeApp/src/jvmMain/kotlin/com/maxrave/simpmusic/main.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fun main() {
120120
// Main Window
121121
val windowState =
122122
rememberWindowState(
123-
size = DpSize(1340.dp, 860.dp),
123+
size = DpSize(1500.dp, 860.dp),
124124
)
125125
var isVisible by remember { mutableStateOf(true) }
126126
// Single management

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ core-ktx = "1.17.0"
1616
appcompat = "1.7.1"
1717
work = "2.11.1"
1818
startup-runtime = "1.2.0"
19-
media3 = "1.9.1"
19+
media3 = "1.9.2"
2020
okhttp3 = "5.3.2"
2121
junit = "4.13.2"
2222
androidx-junit = "1.3.0"
@@ -50,7 +50,7 @@ slf4j = "1.7.36"
5050
sentry-android = "8.31.0"
5151
sentry-gradle-android = "6.0.0"
5252
sentry-jvm = "8.31.0"
53-
newpipe = "251f7f6625c76dc8e975be77666a4ede223c56c7"
53+
newpipe = "v0.25.2"
5454
webkit = "1.15.0"
5555
kermit = "2.0.8"
5656
paging-common = "3.4.0"

0 commit comments

Comments
 (0)