-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented favorite toggle button on player
- Loading branch information
Showing
11 changed files
with
192 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/blackcandy/android/data/FavoritePlaylistRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.blackcandy.android.data | ||
|
||
import org.blackcandy.android.api.BlackCandyService | ||
import org.blackcandy.android.models.Song | ||
|
||
class FavoritePlaylistRepository( | ||
private val service: BlackCandyService, | ||
) { | ||
suspend fun addSong(songId: Int): Song { | ||
return service.addSongToFavorite(songId) | ||
} | ||
|
||
suspend fun deleteSong(songId: Int): Song { | ||
return service.deleteSongFromFavorite(songId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/src/main/java/org/blackcandy/android/utils/SnackbarUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.blackcandy.android.utils | ||
|
||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.res.stringResource | ||
import org.blackcandy.android.models.AlertMessage | ||
|
||
class SnackbarUtil { | ||
companion object { | ||
@Composable | ||
fun ShowSnackbar( | ||
message: AlertMessage, | ||
state: SnackbarHostState, | ||
onShowed: () -> Unit, | ||
) { | ||
val snackbarText = | ||
when (message) { | ||
is AlertMessage.String -> message.value | ||
is AlertMessage.StringResource -> stringResource(message.value) | ||
} | ||
|
||
LaunchedEffect(state) { | ||
state.showSnackbar(snackbarText) | ||
onShowed() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.