mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
feat(library): fold not-installed games under one row, link stores' owned games, and fix card sizes and streaming progress (#2894)
* feat(library): fold not-installed games under one row, link a store's owned games, and make card sizes step The Library shows installed games first and folds every owned-but-not-installed game under a "Not installed · N" row that a tap or the A button opens and closes; it replaces the installed/all-owned choice that sat in the Filter menu, which now only appears for Xbox's access filters. Controller focus stops on the row between the two sections and stays on it across a toggle. A store's profile card turns its "<store> · N games" line into the link to those games in the Library, replacing the separate text button. Card sizes pick a column count from the pane width, one column per step, so every Larger/Smaller step changes the grid; before, several steps landed on the same count and only stretched the cards. GOG streams download and install together, and each byte update and each install update used to flip the entry's stage and reset the install count. The install count now survives those swaps and the detail page shows both: "Downloading 9% · Installing 25%", with the download as the fill and the install as a thin bar. The store accounts button uses an accounts icon instead of a second "+", and the Library tab uses a game controller instead of the video library icon. * fix(library): a store with nothing installed folds to its Not installed row instead of an empty-state button With no installed games to show, collapsing used to swap the grid for "No installed games match these filters" and a Browse owned games button. It now leaves only the Not installed row, which reopens the list the same way, by tap or by A. * feat(library): count every owned game in the header and nudge the Not installed arrow The "N games" next to the Library title counts the games folded under Not installed too, so a store with nothing installed reads "316 games" instead of "0 games". The row's arrow hops twice every few seconds toward the way it opens, and at once when the row takes controller focus; it stays still when animations are off. * feat(rail): draw the Library tab as game cases on a shelf Material's video library icon read as a photo or video gallery. * feat(library): the header counts the whole library, whichever store or filter is picked * fix(downloads): keep a streaming install's two bars until the download reaches 100% A download at 99.95% counted as finished, so the install bar disappeared and the fill swapped between download and install progress for the last stretch. * fix(downloads): decide a streaming download is finished from its byte counts A float fraction rounds 99,999,999 of 100,000,000 bytes up to 1. * feat(downloads): show a streaming install as one bar, downloaded behind installed Two bars that moved almost together, under a label with both percentages, read as a glitch. The chip now shows "Installing 61%" with a light fill for what has downloaded and a solid fill for what has installed, like a video's buffer. * feat(downloads): the game page shows one steady bar that only fills up The detail page's chip shows "Installing 62%" from one overall value: the download fills the first 90% and the install the rest, also when they stream together. The fill never steps back across stage changes, keeps one animation key per download, and the chip keeps a minimum width with tabular digits so it does not resize as the number grows. The Downloads tab keeps its per-stage detail. * feat(downloads): a full-size progress button on the game page that opens Downloads The progress chip was a 24 dp pill beside 48 dp buttons. It is now a button the size of Pause and Cancel, filled as the job advances, with a › that opens the Downloads tab and sends the fly-in ball to the rail's Downloads item, by touch or A. The Library card's percent and the bottom-screen download row use the same steady value, so every place shows one bar that only grows. The overall value keeps the install part when the last bytes arrive while the stage still reads Download.
This commit is contained in:
1 parent
cc93ab51c5
commit
13a6e0606a
13 files changed
+398
-82
No files matched your search
@@ -24,4 +24,45 @@ class DownloadEntryTest {
|
||||
assertFalse(e.passed(DownloadStage.INSTALL))
|
||||
assertTrue(e.copy(state = DownloadState.INSTALLED).passed(DownloadStage.INSTALL))
|
||||
}
|
||||
|
||||
@Test fun streamingInstallKeepsDownloadAndInstallProgressApart() {
|
||||
val installBit = 1 shl DownloadStage.INSTALL.ordinal
|
||||
val installing = base.copy(stage = DownloadStage.INSTALL, bytesDone = 10, bytesTotal = 100, stageDone = 25, stageTotal = 100)
|
||||
assertTrue(installing.streaming)
|
||||
assertEquals(0.10f, installing.downloadFraction, 0.001f)
|
||||
assertEquals(0.25f, installing.installFraction, 0.001f)
|
||||
val backToDownload = installing.copy(stage = DownloadStage.DOWNLOAD, stagesPassed = installBit)
|
||||
assertTrue(backToDownload.streaming)
|
||||
assertEquals(0.25f, backToDownload.installFraction, 0.001f)
|
||||
assertFalse(base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 10, bytesTotal = 100).streaming)
|
||||
assertTrue(installing.copy(bytesDone = 99_950, bytesTotal = 100_000).streaming)
|
||||
assertTrue(installing.copy(bytesDone = 99_999_999, bytesTotal = 100_000_000).streaming)
|
||||
assertFalse(installing.copy(bytesDone = 100).streaming)
|
||||
assertFalse(installing.copy(state = DownloadState.PAUSED).streaming)
|
||||
}
|
||||
|
||||
@Test fun overallProgressOnlyGrowsAcrossSequentialAndStreamingStages() {
|
||||
val installBit = 1 shl DownloadStage.INSTALL.ordinal
|
||||
val downloadBit = 1 shl DownloadStage.DOWNLOAD.ordinal
|
||||
val sequential = listOf(
|
||||
base.copy(stage = DownloadStage.MANIFEST),
|
||||
base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 50, bytesTotal = 100),
|
||||
base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 100, bytesTotal = 100),
|
||||
base.copy(stage = DownloadStage.INSTALL, bytesDone = 100, bytesTotal = 100, stagesPassed = downloadBit, stageDone = 0, stageTotal = 10),
|
||||
base.copy(stage = DownloadStage.INSTALL, bytesDone = 100, bytesTotal = 100, stagesPassed = downloadBit, stageDone = 10, stageTotal = 10),
|
||||
base.copy(state = DownloadState.INSTALLED),
|
||||
).map { it.overallFraction }
|
||||
assertEquals(sequential, sequential.sorted())
|
||||
assertEquals(1f, sequential.last(), 0f)
|
||||
val streaming = listOf(
|
||||
base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 10, bytesTotal = 100),
|
||||
base.copy(stage = DownloadStage.INSTALL, bytesDone = 20, bytesTotal = 100, stageDone = 15, stageTotal = 100),
|
||||
base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 40, bytesTotal = 100, stageDone = 15, stageTotal = 100, stagesPassed = installBit),
|
||||
base.copy(stage = DownloadStage.INSTALL, bytesDone = 60, bytesTotal = 100, stageDone = 55, stageTotal = 100, stagesPassed = installBit),
|
||||
base.copy(stage = DownloadStage.DOWNLOAD, bytesDone = 100, bytesTotal = 100, stageDone = 60, stageTotal = 100, stagesPassed = installBit),
|
||||
base.copy(stage = DownloadStage.INSTALL, bytesDone = 100, bytesTotal = 100, stageDone = 80, stageTotal = 100, stagesPassed = installBit or downloadBit),
|
||||
).map { it.overallFraction }
|
||||
assertEquals(streaming, streaming.sorted())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class LibraryColumnsTest {
|
||||
@Test fun everySizeStepChangesTheColumnCountUntilOne() {
|
||||
val phone = (0..4).map { libraryColumns(width = 1080, base = 450, gap = 30, level = it) }
|
||||
assertEquals(listOf(4, 3, 2, 1, 1), phone)
|
||||
val tablet = (0..4).map { libraryColumns(width = 2400, base = 450, gap = 30, level = it) }
|
||||
assertEquals(listOf(7, 6, 5, 4, 3), tablet)
|
||||
}
|
||||
}
|
||||
@@ -76,52 +76,43 @@ class LibraryVisibilityTest {
|
||||
LibraryView.focusFirst = false
|
||||
}
|
||||
|
||||
@Test fun uninstalledGamesAreHiddenUntilSelectedInTheFilterAndTheChoiceSurvivesReopeningLibrary() {
|
||||
@Test fun uninstalledGamesStayFoldedUnderTheirRowAndTheChoiceSurvivesReopeningLibrary() {
|
||||
show()
|
||||
compose.onNodeWithText("Installed Steam game").assertExists()
|
||||
compose.onNodeWithText("Uninstalled GOG").assertDoesNotExist()
|
||||
chooseVisibility(true)
|
||||
compose.onNodeWithText("NOT INSTALLED · 2").assertExists()
|
||||
compose.onNodeWithText("3 games").assertExists()
|
||||
toggleNotInstalled(true)
|
||||
compose.onNodeWithText("3 games").assertExists()
|
||||
compose.onNodeWithText("Uninstalled GOG").assertExists()
|
||||
assertTrue(SessionPrefs.libraryShowUninstalled(ctx))
|
||||
compose.runOnIdle { generation++; Snapshot.sendApplyNotifications() }
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertExists()
|
||||
chooseVisibility(false)
|
||||
toggleNotInstalled(false)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertDoesNotExist()
|
||||
assertFalse(SessionPrefs.libraryShowUninstalled(ctx))
|
||||
}
|
||||
|
||||
@Test fun theFilterExpandsBesideSortWithoutChangingTheSelectionOnOpen() {
|
||||
@Test fun theNotInstalledRowReplacesTheFilterButtonAndSortStillOpens() {
|
||||
show()
|
||||
val filter = compose.onNodeWithContentDescription("Filter · Installed only")
|
||||
val sort = compose.onNodeWithContentDescription("Sort")
|
||||
assertTrue(filter.fetchSemanticsNode().boundsInRoot.right <= sort.fetchSemanticsNode().boundsInRoot.left)
|
||||
filter.performClick()
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
compose.onNodeWithText("Installed only").assertIsDisplayed()
|
||||
compose.onNodeWithText("All owned games").assertIsDisplayed()
|
||||
compose.onAllNodesWithText("Filter").assertCountEquals(1)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertDoesNotExist()
|
||||
compose.onNodeWithContentDescription("Filter · Installed only").assertDoesNotExist()
|
||||
compose.onNodeWithTag("library-not-installed").assertExists()
|
||||
assertFalse(SessionPrefs.libraryShowUninstalled(ctx))
|
||||
compose.runOnIdle { Steps.fold(); Snapshot.sendApplyNotifications() }
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
sort.performClick()
|
||||
compose.onNodeWithContentDescription("Sort").performClick()
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
compose.onAllNodesWithText("Sort").assertCountEquals(1)
|
||||
compose.onNodeWithText("Recently played").assertIsDisplayed()
|
||||
}
|
||||
|
||||
@Test fun theXboxAccessChoicesShareTheLibraryFilter() {
|
||||
@Test fun theXboxFilterOnlyOffersTheXboxAccessChoices() {
|
||||
StoreAccounts.write(ctx, Store.XBOX, JSONObject().put("username", "Library test"))
|
||||
StoresState.accounts[Store.XBOX] = "Library test"
|
||||
StoresState.library[Store.XBOX] = listOf(CatalogItem(Store.XBOX, "owned", "Uninstalled Xbox", null, owned = true))
|
||||
LibraryView.source = Store.XBOX.id
|
||||
try {
|
||||
show()
|
||||
compose.onNodeWithContentDescription("Filter · Installed only").performClick()
|
||||
compose.onNodeWithContentDescription("Filter · All").performClick()
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
compose.onNodeWithText("Installed only").assertIsDisplayed()
|
||||
compose.onNodeWithText("All owned games").assertIsDisplayed()
|
||||
compose.onNodeWithText("Installed only").assertDoesNotExist()
|
||||
compose.onNodeWithText("Game Pass").assertIsDisplayed().performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
assertEquals(XboxLibraryFilter.GAME_PASS, XboxLibraryFilter.current)
|
||||
@@ -131,14 +122,19 @@ class LibraryVisibilityTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aSearchWithOnlyUninstalledMatchesOffersToRevealThem() {
|
||||
@Test fun aSearchWithOnlyUninstalledMatchesShowsTheFoldedRowToRevealThem() {
|
||||
LibraryView.query = "Uninstalled GOG"
|
||||
show()
|
||||
compose.onNodeWithText("Uninstalled GOG").assertDoesNotExist()
|
||||
compose.onNodeWithTag("library-browse-owned").performClick()
|
||||
compose.onNodeWithText("No installed games match these filters", substring = true).assertDoesNotExist()
|
||||
compose.onNodeWithTag("library-not-installed").performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertExists()
|
||||
assertEquals("Uninstalled GOG", LibraryView.query)
|
||||
compose.onNodeWithTag("library-not-installed").performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertDoesNotExist()
|
||||
compose.onNodeWithTag("library-not-installed").assertExists()
|
||||
}
|
||||
|
||||
@Test fun aHiddenStoreRemainsReachableInLibraryInItsConfiguredOrder() {
|
||||
@@ -151,11 +147,19 @@ class LibraryVisibilityTest {
|
||||
assertTrue(steam < epic && epic < gog)
|
||||
compose.onNodeWithTag("library-source-gog").performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
compose.onNodeWithTag("library-browse-owned").assertIsDisplayed().performClick()
|
||||
compose.onNodeWithTag("library-not-installed").assertIsDisplayed().performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
compose.onNodeWithText("Uninstalled GOG").assertExists()
|
||||
}
|
||||
|
||||
@Test fun theHeaderCountsTheWholeLibraryWhicheverStoreIsPicked() {
|
||||
show()
|
||||
compose.onNodeWithText("3 games").assertExists()
|
||||
compose.onNodeWithTag("library-source-gog").performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
compose.onNodeWithText("3 games").assertExists()
|
||||
}
|
||||
|
||||
@Test fun theStoresOwnedGamesLinkRevealsOwnedGamesDespiteTheSavedInstalledOnlyView() {
|
||||
assertFalse(SessionPrefs.libraryShowUninstalled(ctx))
|
||||
LibraryView.showOwned(ctx, Store.GOG)
|
||||
@@ -188,13 +192,8 @@ class LibraryVisibilityTest {
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
}
|
||||
|
||||
private fun chooseVisibility(show: Boolean) {
|
||||
compose.onNodeWithContentDescription("Filter · " + if (SessionPrefs.libraryShowUninstalled(ctx)) "All owned games" else "Installed only")
|
||||
.performClick()
|
||||
compose.mainClock.advanceTimeBy(2_000)
|
||||
assertTrue(Steps.open)
|
||||
compose.onNodeWithText(if (show) "All owned games" else "Installed only")
|
||||
.performClick()
|
||||
private fun toggleNotInstalled(show: Boolean) {
|
||||
compose.onNodeWithTag("library-not-installed").performClick()
|
||||
compose.mainClock.advanceTimeBy(1_000)
|
||||
assertEquals(show, SessionPrefs.libraryShowUninstalled(ctx))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user