-
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.
Loading status checks…
Implemented switch of playback mode
Showing
10 changed files
with
131 additions
and
18 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
4 changes: 2 additions & 2 deletions
4
...rg/blackcandy/android/media/MusicState.kt → ...g/blackcandy/android/models/MusicState.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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package org.blackcandy.android.media | ||
package org.blackcandy.android.models | ||
|
||
import androidx.media3.common.Player | ||
import org.blackcandy.android.models.Song | ||
|
||
data class MusicState( | ||
val playlist: List<Song> = emptyList(), | ||
val playbackState: Int = Player.STATE_IDLE, | ||
val currentSong: Song? = null, | ||
val isPlaying: Boolean = false, | ||
val playbackMode: PlaybackMode = PlaybackMode.NO_REPEAT, | ||
) { | ||
val hasCurrentSong: Boolean get() = currentSong != null | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/org/blackcandy/android/models/PlaybackMode.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,33 @@ | ||
package org.blackcandy.android.models | ||
|
||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.StringRes | ||
import org.blackcandy.android.R | ||
|
||
enum class PlaybackMode { | ||
NO_REPEAT, | ||
REPEAT, | ||
REPEAT_ONE, | ||
SHUFFLE, | ||
; | ||
|
||
@get:DrawableRes | ||
val iconResourceId get() = | ||
when (this) { | ||
NO_REPEAT -> R.drawable.baseline_repeat_24 | ||
REPEAT -> R.drawable.baseline_repeat_24 | ||
REPEAT_ONE -> R.drawable.baseline_repeat_one_24 | ||
SHUFFLE -> R.drawable.baseline_shuffle_24 | ||
} | ||
|
||
@get:StringRes | ||
val titleResourceId get() = | ||
when (this) { | ||
NO_REPEAT -> R.string.no_repeat_mode | ||
REPEAT -> R.string.repeat_mode | ||
REPEAT_ONE -> R.string.repeat_one_mode | ||
SHUFFLE -> R.string.shuffle_mode | ||
} | ||
|
||
val next get() = PlaybackMode.values()[(this.ordinal + 1) % PlaybackMode.values().size] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4zM13,15L13,9h-1l-2,1v1h1.5v4L13,15z"/> | ||
|
||
</vector> |
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,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M10.59,9.17L5.41,4 4,5.41l5.17,5.17 1.42,-1.41zM14.5,4l2.04,2.04L4,18.59 5.41,20 17.96,7.46 20,9.5L20,4h-5.5zM14.83,13.41l-1.41,1.41 3.13,3.13L14.5,20L20,20v-5.5l-2.04,2.04 -3.13,-3.13z"/> | ||
|
||
</vector> |
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