mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
feat(ui): Steam Deck menu icons, and Compose previews rendered to PNGs (#2900)
* Rail and second-screen icons in the Steam Deck menu's style Solid icons throughout the rail, and Steam's glyphs where Steam has the same place: Library is the four-square grid, Stores the price tag, Downloads the download arrow, Settings the gear. On the second screen, Screenshots uses Steam's Media picture and Chat its Friends people. * Compose previews of the launcher and the in-game menu, rendered to PNGs Debug-only previews of the launcher on each tab and the in-game menu's pages, built from the production composables with sample state and no-op actions, at the Duo's handheld size and in portrait. PreviewRenderTest draws each with Robolectric's native graphics into app/build/preview-renders/, so a UI change can be looked at without a device, and fails on a preview that throws or draws nothing. docs/compose-previews.md says how to run and extend them. * Preview renders wait for store accounts before drawing A preview case can name what the render test waits for. The Library and Stores cases wait for store accounts, which load on a background thread, so their PNGs never catch the loading state. * Preview renders step the paused clock while waiting for a case to be ready
This commit is contained in:
1 parent
df48a85a71
commit
d4af37937a
8 files changed
+266
-51
No files matched your search
@@ -7,10 +7,10 @@ import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Download
|
||||
import androidx.compose.material.icons.outlined.Forum
|
||||
import androidx.compose.material.icons.outlined.Speed
|
||||
import androidx.compose.material.icons.outlined.PhotoLibrary
|
||||
import androidx.compose.material.icons.filled.Speed
|
||||
import androidx.compose.material.icons.filled.Download
|
||||
import androidx.compose.material.icons.filled.Image
|
||||
import androidx.compose.material.icons.filled.People
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -32,10 +32,10 @@ class BottomPageActions(
|
||||
internal const val BOTTOM_PAGE_TELEMETRY = "telemetry"
|
||||
|
||||
fun sessionBottomPages(actions: BottomPageActions): List<BottomPage> = listOf(
|
||||
BottomPage(BOTTOM_PAGE_TELEMETRY, R.string.bottom_page_telemetry, Icons.Outlined.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) },
|
||||
BottomPage("downloads", R.string.bottom_page_downloads, Icons.Outlined.Download) { BottomDownloadsPage() },
|
||||
BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Outlined.PhotoLibrary) { BottomScreenshotsPage(actions.takeScreenshot) },
|
||||
BottomPage("chat", R.string.bottom_page_chat, Icons.Outlined.Forum) { BottomChatPage() },
|
||||
BottomPage(BOTTOM_PAGE_TELEMETRY, R.string.bottom_page_telemetry, Icons.Filled.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) },
|
||||
BottomPage("downloads", R.string.bottom_page_downloads, Icons.Filled.Download) { BottomDownloadsPage() },
|
||||
BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Filled.Image) { BottomScreenshotsPage(actions.takeScreenshot) },
|
||||
BottomPage("chat", R.string.bottom_page_chat, Icons.Filled.People) { BottomChatPage() },
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -46,20 +46,20 @@ import androidx.compose.foundation.relocation.BringIntoViewRequester
|
||||
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Apps
|
||||
import androidx.compose.material.icons.outlined.Download
|
||||
import androidx.compose.material.icons.outlined.SdStorage
|
||||
import androidx.compose.material.icons.outlined.Sync
|
||||
import androidx.compose.material.icons.outlined.Terminal
|
||||
import androidx.compose.material.icons.outlined.DesktopWindows
|
||||
import androidx.compose.material.icons.outlined.Layers
|
||||
import androidx.compose.material.icons.outlined.LocalMall
|
||||
import androidx.compose.material.icons.outlined.MoreHoriz
|
||||
import androidx.compose.material.icons.filled.SportsEsports
|
||||
import androidx.compose.material.icons.filled.GridView
|
||||
import androidx.compose.material.icons.filled.LocalOffer
|
||||
import androidx.compose.material.icons.filled.Download
|
||||
import androidx.compose.material.icons.filled.DesktopWindows
|
||||
import androidx.compose.material.icons.filled.Layers
|
||||
import androidx.compose.material.icons.filled.Terminal
|
||||
import androidx.compose.material.icons.filled.Apps
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.SdStorage
|
||||
import androidx.compose.material.icons.filled.Sync
|
||||
import androidx.compose.material.icons.filled.MoreHoriz
|
||||
import androidx.compose.material.icons.filled.SystemUpdate
|
||||
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
|
||||
import androidx.compose.material.icons.outlined.SportsEsports
|
||||
import androidx.compose.material.icons.outlined.Storefront
|
||||
import androidx.compose.material.icons.outlined.SystemUpdate
|
||||
import androidx.compose.material.icons.outlined.Tune
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@@ -193,21 +193,22 @@ internal fun SideRail(
|
||||
}
|
||||
}
|
||||
|
||||
// Solid icons in the Steam Deck menu's style; where Steam has the same place (Library, Store, Downloads, Settings) its glyph is used.
|
||||
internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
|
||||
"steam" -> R.string.rail_steam to Icons.Outlined.SportsEsports
|
||||
"games" -> R.string.rail_games to GameShelfIcon
|
||||
"steam" -> R.string.rail_steam to Icons.Filled.SportsEsports
|
||||
"games" -> R.string.rail_games to Icons.Filled.GridView
|
||||
"soundtracks" -> R.string.rail_music to SoundtrackIcon
|
||||
"stores" -> R.string.rail_stores to Icons.Outlined.LocalMall
|
||||
"downloads" -> R.string.stores_tab_downloads to Icons.Outlined.Download
|
||||
"desktop" -> R.string.rail_desktop to Icons.Outlined.DesktopWindows
|
||||
"components" -> R.string.rail_components to Icons.Outlined.Layers
|
||||
"agent" -> R.string.rail_agent to Icons.Outlined.Terminal
|
||||
"android-apps" -> R.string.rail_apps to Icons.Outlined.Apps
|
||||
"setup" -> R.string.rail_setup to Icons.Outlined.Tune
|
||||
"storage" -> R.string.rail_storage to Icons.Outlined.SdStorage
|
||||
"sync" -> R.string.rail_sync to Icons.Outlined.Sync
|
||||
NavTabs.MORE -> R.string.rail_more to Icons.Outlined.MoreHoriz
|
||||
else -> R.string.rail_updates to Icons.Outlined.SystemUpdate
|
||||
"stores" -> R.string.rail_stores to Icons.Filled.LocalOffer
|
||||
"downloads" -> R.string.stores_tab_downloads to Icons.Filled.Download
|
||||
"desktop" -> R.string.rail_desktop to Icons.Filled.DesktopWindows
|
||||
"components" -> R.string.rail_components to Icons.Filled.Layers
|
||||
"agent" -> R.string.rail_agent to Icons.Filled.Terminal
|
||||
"android-apps" -> R.string.rail_apps to Icons.Filled.Apps
|
||||
"setup" -> R.string.rail_setup to Icons.Filled.Settings
|
||||
"storage" -> R.string.rail_storage to Icons.Filled.SdStorage
|
||||
"sync" -> R.string.rail_sync to Icons.Filled.Sync
|
||||
NavTabs.MORE -> R.string.rail_more to Icons.Filled.MoreHoriz
|
||||
else -> R.string.rail_updates to Icons.Filled.SystemUpdate
|
||||
}
|
||||
|
||||
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) ||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.PathFillType
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.vector.addPathNodes
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
internal val GameShelfIcon: ImageVector = ImageVector.Builder("GameShelf", 24.dp, 24.dp, 24f, 24f).apply {
|
||||
for (d in listOf(
|
||||
"M3,4H7V20H3ZM4.4,5.4V18.6H5.6V5.4Z",
|
||||
"M8.5,4H12.5V20H8.5ZM9.9,5.4V18.6H11.1V5.4Z",
|
||||
"M14.2,5.1L18.1,4.2L21.4,19.8L17.5,20.7ZM15.9,6.2L18.6,18.9L19.8,18.6L17.1,5.9Z",
|
||||
"M2,21H22V22.5H2Z",
|
||||
)) addPath(addPathNodes(d), fill = SolidColor(Color.Black), pathFillType = PathFillType.EvenOdd)
|
||||
}.build()
|
||||
Reference in new issue
Block a user