Skip to content

Commit

Permalink
refactor of some little things
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbyESP committed Nov 21, 2024
1 parent 45d2f3e commit b641d93
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ fun MediaStorePage(
) { onReloadMediaStore() }

is ResourceState.Success -> {
if (songsList.data!!.isEmpty()) {
val dataSongsList = songsList.data!!
if (dataSongsList.isEmpty()) {
EmptyMediaStore(
modifier = Modifier.fillMaxSize()
)
} else {
val dataSongsList = songsList.data!!
when (type) {
LayoutType.Grid -> {
LazyVerticalGridScrollbar(
Expand Down Expand Up @@ -118,7 +118,7 @@ fun MediaStorePage(
items(
count = dataSongsList.size,
key = { index -> dataSongsList[index].id },
contentType = { index -> dataSongsList[index].id.toString() }) { index ->
contentType = { _ -> "songItem" }) { index ->
val song = dataSongsList[index]
HorizontalSongCard(
song = song,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.koin.core.component.KoinComponent

class MediaStorePageViewModel(
context: Context
) : KoinComponent, ViewModel() {
) : ViewModel() {
private val _songs: MutableStateFlow<ResourceState<List<Song>>> =
MutableStateFlow(ResourceState.Loading())
val songs = _songs.asStateFlow()
Expand All @@ -39,9 +38,7 @@ class MediaStorePageViewModel(

fun onEvent(event: Events) {
when (event) {
is Events.StartObservingMediaStore -> {
songsCollection()
}
is Events.StartObservingMediaStore -> songsCollection()

is Events.ReloadMediaStore -> reloadMediaStore()
}
Expand Down

0 comments on commit b641d93

Please sign in to comment.