From 5245284c96013197d994eafd21bdd75e053858f4 Mon Sep 17 00:00:00 2001 From: iliano101 Date: Sat, 2 Nov 2024 17:45:56 -0400 Subject: [PATCH] Large version update - Java to 21 - AGP - Android compile to 35 - Update (most) library versions - Fixed some deprecation warnings - Ran code cleanup --- .github/workflows/beta-build.yml | 4 +- .idea/compiler.xml | 2 +- .idea/gradle.xml | 20 - .idea/misc.xml | 2 +- .idea/other.xml | 329 ------------ app/build.gradle.kts | 8 +- .../artist/SeeArtistOfNowPlayingAdapter.kt | 2 +- .../adapter/search/SearchItemAdapter.kt | 2 +- .../data/manager/LocalPlaylistManager.kt | 4 +- .../simpmusic/data/parser/HomeParser.kt | 2 +- .../data/parser/MoodsGenresParser.kt | 2 +- .../simpmusic/data/parser/RelatedParser.kt | 2 +- .../com/maxrave/simpmusic/extension/AllExt.kt | 4 +- .../com/maxrave/simpmusic/ui/MainActivity.kt | 2 +- .../simpmusic/ui/component/AdapterItems.kt | 2 +- .../simpmusic/ui/component/DynamicHeaders.kt | 150 +++--- .../simpmusic/ui/component/LyricsView.kt | 10 +- .../ui/component/ModalBottomSheet.kt | 2 +- .../simpmusic/ui/fragment/SearchFragment.kt | 4 +- .../ui/fragment/library/LibraryFragment.kt | 12 +- .../ui/fragment/other/ArtistFragment.kt | 12 +- .../simpmusic/ui/screen/home/HomeScreen.kt | 94 ++-- .../ui/screen/library/PlaylistScreen.kt | 507 +++++++++--------- .../simpmusic/viewModel/SharedViewModel.kt | 2 +- build.gradle.kts | 3 +- gradle/libs.versions.toml | 41 +- gradle/wrapper/gradle-wrapper.properties | 4 +- kotlinYtmusicScraper/build.gradle.kts | 4 +- 28 files changed, 446 insertions(+), 786 deletions(-) delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/other.xml diff --git a/.github/workflows/beta-build.yml b/.github/workflows/beta-build.yml index 1f6a0c1e..810f35ad 100644 --- a/.github/workflows/beta-build.yml +++ b/.github/workflows/beta-build.yml @@ -33,7 +33,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: "17" + java-version: "21" cache: "gradle" - name: Change wrapper permissions @@ -55,7 +55,7 @@ jobs: keyPassword: ${{ secrets.KEY_PASSWORD }} env: # override default build-tools version (33.0.0) -- optional - BUILD_TOOLS_VERSION: "34.0.0" + BUILD_TOOLS_VERSION: "35.0.0" - name: Rename APK file run: sudo mv ${{steps.sign_app.outputs.signedReleaseFile}} /${{env.apk_file_name}}.apk diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e..b86273d9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index dffd5af9..00000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 8978d23d..b2c751a3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/other.xml b/.idea/other.xml deleted file mode 100644 index a76f1180..00000000 --- a/.idea/other.xml +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7c29686d..8d95eefd 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,7 +11,7 @@ plugins { android { namespace = "com.maxrave.simpmusic" - compileSdk = 34 + compileSdk = 35 defaultConfig { applicationId = "com.maxrave.simpmusic" @@ -71,11 +71,11 @@ android { targetCompatibility = JavaVersion.VERSION_17 } kotlin { - jvmToolchain(17) + jvmToolchain(21) } kotlinOptions { freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers" - jvmTarget = "17" + jvmTarget = "21" } // enable view binding buildFeatures { @@ -171,7 +171,7 @@ android { "META-INF/*.kotlin_module", ) } - + } dependencies { diff --git a/app/src/main/java/com/maxrave/simpmusic/adapter/artist/SeeArtistOfNowPlayingAdapter.kt b/app/src/main/java/com/maxrave/simpmusic/adapter/artist/SeeArtistOfNowPlayingAdapter.kt index 228be53f..e11210eb 100644 --- a/app/src/main/java/com/maxrave/simpmusic/adapter/artist/SeeArtistOfNowPlayingAdapter.kt +++ b/app/src/main/java/com/maxrave/simpmusic/adapter/artist/SeeArtistOfNowPlayingAdapter.kt @@ -32,7 +32,7 @@ class SeeArtistOfNowPlayingAdapter(private val listArtist: List): Recycl override fun getItemCount(): Int = listArtist.size - override fun onBindViewHolder(holder: SeeArtistOfNowPlayingAdapter.ViewHolder, position: Int) { + override fun onBindViewHolder(holder: ViewHolder, position: Int) { val artist = listArtist[position] with(holder.binding) { tvSeeArtists.text = artist.name diff --git a/app/src/main/java/com/maxrave/simpmusic/adapter/search/SearchItemAdapter.kt b/app/src/main/java/com/maxrave/simpmusic/adapter/search/SearchItemAdapter.kt index 8bca11a3..a6ee9f63 100644 --- a/app/src/main/java/com/maxrave/simpmusic/adapter/search/SearchItemAdapter.kt +++ b/app/src/main/java/com/maxrave/simpmusic/adapter/search/SearchItemAdapter.kt @@ -200,7 +200,7 @@ class SearchItemAdapter(private var searchResultList: ArrayList, var contex placeholder(R.drawable.holder_video) } tvVideoTitle.text = video.title - val tempArtist = mutableListOf() + mutableListOf() if (video.artists != null) { tvAuthor.text = video.artists.toListName().connectArtists() } else { diff --git a/app/src/main/java/com/maxrave/simpmusic/data/manager/LocalPlaylistManager.kt b/app/src/main/java/com/maxrave/simpmusic/data/manager/LocalPlaylistManager.kt index 72096508..0c672986 100644 --- a/app/src/main/java/com/maxrave/simpmusic/data/manager/LocalPlaylistManager.kt +++ b/app/src/main/java/com/maxrave/simpmusic/data/manager/LocalPlaylistManager.kt @@ -195,11 +195,11 @@ class LocalPlaylistManager( ?.continuation }.onFailure { continueParam = null } } - if (listContent.isEmpty()) { + if (listContent.isEmpty) { emit(LocalResource.Error("Can't get setVideoId")) } val parsed = parseSetVideoId(ytPlaylistId, listContent) - if (parsed.isEmpty()) { + if (parsed.isEmpty) { emit(LocalResource.Error("Can't get setVideoId")) } parsed.forEach { setVideoId -> diff --git a/app/src/main/java/com/maxrave/simpmusic/data/parser/HomeParser.kt b/app/src/main/java/com/maxrave/simpmusic/data/parser/HomeParser.kt index e41e2c8a..f560178b 100644 --- a/app/src/main/java/com/maxrave/simpmusic/data/parser/HomeParser.kt +++ b/app/src/main/java/com/maxrave/simpmusic/data/parser/HomeParser.kt @@ -540,7 +540,7 @@ fun parseSong(data: MusicTwoRowItemRenderer, context: Context): Content { var name = "" var id = "" var view = "" - var radioString = "" + "" val listArtist: MutableList = mutableListOf() val listAlbum: MutableList = mutableListOf() Log.d("parse_runs", runs.toString()) diff --git a/app/src/main/java/com/maxrave/simpmusic/data/parser/MoodsGenresParser.kt b/app/src/main/java/com/maxrave/simpmusic/data/parser/MoodsGenresParser.kt index c6f5baa5..ffcdee8c 100644 --- a/app/src/main/java/com/maxrave/simpmusic/data/parser/MoodsGenresParser.kt +++ b/app/src/main/java/com/maxrave/simpmusic/data/parser/MoodsGenresParser.kt @@ -120,7 +120,7 @@ fun parseGenreObject(data: BrowseResponse?): GenreObject? { val songName = content.musicResponsiveListItemRenderer?.flexColumns?.get(0)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.get(0)?.text val songArtist = content.musicResponsiveListItemRenderer?.flexColumns?.get(1)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.get(0)?.text val videoId = content.musicResponsiveListItemRenderer?.flexColumns?.get(0)?.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.get(0)?.navigationEndpoint?.watchEndpoint?.videoId - val thumbnails = content.musicResponsiveListItemRenderer?.thumbnail?.musicThumbnailRenderer?.thumbnail?.thumbnails?.toListThumbnail() + content.musicResponsiveListItemRenderer?.thumbnail?.musicThumbnailRenderer?.thumbnail?.thumbnails?.toListThumbnail() listItemsSong.add( ItemsSong( title = songName ?: "", diff --git a/app/src/main/java/com/maxrave/simpmusic/data/parser/RelatedParser.kt b/app/src/main/java/com/maxrave/simpmusic/data/parser/RelatedParser.kt index 13b55f78..c736e624 100644 --- a/app/src/main/java/com/maxrave/simpmusic/data/parser/RelatedParser.kt +++ b/app/src/main/java/com/maxrave/simpmusic/data/parser/RelatedParser.kt @@ -35,7 +35,7 @@ fun parseRelated(data: List?): ArrayList? } } } - if (artist.isEmpty()) { + if (artist.isEmpty) { val artistName = longByTextRuns[0].text val artistId = longByTextRuns[0].navigationEndpoint?.browseEndpoint?.browseId artist.add(Artist(artistId ?: "", artistName)) diff --git a/app/src/main/java/com/maxrave/simpmusic/extension/AllExt.kt b/app/src/main/java/com/maxrave/simpmusic/extension/AllExt.kt index 5d4dd99d..96c33c72 100644 --- a/app/src/main/java/com/maxrave/simpmusic/extension/AllExt.kt +++ b/app/src/main/java/com/maxrave/simpmusic/extension/AllExt.kt @@ -130,7 +130,7 @@ fun SongsResult.toTrack(): Track { this.duration ?: "", this.durationSeconds ?: 0, true, - this.isExplicit ?: false, + this.isExplicit == true, "", this.thumbnails, this.title ?: "", @@ -374,7 +374,7 @@ fun Track.toMediaItem(): MediaItem { if (thumbUrl.contains("w120")) { thumbUrl = Regex("([wh])120").replace(thumbUrl, "$1544") } - val artistName: String = this.artists.toListName().connectArtists() + this.artists.toListName().connectArtists() val isSong = (this.thumbnails?.last()?.height != 0 && this.thumbnails?.last()?.height == this.thumbnails?.last()?.width && this.thumbnails?.last()?.height != null) && (!thumbUrl.contains("hq720") && !thumbUrl.contains("maxresdefault")) return MediaItem.Builder() diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt b/app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt index 2d90ca2f..fd5c5ec9 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/MainActivity.kt @@ -682,7 +682,7 @@ class MainActivity : AppCompatActivity() { } private fun isNetworkAvailable(context: Context?): Boolean { - val connectivityManager = context?.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager + val connectivityManager = context?.getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager // Returns a Network object corresponding to // the currently active default data network. val network = connectivityManager.activeNetwork ?: return false diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/AdapterItems.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/AdapterItems.kt index 6fd65f9e..cddb6380 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/AdapterItems.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/AdapterItems.kt @@ -96,7 +96,7 @@ fun HomeItem( navController: NavController, data: HomeItem ) { - val coroutineScope = rememberCoroutineScope() + rememberCoroutineScope() var bottomSheetShow by remember { mutableStateOf(false) } val lazyListState = rememberLazyListState() diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/DynamicHeaders.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/DynamicHeaders.kt index d48376c9..e0bff5b7 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/DynamicHeaders.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/DynamicHeaders.kt @@ -95,62 +95,64 @@ fun LocalPlaylistHeader( // ) // } LazyColumn( - modifier = Modifier.fillMaxWidth().align(Alignment.TopCenter), + modifier = Modifier + .fillMaxWidth() + .align(Alignment.TopCenter), state = lazyState, ) { item { Box( modifier = - Modifier - .fillMaxWidth() - .wrapContentHeight() - .background(Color.Transparent), + Modifier + .fillMaxWidth() + .wrapContentHeight() + .background(Color.Transparent), ) { Box( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), ) { CoilImage( imageModel = { localPlaylist?.thumbnail }, imageOptions = - ImageOptions( - contentScale = ContentScale.FillWidth, - alignment = Alignment.Center, - ), + ImageOptions( + contentScale = ContentScale.FillWidth, + alignment = Alignment.Center, + ), previewPlaceholder = painterResource(id = R.drawable.holder), component = - rememberImageComponent { - CrossfadePlugin( - duration = 550, - ) - }, + rememberImageComponent { + CrossfadePlugin( + duration = 550, + ) + }, modifier = - Modifier - .wrapContentHeight() - .fillMaxWidth() - .clip( - RoundedCornerShape(8.dp), - ), + Modifier + .wrapContentHeight() + .fillMaxWidth() + .clip( + RoundedCornerShape(8.dp), + ), ) Box( modifier = - Modifier - .fillMaxWidth() - .height(180.dp) - .align(Alignment.BottomCenter) - .background( - brush = - Brush.verticalGradient( - listOf( - Color.Transparent, - Color(0x75000000), - Color.Black, - ), - ), + Modifier + .fillMaxWidth() + .height(180.dp) + .align(Alignment.BottomCenter) + .background( + brush = + Brush.verticalGradient( + listOf( + Color.Transparent, + Color(0x75000000), + Color.Black, + ), ), + ), ) } Column( @@ -160,9 +162,9 @@ fun LocalPlaylistHeader( ) { Row( modifier = - Modifier - .wrapContentWidth() - .padding(16.dp), + Modifier + .wrapContentWidth() + .padding(16.dp), ) { RippleIconButton( resId = R.drawable.baseline_arrow_back_ios_new_24, @@ -178,31 +180,31 @@ fun LocalPlaylistHeader( localPlaylist?.thumbnail }, imageOptions = - ImageOptions( - contentScale = ContentScale.FillHeight, - alignment = Alignment.Center, - ), + ImageOptions( + contentScale = ContentScale.FillHeight, + alignment = Alignment.Center, + ), previewPlaceholder = painterResource(id = R.drawable.holder), component = - rememberImageComponent { - CrossfadePlugin( - duration = 550, - ) - }, + rememberImageComponent { + CrossfadePlugin( + duration = 550, + ) + }, modifier = - Modifier - .height(250.dp) - .wrapContentWidth() - .align(Alignment.CenterHorizontally) - .clip( - RoundedCornerShape(8.dp), - ), + Modifier + .height(250.dp) + .wrapContentWidth() + .align(Alignment.CenterHorizontally) + .clip( + RoundedCornerShape(8.dp), + ), ) Box( modifier = - Modifier - .fillMaxWidth() - .wrapContentHeight(), + Modifier + .fillMaxWidth() + .wrapContentHeight(), ) { Column(Modifier.padding(horizontal = 32.dp)) { Spacer(modifier = Modifier.size(25.dp)) @@ -222,21 +224,21 @@ fun LocalPlaylistHeader( Spacer(modifier = Modifier.height(8.dp)) Text( text = - stringResource( - id = R.string.created_at, - localPlaylist?.inLibrary?.format( - DateTimeFormatter.ofPattern( - "kk:mm - dd MMM uuuu", - ), - ) ?: "", - ), + stringResource( + id = R.string.created_at, + localPlaylist?.inLibrary?.format( + DateTimeFormatter.ofPattern( + "kk:mm - dd MMM uuuu", + ), + ) ?: "", + ), style = typo.bodyLarge, color = Color(0xC4FFFFFF), ) } Row( modifier = - Modifier.fillMaxWidth(), + Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, ) { RippleIconButton( @@ -261,7 +263,7 @@ fun LocalPlaylistHeader( Spacer(Modifier.weight(1f)) RippleIconButton( modifier = - Modifier.size(36.dp), + Modifier.size(36.dp), resId = R.drawable.baseline_shuffle_24, fillMaxSize = true, ) { @@ -269,7 +271,7 @@ fun LocalPlaylistHeader( Spacer(Modifier.size(5.dp)) RippleIconButton( modifier = - Modifier.size(36.dp), + Modifier.size(36.dp), resId = R.drawable.baseline_more_vert_24, fillMaxSize = true, ) { @@ -288,11 +290,11 @@ fun LocalPlaylistHeader( // ) Text( text = - stringResource( - id = R.string.album_length, - (localPlaylist?.tracks?.size ?: 0).toString(), - "", - ), + stringResource( + id = R.string.album_length, + (localPlaylist?.tracks?.size ?: 0).toString(), + "", + ), color = Color.White, modifier = Modifier.padding(vertical = 8.dp), ) @@ -308,7 +310,7 @@ fun LocalPlaylistHeader( PlaylistItems( isPlaying = false, songEntity = item, - modifier = Modifier.animateItemPlacement() + modifier = Modifier.animateItem() ) } } diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/LyricsView.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/LyricsView.kt index 79aa95f4..df945b1c 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/LyricsView.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/LyricsView.kt @@ -106,7 +106,7 @@ fun LyricsView( ) { val TAG = "LyricsView" - val textMeasurer = rememberTextMeasurer() + rememberTextMeasurer() val localDensity = LocalDensity.current var columnHeightDp by remember { @@ -153,8 +153,7 @@ fun LyricsView( ) { currentLineIndex = -1 } - } - else { + } else { currentLineIndex = -1 } } @@ -163,7 +162,7 @@ fun LyricsView( val boxEnd = listState.layoutInfo.viewportEndOffset val boxStart = listState.layoutInfo.viewportStartOffset val viewPort = boxEnd - boxStart - val offset = viewPort/2 - currentLineHeight/2 + val offset = viewPort / 2 - currentLineHeight / 2 Log.w(TAG, "Offset: $offset") listState.animateScrollAndCentralizeItem( index = currentLineIndex, @@ -282,7 +281,6 @@ fun FullscreenLyricsSheet( scrimColor = Color.Black.copy(alpha = .5f), sheetState = sheetState, modifier = Modifier.fillMaxHeight(), - windowInsets = WindowInsets(0,0,0,0), shape = RectangleShape, ) { Card( @@ -302,7 +300,7 @@ fun FullscreenLyricsSheet( windowInsets.getTop(localDensity).toDp() } ) - ){ + ) { TopAppBar( windowInsets = WindowInsets(0, 0, 0, 0), colors = TopAppBarDefaults.topAppBarColors().copy( diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt index dcf18508..66070914 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt @@ -382,7 +382,7 @@ fun NowPlayingBottomSheet( } } CheckBoxActionButton( - defaultChecked = songEntity.value?.liked ?: false, + defaultChecked = songEntity.value?.liked == true, onChangeListener = onToggleLike, ) Crossfade(targetState = onDownload != null) { diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/SearchFragment.kt b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/SearchFragment.kt index d9d66755..f82c5f93 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/SearchFragment.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/SearchFragment.kt @@ -275,8 +275,8 @@ class SearchFragment : Fragment() { binding.suggestList.visibility = View.GONE binding.suggestListYtItem.visibility = View.GONE - if (viewModel.searchAllResult.value == null || viewModel.searchAllResult.value!!.isEmpty()){ - if (searchHistory.isEmpty()) { + if (viewModel.searchAllResult.value == null || viewModel.searchAllResult.value!!.isEmpty){ + if (searchHistory.isEmpty) { binding.recentlyQueryView.visibility = View.GONE binding.defaultLayout.visibility = View.VISIBLE } diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/library/LibraryFragment.kt b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/library/LibraryFragment.kt index 132d6385..cd4f010b 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/library/LibraryFragment.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/library/LibraryFragment.kt @@ -148,7 +148,7 @@ class LibraryFragment : Fragment() { listPlaylist.clear() listPlaylist.addAll(temp) adapterPlaylist.updateList(listPlaylist) - if (listPlaylist.isEmpty()) { + if (listPlaylist.isEmpty) { binding.tvFavoritePlaylistsStatus.visibility = View.VISIBLE } else { binding.tvFavoritePlaylistsStatus.visibility = View.GONE @@ -163,7 +163,7 @@ class LibraryFragment : Fragment() { listRecentlyAdded.clear() listRecentlyAdded.addAll(temp) adapterItem.updateList(listRecentlyAdded) - if (listRecentlyAdded.isEmpty()) { + if (listRecentlyAdded.isEmpty) { binding.tvRecentlyAdded.visibility = View.GONE } else { binding.tvRecentlyAdded.visibility = View.VISIBLE @@ -177,7 +177,7 @@ class LibraryFragment : Fragment() { listLocalPlaylist.clear() listLocalPlaylist.addAll(temp) adapterLocalPlaylist.updateList(listLocalPlaylist) - if (listLocalPlaylist.isEmpty()) { + if (listLocalPlaylist.isEmpty) { binding.tvYourPlaylistsStatus.visibility = View.VISIBLE } else { binding.tvYourPlaylistsStatus.visibility = View.GONE @@ -191,7 +191,7 @@ class LibraryFragment : Fragment() { listDownloaded.clear() listDownloaded.addAll(temp) adapterDownloaded.updateList(listDownloaded) - if (listDownloaded.isEmpty()) { + if (listDownloaded.isEmpty) { binding.tvDownloadedPlaylistsStatus.visibility = View.VISIBLE } else { binding.tvDownloadedPlaylistsStatus.visibility = View.GONE @@ -211,7 +211,7 @@ class LibraryFragment : Fragment() { listYouTubePlaylist.clear() listYouTubePlaylist.addAll(temp) adapterYouTubePlaylist.updateList(listYouTubePlaylist) - if (listYouTubePlaylist.isEmpty()) { + if (listYouTubePlaylist.isEmpty) { binding.tvYouTubePlaylistsStatus.visibility = View.VISIBLE binding.tvYouTubePlaylistsStatus.text = getString(R.string.no_YouTube_playlists) } else { @@ -591,7 +591,7 @@ class LibraryFragment : Fragment() { listLocalPlaylist.clear() listLocalPlaylist.addAll(temp) adapterLocalPlaylist.updateList(temp) - if (listLocalPlaylist.isEmpty()) { + if (listLocalPlaylist.isEmpty) { binding.tvYourPlaylistsStatus.visibility = View.VISIBLE } else { binding.tvYourPlaylistsStatus.visibility = View.GONE diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/other/ArtistFragment.kt b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/other/ArtistFragment.kt index de1e291d..9c913422 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/fragment/other/ArtistFragment.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/fragment/other/ArtistFragment.kt @@ -602,7 +602,7 @@ class ArtistFragment : Fragment() { tvDescription.originalText = (it.description ?: getString(R.string.no_description)).toString() if (it.songs?.results != null) { popularAdapter.updateList(it.songs.results as ArrayList) - if (it.songs.results.isEmpty()) { + if (it.songs.results.isEmpty) { binding.tvPopular.visibility = View.GONE } } else { @@ -610,7 +610,7 @@ class ArtistFragment : Fragment() { } if (it.singles?.results != null) { singlesAdapter.updateList(it.singles.results as ArrayList) - if (it.singles.results.isEmpty()) { + if (it.singles.results.isEmpty) { binding.tvSingles.visibility = View.GONE } } else { @@ -618,7 +618,7 @@ class ArtistFragment : Fragment() { } if (it.albums?.results != null) { albumsAdapter.updateList(it.albums.results as ArrayList) - if (it.albums.results.isEmpty()) { + if (it.albums.results.isEmpty) { binding.tvAlbums.visibility = View.GONE } } else { @@ -626,7 +626,7 @@ class ArtistFragment : Fragment() { } if (it.video != null) { videoAdapter.updateList(it.video as ArrayList) - if (it.video.isEmpty()) { + if (it.video.isEmpty) { binding.tvVideo.visibility = View.GONE } } else { @@ -634,7 +634,7 @@ class ArtistFragment : Fragment() { } if (it.featuredOn != null) { featuredOnAdapter.updateList(it.featuredOn as ArrayList) - if (it.featuredOn.isEmpty()) { + if (it.featuredOn.isEmpty) { binding.tvFeaturedOn.visibility = View.GONE } } else { @@ -642,7 +642,7 @@ class ArtistFragment : Fragment() { } if (it.related?.results != null) { relatedArtistsAdapter.updateList(it.related.results as ArrayList) - if (it.related.results.isEmpty()) { + if (it.related.results.isEmpty) { binding.tvRelatedArtists.visibility = View.GONE } } else { diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt b/app/src/main/java/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt index 859ef404..e381d7fc 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/screen/home/HomeScreen.kt @@ -264,21 +264,21 @@ fun HomeScreen( item { androidx.compose.animation.AnimatedVisibility( visible = + homeData.find { + it.title == + context.getString( + R.string.quick_picks, + ) + } != null, + ) { + QuickPicks( + homeItem = homeData.find { it.title == context.getString( R.string.quick_picks, ) - } != null, - ) { - QuickPicks( - homeItem = - homeData.find { - it.title == - context.getString( - R.string.quick_picks, - ) - } ?: return@AnimatedVisibility, + } ?: return@AnimatedVisibility, sharedViewModel = sharedViewModel, ) } @@ -407,23 +407,23 @@ fun HomeTopAppBar(navController: NavController) { ) Text( text = - when (hour) { - in 6..12 -> { - stringResource(R.string.good_morning) - } + when (hour) { + in 6..12 -> { + stringResource(R.string.good_morning) + } - in 13..17 -> { - stringResource(R.string.good_afternoon) - } + in 13..17 -> { + stringResource(R.string.good_afternoon) + } - in 18..23 -> { - stringResource(R.string.good_evening) - } + in 18..23 -> { + stringResource(R.string.good_evening) + } - else -> { - stringResource(R.string.good_night) - } - }, + else -> { + stringResource(R.string.good_night) + } + }, style = typo.bodySmall, ) } @@ -465,17 +465,17 @@ fun AccountLayout( CoilImage( imageModel = { url }, imageOptions = - ImageOptions( - contentScale = ContentScale.Crop, - alignment = Alignment.Center, - ), + ImageOptions( + contentScale = ContentScale.Crop, + alignment = Alignment.Center, + ), previewPlaceholder = painterResource(id = R.drawable.holder), component = - rememberImageComponent { - CrossfadePlugin( - duration = 550, - ) - }, + rememberImageComponent { + CrossfadePlugin( + duration = 550, + ) + }, modifier = Modifier .size(40.dp) @@ -488,8 +488,8 @@ fun AccountLayout( style = typo.headlineMedium, color = Color.White, modifier = - Modifier - .padding(start = 8.dp), + Modifier + .padding(start = 8.dp), ) } } @@ -542,19 +542,19 @@ fun QuickPicks( val firstQueue: Track = it.toTrack() sharedViewModel.simpleMediaServiceHandler?.setQueueData( QueueData( - listTracks = arrayListOf(firstQueue), - firstPlayedTrack = firstQueue, - playlistId = "RDAMVM${it.videoId}", - playlistName = "\"${it.title}\" Radio", - playlistType = PlaylistType.RADIO, - continuation = null + listTracks = arrayListOf(firstQueue), + firstPlayedTrack = firstQueue, + playlistId = "RDAMVM${it.videoId}", + playlistName = "\"${it.title}\" Radio", + playlistType = PlaylistType.RADIO, + continuation = null + ) ) - ) - sharedViewModel.loadMediaItemFromTrack( - firstQueue, - type = Config.SONG_CLICK, - ) - }, + sharedViewModel.loadMediaItemFromTrack( + firstQueue, + type = Config.SONG_CLICK, + ) + }, data = it, widthDp = widthDp, ) diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt b/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt index 386c4354..81501a49 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/screen/library/PlaylistScreen.kt @@ -157,10 +157,10 @@ fun PlaylistScreen( initialValue = -limit, targetValue = limit, animationSpec = - infiniteRepeatable( - animation = tween(5000, easing = LinearEasing), - repeatMode = RepeatMode.Reverse, - ), + infiniteRepeatable( + animation = tween(5000, easing = LinearEasing), + repeatMode = RepeatMode.Reverse, + ), label = "shimmer", ) val infiniteTransition = rememberInfiniteTransition(label = "rotation") @@ -168,10 +168,10 @@ fun PlaylistScreen( initialValue = 0f, targetValue = 360f, animationSpec = - infiniteRepeatable( - animation = tween(5000, easing = LinearEasing), - repeatMode = RepeatMode.Restart, - ), + infiniteRepeatable( + animation = tween(5000, easing = LinearEasing), + repeatMode = RepeatMode.Restart, + ), label = "rotation", ) @@ -242,15 +242,15 @@ fun PlaylistScreen( playlistName = "Playlist \"${localPlaylist?.title}\"", playlistType = PlaylistType.LOCAL_PLAYLIST, continuation = - if (offset > 0) { - if (filterState == FilterState.OlderFirst) { - (ASC + offset.toString()) - } else { - (DESC + offset) - } + if (offset > 0) { + if (filterState == FilterState.OlderFirst) { + (ASC + offset.toString()) } else { - null - }, + (DESC + offset) + } + } else { + null + }, ), ) sharedViewModel.loadMediaItemFromTrack( @@ -310,7 +310,7 @@ fun PlaylistScreen( localPlaylist?.downloadState?.let { viewModel.playlistDownloadState.emit(it) } shouldShowSuggestButton = localPlaylist?.youtubePlaylistId != null && - localPlaylist?.youtubePlaylistId != "" + localPlaylist?.youtubePlaylistId != "" firstTimeGetLocalPlaylist = false } } @@ -333,23 +333,23 @@ fun PlaylistScreen( // Box { LazyColumn( modifier = - Modifier - .fillMaxWidth() - .background(Color.Black), + Modifier + .fillMaxWidth() + .background(Color.Black), state = lazyState, ) { item(contentType = "header") { Box( modifier = - Modifier - .fillMaxWidth() - .wrapContentHeight() - .background(Color.Transparent), + Modifier + .fillMaxWidth() + .wrapContentHeight() + .background(Color.Transparent), ) { Box( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), // .haze( // hazeState, // style = HazeMaterials.regular(), @@ -357,29 +357,30 @@ fun PlaylistScreen( ) { Box( modifier = - Modifier - .fillMaxWidth() - .aspectRatio(1f) - .clip( - RoundedCornerShape(8.dp), - ).angledGradientBackground(bg, 25f), + Modifier + .fillMaxWidth() + .aspectRatio(1f) + .clip( + RoundedCornerShape(8.dp), + ) + .angledGradientBackground(bg, 25f), ) Box( modifier = - Modifier - .fillMaxWidth() - .height(180.dp) - .align(Alignment.BottomCenter) - .background( - brush = - Brush.verticalGradient( - listOf( - Color.Transparent, - Color(0x75000000), - Color.Black, - ), - ), + Modifier + .fillMaxWidth() + .height(180.dp) + .align(Alignment.BottomCenter) + .background( + brush = + Brush.verticalGradient( + listOf( + Color.Transparent, + Color(0x75000000), + Color.Black, + ), ), + ), ) } Column( @@ -389,10 +390,10 @@ fun PlaylistScreen( ) { Row( modifier = - Modifier - .wrapContentWidth() - .padding(16.dp) - .windowInsetsPadding(WindowInsets.statusBars), + Modifier + .wrapContentWidth() + .padding(16.dp) + .windowInsetsPadding(WindowInsets.statusBars), ) { RippleIconButton( resId = R.drawable.baseline_arrow_back_ios_new_24, @@ -408,43 +409,43 @@ fun PlaylistScreen( localPlaylist?.thumbnail }, imageOptions = - ImageOptions( - contentScale = ContentScale.FillHeight, - alignment = Alignment.Center, - ), + ImageOptions( + contentScale = ContentScale.FillHeight, + alignment = Alignment.Center, + ), previewPlaceholder = painterResource(id = R.drawable.holder), component = - rememberImageComponent { - add( - CrossfadePlugin( - duration = 550, - ), - ) - add( - PalettePlugin( - paletteLoadedListener = { - palette = it - }, - useCache = true, - ), - ) - +PlaceholderPlugin.Loading(painterResource(id = R.drawable.holder)) - +PlaceholderPlugin.Failure(painterResource(id = R.drawable.holder)) - }, - modifier = - Modifier - .height(250.dp) - .wrapContentWidth() - .align(Alignment.CenterHorizontally) - .clip( - RoundedCornerShape(8.dp), + rememberImageComponent { + add( + CrossfadePlugin( + duration = 550, + ), + ) + add( + PalettePlugin( + paletteLoadedListener = { + palette = it + }, + useCache = true, ), + ) + +PlaceholderPlugin.Loading(painterResource(id = R.drawable.holder)) + +PlaceholderPlugin.Failure(painterResource(id = R.drawable.holder)) + }, + modifier = + Modifier + .height(250.dp) + .wrapContentWidth() + .align(Alignment.CenterHorizontally) + .clip( + RoundedCornerShape(8.dp), + ), ) Box( modifier = - Modifier - .fillMaxWidth() - .wrapContentHeight(), + Modifier + .fillMaxWidth() + .wrapContentHeight(), ) { Column(Modifier.padding(horizontal = 32.dp)) { Spacer(modifier = Modifier.size(25.dp)) @@ -464,21 +465,21 @@ fun PlaylistScreen( Spacer(modifier = Modifier.height(8.dp)) Text( text = - stringResource( - id = R.string.created_at, - localPlaylist?.inLibrary?.format( - DateTimeFormatter.ofPattern( - "kk:mm - dd MMM uuuu", - ), - ) ?: "", - ), + stringResource( + id = R.string.created_at, + localPlaylist?.inLibrary?.format( + DateTimeFormatter.ofPattern( + "kk:mm - dd MMM uuuu", + ), + ) ?: "", + ), style = typo.bodyMedium, color = Color(0xC4FFFFFF), ) } Row( modifier = - Modifier.fillMaxWidth(), + Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, ) { RippleIconButton( @@ -500,15 +501,15 @@ fun PlaylistScreen( playlistName = "Playlist \"${localPlaylist?.title}\"", playlistType = PlaylistType.LOCAL_PLAYLIST, continuation = - if (offset > 0) { - if (filterState == FilterState.OlderFirst) { - (ASC + offset.toString()) - } else { - (DESC + offset) - } + if (offset > 0) { + if (filterState == FilterState.OlderFirst) { + (ASC + offset.toString()) } else { - null - }, + (DESC + offset) + } + } else { + null + }, ), ) sharedViewModel.loadMediaItemFromTrack( @@ -526,27 +527,29 @@ fun PlaylistScreen( DownloadState.STATE_DOWNLOADED -> { Box( modifier = - Modifier - .size(36.dp) - .clip( - CircleShape, - ).clickable { - Toast - .makeText( - context, - context.getString(R.string.downloaded), - Toast.LENGTH_SHORT, - ).show() - }, + Modifier + .size(36.dp) + .clip( + CircleShape, + ) + .clickable { + Toast + .makeText( + context, + context.getString(R.string.downloaded), + Toast.LENGTH_SHORT, + ) + .show() + }, ) { Icon( painter = painterResource(id = R.drawable.baseline_downloaded), tint = Color(0xFF00A0CB), contentDescription = "", modifier = - Modifier - .size(36.dp) - .padding(2.dp), + Modifier + .size(36.dp) + .padding(2.dp), ) } } @@ -554,18 +557,20 @@ fun PlaylistScreen( DownloadState.STATE_DOWNLOADING -> { Box( modifier = - Modifier - .size(36.dp) - .clip( - CircleShape, - ).clickable { - Toast - .makeText( - context, - context.getString(R.string.downloading), - Toast.LENGTH_SHORT, - ).show() - }, + Modifier + .size(36.dp) + .clip( + CircleShape, + ) + .clickable { + Toast + .makeText( + context, + context.getString(R.string.downloading), + Toast.LENGTH_SHORT, + ) + .show() + }, ) { LottieAnimation( composition, @@ -592,55 +597,57 @@ fun PlaylistScreen( AnimatedVisibility(visible = shouldShowSuggestButton) { Box( modifier = - Modifier - .size(36.dp) - .clip(CircleShape) - .graphicsLayer { - compositingStrategy = - CompositingStrategy.Offscreen - }.clickable { - shouldShowSuggestions = !shouldShowSuggestions - }.drawWithCache { - val width = size.width - 10 - val height = size.height - 10 - - val offsetDraw = width * progressAnimated - val gradientColors = - listOf( - Color(0xFF4C82EF), - Color(0xFFD96570), - ) - val brush = - Brush.linearGradient( - colors = gradientColors, - start = Offset(offsetDraw, 0f), - end = - Offset( - offsetDraw + width, - height, - ), - ) + Modifier + .size(36.dp) + .clip(CircleShape) + .graphicsLayer { + compositingStrategy = + CompositingStrategy.Offscreen + } + .clickable { + shouldShowSuggestions = !shouldShowSuggestions + } + .drawWithCache { + val width = size.width - 10 + val height = size.height - 10 - onDrawBehind { - // Destination - with(aiPainter) { - draw( - size = Size(width, width), - ) - } + val offsetDraw = width * progressAnimated + val gradientColors = + listOf( + Color(0xFF4C82EF), + Color(0xFFD96570), + ) + val brush = + Brush.linearGradient( + colors = gradientColors, + start = Offset(offsetDraw, 0f), + end = + Offset( + offsetDraw + width, + height, + ), + ) - // Source - drawRect( - brush = brush, - blendMode = BlendMode.SrcIn, + onDrawBehind { + // Destination + with(aiPainter) { + draw( + size = Size(width, width), ) } - }, + + // Source + drawRect( + brush = brush, + blendMode = BlendMode.SrcIn, + ) + } + }, ) } RippleIconButton( modifier = - Modifier.size(36.dp), + Modifier.size(36.dp), resId = R.drawable.baseline_shuffle_24, fillMaxSize = true, ) { @@ -665,15 +672,15 @@ fun PlaylistScreen( playlistName = "Playlist \"${localPlaylist?.title}\"", playlistType = PlaylistType.LOCAL_PLAYLIST, continuation = - if (offset > 0) { - if (filterState == FilterState.OlderFirst) { - (ASC + offset.toString()) - } else { - (DESC + offset) - } + if (offset > 0) { + if (filterState == FilterState.OlderFirst) { + (ASC + offset.toString()) } else { - null - }, + (DESC + offset) + } + } else { + null + }, ), ) sharedViewModel.loadMediaItemFromTrack( @@ -691,7 +698,7 @@ fun PlaylistScreen( Spacer(Modifier.size(5.dp)) RippleIconButton( modifier = - Modifier.size(36.dp), + Modifier.size(36.dp), resId = R.drawable.baseline_more_vert_24, fillMaxSize = true, ) { @@ -711,11 +718,11 @@ fun PlaylistScreen( // ) Text( text = - stringResource( - id = R.string.album_length, - (localPlaylist?.tracks?.size ?: 0).toString(), - "", - ), + stringResource( + id = R.string.album_length, + (localPlaylist?.tracks?.size ?: 0).toString(), + "", + ), color = Color.White, style = typo.bodyMedium, modifier = Modifier.padding(vertical = 8.dp), @@ -727,9 +734,9 @@ fun PlaylistScreen( Spacer(modifier = Modifier.size(8.dp)) Text( text = - stringResource( - id = R.string.suggest, - ), + stringResource( + id = R.string.suggest, + ), color = Color.White, modifier = Modifier.padding(vertical = 8.dp), ) @@ -738,10 +745,10 @@ fun PlaylistScreen( if (it) { CenterLoadingBox( modifier = - Modifier - .fillMaxWidth() - .height(200.dp) - .align(Alignment.CenterHorizontally), + Modifier + .fillMaxWidth() + .height(200.dp) + .align(Alignment.CenterHorizontally), ) } else { Column { @@ -790,62 +797,62 @@ fun PlaylistScreen( TextButton( onClick = { viewModel.reloadSuggestion() }, modifier = - Modifier - .padding(horizontal = 8.dp) - .drawWithContent { - val strokeWidthPx = 2.dp.toPx() - val width = size.width - val height = size.height + Modifier + .padding(horizontal = 8.dp) + .drawWithContent { + val strokeWidthPx = 2.dp.toPx() + val width = size.width + val height = size.height - drawContent() + drawContent() - with(drawContext.canvas.nativeCanvas) { - val checkPoint = saveLayer(null, null) + with(drawContext.canvas.nativeCanvas) { + val checkPoint = saveLayer(null, null) - // Destination - drawRoundRect( - cornerRadius = CornerRadius(x = 60f, y = 60f), - color = Color.Gray, - topLeft = Offset(strokeWidthPx / 2, strokeWidthPx / 2), - size = Size(width - strokeWidthPx, height - strokeWidthPx), - style = Stroke(strokeWidthPx), + // Destination + drawRoundRect( + cornerRadius = CornerRadius(x = 60f, y = 60f), + color = Color.Gray, + topLeft = Offset(strokeWidthPx / 2, strokeWidthPx / 2), + size = Size(width - strokeWidthPx, height - strokeWidthPx), + style = Stroke(strokeWidthPx), + ) + val gradientColors = + listOf( + Color(0xFF4C82EF), + Color(0xFFD96570), + ) + val brush = + Brush.linearGradient( + colors = gradientColors, + start = Offset(2f, 0f), + end = + Offset( + 2 + width, + height, + ), ) - val gradientColors = - listOf( - Color(0xFF4C82EF), - Color(0xFFD96570), - ) - val brush = - Brush.linearGradient( - colors = gradientColors, - start = Offset(2f, 0f), - end = - Offset( - 2 + width, - height, - ), - ) - - // Source - rotate(degrees = angle) { - drawCircle( - brush = brush, - radius = size.width, - blendMode = BlendMode.SrcIn, - ) - } - restoreToCount(checkPoint) + // Source + rotate(degrees = angle) { + drawCircle( + brush = brush, + radius = size.width, + blendMode = BlendMode.SrcIn, + ) } - }, + + restoreToCount(checkPoint) + } + }, ) { Text( text = stringResource(id = R.string.reload), color = Color.White, modifier = - Modifier.align( - Alignment.CenterVertically, - ), + Modifier.align( + Alignment.CenterVertically, + ), ) } Spacer(modifier = Modifier.size(12.dp)) @@ -859,8 +866,8 @@ fun PlaylistScreen( ElevatedButton( contentPadding = PaddingValues(0.dp), modifier = - Modifier - .defaultMinSize(minWidth = 1.dp, minHeight = 1.dp), + Modifier + .defaultMinSize(minWidth = 1.dp, minHeight = 1.dp), onClick = { viewModel.onUIEvent(LocalPlaylistUIEvent.ChangeFilter) }, @@ -900,7 +907,7 @@ fun PlaylistScreen( onClickListener = { onPlaylistItemClick(it) }, - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), ) } else { PlaylistItems( @@ -908,7 +915,7 @@ fun PlaylistScreen( songEntity = item, onMoreClickListener = { onItemMoreClick(it) }, onClickListener = { onPlaylistItemClick(it) }, - modifier = Modifier.animateItemPlacement(), + modifier = Modifier.animateItem(), ) } } @@ -976,19 +983,19 @@ fun PlaylistScreen( onDismiss = { playlistBottomSheetShow = false }, localPlaylist = it, onEditTitle = - { newTitle -> - viewModel.updatePlaylistTitle(newTitle, it.id) - if (it.syncedWithYouTubePlaylist == 1) { - viewModel.updateYouTubePlaylistTitle( - newTitle, - it.youtubePlaylistId!!, - ) - } - }, + { newTitle -> + viewModel.updatePlaylistTitle(newTitle, it.id) + if (it.syncedWithYouTubePlaylist == 1) { + viewModel.updateYouTubePlaylistTitle( + newTitle, + it.youtubePlaylistId!!, + ) + } + }, onEditThumbnail = - { thumbUri -> - viewModel.updatePlaylistThumbnail(thumbUri, it.id) - }, + { thumbUri -> + viewModel.updatePlaylistThumbnail(thumbUri, it.id) + }, onAddToQueue = { /* Add to queue in LaunchedEffect @@ -1106,9 +1113,9 @@ fun PlaylistScreen( } }, colors = - TopAppBarDefaults.topAppBarColors( - containerColor = Color.Transparent, - ), + TopAppBarDefaults.topAppBarColors( + containerColor = Color.Transparent, + ), modifier = Modifier.angledGradientBackground(bg, 90f), ) } diff --git a/app/src/main/java/com/maxrave/simpmusic/viewModel/SharedViewModel.kt b/app/src/main/java/com/maxrave/simpmusic/viewModel/SharedViewModel.kt index 58e6258c..344ab814 100644 --- a/app/src/main/java/com/maxrave/simpmusic/viewModel/SharedViewModel.kt +++ b/app/src/main/java/com/maxrave/simpmusic/viewModel/SharedViewModel.kt @@ -271,7 +271,7 @@ class SharedViewModel( playlistName = simpleMediaServiceHandler?.queueData?.value?.playlistName ?: "" ) _likeStatus.value = false - _liked.value = state.songEntity?.liked ?: false + _liked.value = state.songEntity?.liked == true _format.value = null _canvas.value = null canvasJob?.cancel() diff --git a/build.gradle.kts b/build.gradle.kts index 894a2e57..eddb0243 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,8 @@ subprojects { arrayOf("reports", "metrics").forEach { freeCompilerArgs.addAll( listOf( - "-P", "plugin:androidx.compose.compiler.plugins.kotlin:${it}Destination=${layout.buildDirectory.asFile.get().absolutePath}/compose_metrics" + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:${it}Destination=${layout.buildDirectory.asFile.get().absolutePath}/compose_metrics" ) ) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3866adea..c04ba4ac 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,25 +1,26 @@ [versions] -android = "8.5.2" +android = "8.7.2" kotlin = "2.0.0" serialization = "2.0.0" ksp = "2.0.0-1.0.22" +#noinspection GradleDependency (2024.10.01 breaks the pullToRefresh) compose-bom = "2024.08.00" -constraintlayout-compose = "1.0.1" -activity-compose = "1.9.1" -lifecycle-viewmodel-compose = "2.8.4" -lifecycle-runtime-ktx = "2.8.4" -core-ktx = "1.13.1" +constraintlayout-compose = "1.1.0" +activity-compose = "1.9.3" +lifecycle-viewmodel-compose = "2.8.7" +lifecycle-runtime-ktx = "2.8.7" +core-ktx = "1.15.0" appcompat = "1.7.0" -work = "2.9.1" -material = "1.11.0" #Version 1.12.0 caused bug -startup-runtime = "1.1.1" -lifecycle-livedata-ktx = "2.8.4" -lifecycle-viewmodel-ktx = "2.8.4" -ui-tooling = "1.6.8" +work = "2.10.0" +material = "1.12.0" +startup-runtime = "1.2.0" +lifecycle-livedata-ktx = "2.8.7" +lifecycle-viewmodel-ktx = "2.8.7" +ui-tooling = "1.7.5" media3 = "1.4.1" palette-ktx = "1.0.0" expandable-text = "2.0.0" -constraintlayout = "2.1.4" +constraintlayout = "2.2.0" junit = "4.13.2" androidx-junit = "1.2.1" espresso-core = "3.6.1" @@ -27,12 +28,12 @@ room = "2.6.1" legacy-support-v4 = "1.0.0" coroutines-android = "1.8.1" coroutines-guava = "1.8.1" -navigation = "2.7.7" +navigation = "2.8.3" gson = "2.10.1" coil = "2.6.0" easypermissions = "3.0.0" preference-ktx = "1.2.1" -fragment-ktx = "1.8.2" +fragment-ktx = "1.8.5" datastore-preferences = "1.1.1" swiperefreshlayout = "1.2.0-alpha01" insetter = "0.6.1" @@ -50,12 +51,12 @@ insetsx = "0.1.0-alpha10" ktor = "2.3.12" brotli = "0.1.2" ksoup = "0.3.1" -desugaring = "2.1.1" +desugaring = "2.1.2" koin-bom = "4.0.0-RC1" koin-annotations = "1.4.0-RC4" [libraries] -desugaring = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugaring"} +desugaring = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugaring" } compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } compose-material3-lib = { group = "androidx.compose.material3", name = "material3" } compose-ui = { group = "androidx.compose.ui", name = "ui" } @@ -114,7 +115,7 @@ shimmer = { group = "com.facebook.shimmer", name = "shimmer", version.ref = "shi lottie = { group = "com.airbnb.android", name = "lottie", version.ref = "lottie" } lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottie" } paging-runtime-ktx = { group = "androidx.paging", name = "paging-runtime-ktx", version.ref = "paging" } -paging-compose = { group = "androidx.paging", name = "paging-compose", version.ref = "paging"} +paging-compose = { group = "androidx.paging", name = "paging-compose", version.ref = "paging" } customactivityoncrash = { group = "cat.ereza", name = "customactivityoncrash", version.ref = "customactivityoncrash" } sdp-android = { group = "com.intuit.sdp", name = "sdp-android", version.ref = "sdp-android" } ssp-android = { group = "com.intuit.ssp", name = "ssp-android", version.ref = "ssp-android" } @@ -144,10 +145,10 @@ ksoup-entities = { group = "com.mohamedrejeb.ksoup", name = "ksoup-entities", ve koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" } koin-core = { module = "io.insert-koin:koin-core" } koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose" } -koin-android = { module = "io.insert-koin:koin-android"} +koin-android = { module = "io.insert-koin:koin-android" } koin-workmanager = { module = "io.insert-koin:koin-androidx-workmanager" } koin-annotations = { module = "io.insert-koin:koin-annotations", version.ref = "koin-annotations" } -koin-ksp = { module = "io.insert-koin:koin-ksp-compiler", version.ref = "koin-annotations"} +koin-ksp = { module = "io.insert-koin:koin-ksp-compiler", version.ref = "koin-annotations" } [plugins] android-application = { id = "com.android.application", version.ref = "android" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8307a0f1..1f3327fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kotlinYtmusicScraper/build.gradle.kts b/kotlinYtmusicScraper/build.gradle.kts index 0b584075..b384cfac 100644 --- a/kotlinYtmusicScraper/build.gradle.kts +++ b/kotlinYtmusicScraper/build.gradle.kts @@ -9,7 +9,7 @@ plugins { android { namespace = "com.maxrave.kotlinytmusicscraper" - compileSdk = 34 + compileSdk = 35 defaultConfig { minSdk = 26 @@ -28,7 +28,7 @@ android { } } kotlin { - jvmToolchain(17) + jvmToolchain(21) } packaging { jniLibs.useLegacyPackaging = true