mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
show download status on the library tabs and offer it in their menus
Album tiles, artist rows and playlist rows now carry the badge (lower right on tiles, trailing end on rows) and their long-press menus take the same bulk Download / Cancel / Delete entries the hero uses, driven by the shared actions rule so a partly downloaded item offers both rows and an in-flight one offers Cancel. The artist page's album cells get the badge and album menu too. The three list callbacks the artist menu used (and its artist-specific view-model calls) collapse into one bulkDownload action over a MenuTarget, since the same menu code now serves album, playlist and artist.
This commit is contained in:
@@ -772,7 +772,9 @@ class DownloadRepositoryTest {
|
||||
),
|
||||
),
|
||||
)
|
||||
db.libraryDao().upsertArtists(listOf(Artist(sourceId = 1, id = "ar2", name = "Other", albumCount = 1, starred = null, coverArt = null)))
|
||||
db.libraryDao().upsertArtists(
|
||||
listOf(Artist(sourceId = 1, id = "ar2", name = "Other", albumCount = 1, starred = null, coverArt = null)),
|
||||
)
|
||||
db.downloadDao().upsert(SongDownload(1, "s1", DownloadStatus.Completed))
|
||||
db.downloadDao().upsert(SongDownload(1, "s3", DownloadStatus.Queued))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.subtracks.ui.components
|
||||
|
||||
import com.subtracks.data.model.ListDownloadStatus
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class DownloadIndicatorTest {
|
||||
@Test
|
||||
fun anUntouchedListShowsNothing() {
|
||||
assertEquals(DownloadIndicator.Hidden, ListDownloadStatus().indicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aListWithNothingStartedButNoSongsShowsNothing() {
|
||||
assertEquals(DownloadIndicator.Hidden, ListDownloadStatus(total = 4).indicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aQueuedButNotYetDownloadedListShowsProgress() {
|
||||
assertEquals(DownloadIndicator.InProgress, ListDownloadStatus(total = 4, downloading = 4).indicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aPartlyDownloadedListShowsProgress() {
|
||||
assertEquals(DownloadIndicator.InProgress, ListDownloadStatus(total = 4, downloaded = 2).indicator())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aFullyDownloadedListShowsDone() {
|
||||
assertEquals(DownloadIndicator.Complete, ListDownloadStatus(total = 4, downloaded = 4).indicator())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user