Skip to content

Commit

Permalink
Small attempt at fixing HomePage Lag
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliano101 committed Nov 3, 2024
1 parent 9520ecd commit ce80149
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.maxrave.simpmusic.common.DownloadState.STATE_NOT_DOWNLOADED
import java.time.LocalDateTime

@Entity(tableName = "song")
data class SongEntity (
data class SongEntity(
@PrimaryKey(autoGenerate = false) val videoId: String = "",
val albumId: String? = null,
val albumName: String? = null,
Expand All @@ -26,8 +26,7 @@ data class SongEntity (
val totalPlayTime: Long = 0, // in milliseconds
val downloadState: Int = STATE_NOT_DOWNLOADED,
val inLibrary: LocalDateTime = LocalDateTime.now(),
)
{
) {
fun toggleLike() = copy(liked = !liked)

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.maxrave.simpmusic.data.model.browse.album


import androidx.compose.runtime.Immutable
import com.google.gson.annotations.SerializedName
import com.maxrave.simpmusic.data.model.searchResult.songs.Artist
import com.maxrave.simpmusic.data.model.searchResult.songs.Thumbnail

@Immutable
data class AlbumBrowse(
@SerializedName("artists")
val artists: List<Artist>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.maxrave.simpmusic.data.model.browse.album


import androidx.compose.runtime.Immutable
import com.google.gson.annotations.SerializedName
import com.maxrave.simpmusic.data.model.searchResult.songs.Album
import com.maxrave.simpmusic.data.model.searchResult.songs.Artist
import com.maxrave.simpmusic.data.model.searchResult.songs.FeedbackTokens
import com.maxrave.simpmusic.data.model.searchResult.songs.Thumbnail

@Immutable
data class Track(
@SerializedName("album")
val album: Album?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.maxrave.simpmusic.data.model.home


import androidx.compose.runtime.Immutable
import com.google.gson.annotations.SerializedName
import com.maxrave.simpmusic.data.model.searchResult.songs.Thumbnail

@Immutable
data class HomeItem(
@SerializedName("contents")
val contents: List<Content?>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ fun HomeScreen(
)
}
}
items(homeData) {
items(homeData, key = { it.title + it.channelId }) {
if (it.title != context.getString(R.string.quick_picks)) {
HomeItem(
homeViewModel = viewModel,
Expand All @@ -296,7 +296,7 @@ fun HomeScreen(
)
}
}
items(newRelease) {
items(newRelease, key = { it.title + it.channelId }) {
androidx.compose.animation.AnimatedVisibility(
visible = newRelease.isNotEmpty(),
) {
Expand Down

0 comments on commit ce80149

Please sign in to comment.