From 51f51ec944cacafaaf6f6a653d9bc4d887318961 Mon Sep 17 00:00:00 2001 From: ztftrue Date: Wed, 1 May 2024 00:23:38 +0800 Subject: [PATCH 1/3] fix:can't switch current play lyrics --- app/src/main/java/com/ztftrue/music/MainActivity.kt | 2 +- .../java/com/ztftrue/music/ui/public/MusicItemView.kt | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/ztftrue/music/MainActivity.kt b/app/src/main/java/com/ztftrue/music/MainActivity.kt index ff2159a..29363e7 100644 --- a/app/src/main/java/com/ztftrue/music/MainActivity.kt +++ b/app/src/main/java/com/ztftrue/music/MainActivity.kt @@ -614,7 +614,7 @@ class MainActivity : ComponentActivity() { val isPlaying = resultData.getBoolean("isPlaying") musicViewModel.playStatus.value = isPlaying val index = resultData.getInt("index") - if (index >= 0 && musicViewModel.musicQueue.size > index + if (index >= 0 && musicViewModel.musicQueue.size > index&&index != musicViewModel.currentPlayQueueIndex.intValue ) { musicViewModel.currentMusicCover.value = null musicViewModel.currentPlay.value = diff --git a/app/src/main/java/com/ztftrue/music/ui/public/MusicItemView.kt b/app/src/main/java/com/ztftrue/music/ui/public/MusicItemView.kt index 79c6c77..44df339 100644 --- a/app/src/main/java/com/ztftrue/music/ui/public/MusicItemView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/public/MusicItemView.kt @@ -59,13 +59,13 @@ import com.ztftrue.music.play.ACTION_PlayLIST_CHANGE import com.ztftrue.music.play.ACTION_RemoveFromQueue import com.ztftrue.music.play.ACTION_TRACKS_DELETE import com.ztftrue.music.sqlData.model.MusicItem -import com.ztftrue.music.utils.model.AnyListBase import com.ztftrue.music.utils.OperateType import com.ztftrue.music.utils.PlayListType -import com.ztftrue.music.utils.trackManager.PlaylistManager -import com.ztftrue.music.utils.trackManager.TracksManager import com.ztftrue.music.utils.Utils import com.ztftrue.music.utils.enumToStringForPlayListType +import com.ztftrue.music.utils.model.AnyListBase +import com.ztftrue.music.utils.trackManager.PlaylistManager +import com.ztftrue.music.utils.trackManager.TracksManager @androidx.annotation.OptIn(UnstableApi::class) @OptIn(ExperimentalFoundationApi::class) @@ -298,6 +298,9 @@ fun MusicItemView( if (playList.type != viewModel.playListCurrent.value?.type || viewModel.playListCurrent.value?.id != playList.id) { viewModel.playListCurrent.value = playList viewModel.musicQueue.clear() + // TODO need re-design, should use event EVENT_changePlayQueue + // avoid can't switch current play lyrics + viewModel.currentPlayQueueIndex.intValue=-1 viewModel.musicQueue.addAll(musicList) } } From db41554ea7b7353f8f2e1215be33e02d6ce780ba Mon Sep 17 00:00:00 2001 From: ztftrue Date: Wed, 1 May 2024 10:22:58 +0800 Subject: [PATCH 2/3] fix:language format crash --- app/src/main/java/com/ztftrue/music/MyApplication.kt | 6 +++--- .../main/java/com/ztftrue/music/ui/home/AlbumGridView.kt | 2 +- .../main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt | 2 +- .../main/java/com/ztftrue/music/ui/home/FolderListView.kt | 2 +- .../main/java/com/ztftrue/music/ui/home/GenreGridView.kt | 2 +- app/src/main/java/com/ztftrue/music/ui/home/PlayListView.kt | 2 +- app/src/main/res/values-zh/strings.xml | 2 +- app/src/main/res/values/strings.xml | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/ztftrue/music/MyApplication.kt b/app/src/main/java/com/ztftrue/music/MyApplication.kt index f9a5416..4f1d2f2 100644 --- a/app/src/main/java/com/ztftrue/music/MyApplication.kt +++ b/app/src/main/java/com/ztftrue/music/MyApplication.kt @@ -7,9 +7,9 @@ import android.content.Intent class MyApplication : Application() { override fun onCreate() { super.onCreate() - Thread.setDefaultUncaughtExceptionHandler { _, e -> - handleUncaughtException(e) - } +// Thread.setDefaultUncaughtExceptionHandler { _, e -> +// handleUncaughtException(e) +// } } private fun handleUncaughtException(e: Throwable) { diff --git a/app/src/main/java/com/ztftrue/music/ui/home/AlbumGridView.kt b/app/src/main/java/com/ztftrue/music/ui/home/AlbumGridView.kt index 92ab4d0..d6e3334 100644 --- a/app/src/main/java/com/ztftrue/music/ui/home/AlbumGridView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/home/AlbumGridView.kt @@ -310,7 +310,7 @@ fun AlbumItemView( horizontalArrangement = Arrangement.SpaceBetween ) { Text( - text = "$number song${if (number <= 1L) "" else "s"}", + text = stringResource(R.string.song, number, if (number <= 1L) "" else "s"), color = MaterialTheme.colorScheme.onSurfaceVariant, ) IconButton( diff --git a/app/src/main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt b/app/src/main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt index 0294ba0..bcbfa01 100644 --- a/app/src/main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/home/ArtistsGridView.kt @@ -308,7 +308,7 @@ fun ArtistItemView( horizontalArrangement = Arrangement.SpaceBetween ) { Text( - text = "$number song${if (number <= 1L) "" else "s"}", + text = stringResource(R.string.song, number, if (number <= 1L) "" else "s"), color = MaterialTheme.colorScheme.onSurfaceVariant, ) IconButton( diff --git a/app/src/main/java/com/ztftrue/music/ui/home/FolderListView.kt b/app/src/main/java/com/ztftrue/music/ui/home/FolderListView.kt index 07b2ffd..6f5c035 100644 --- a/app/src/main/java/com/ztftrue/music/ui/home/FolderListView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/home/FolderListView.kt @@ -218,7 +218,7 @@ fun FolderItemView( modifier = Modifier.horizontalScroll(rememberScrollState(0)), ) Text( - text = "$number", + text = stringResource(R.string.song, number, if (number <= 1L) "" else "s"), color = MaterialTheme.colorScheme.onBackground, ) } diff --git a/app/src/main/java/com/ztftrue/music/ui/home/GenreGridView.kt b/app/src/main/java/com/ztftrue/music/ui/home/GenreGridView.kt index d11db52..cd0aaa5 100644 --- a/app/src/main/java/com/ztftrue/music/ui/home/GenreGridView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/home/GenreGridView.kt @@ -289,7 +289,7 @@ fun GenreItemView( horizontalArrangement = Arrangement.SpaceBetween ) { Text( - text = stringResource(R.string.song, number), + text = stringResource(R.string.song, number, if (number <= 1L) "" else "s"), color = MaterialTheme.colorScheme.onSurfaceVariant, ) IconButton( diff --git a/app/src/main/java/com/ztftrue/music/ui/home/PlayListView.kt b/app/src/main/java/com/ztftrue/music/ui/home/PlayListView.kt index 461e0bb..f051a2f 100644 --- a/app/src/main/java/com/ztftrue/music/ui/home/PlayListView.kt +++ b/app/src/main/java/com/ztftrue/music/ui/home/PlayListView.kt @@ -278,7 +278,7 @@ fun PlayListItemView( modifier = Modifier.horizontalScroll(rememberScrollState(0)) ) Text( - text = "$number", + text = stringResource(R.string.song, number, if (number <= 1L) "" else "s"), color = MaterialTheme.colorScheme.onBackground, ) } diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 2f3584a..e3db754 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -32,7 +32,7 @@ 展平失败 展平 没有权限,无法获取音乐,点击设置权限 - %1$s 歌曲%2$s + %1$s 首歌曲 设置 反馈 退出APP diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9c9d04a..e096d72 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -99,4 +99,5 @@ Play error, auto play next Dictionary app is not installed or your dictionary app do not support this feature. You system don\'t support this feature + \ No newline at end of file From 3397fcf54e254f0798a99e7f5494a18f830509bf Mon Sep 17 00:00:00 2001 From: ztftrue Date: Wed, 1 May 2024 10:27:28 +0800 Subject: [PATCH 3/3] update app version --- app/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 285ac4b..1281ca8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,8 +21,8 @@ android { applicationId = "com.ztftrue.music" minSdk = 30 targetSdk = 34 - versionCode = 16 - versionName = "0.1.16" + versionCode = 17 + versionName = "0.1.17" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables {